회원가입
로그인
Toggle navigation
문제
문제
전체 문제
문제 출처
단계별로 풀어보기
알고리즘 분류
추가된 문제
문제 순위
문제
푼 사람이 한 명인 문제
아무도 못 푼 문제
최근 제출된 문제
최근 풀린 문제
랜덤
출처
ICPC
Olympiad
한국정보올림피아드
한국정보올림피아드시․도지역본선
전국 대학생 프로그래밍 대회 동아리 연합
대학교 대회
카카오 코드 페스티벌
Coder's High
ICPC
Regionals
World Finals
Korea Regional
Africa and the Middle East Regionals
Europe Regionals
Latin America Regionals
North America Regionals
South Pacific Regionals
문제집
대회
채점 현황
랭킹
게시판
그룹
더 보기
재채점 기록
블로그
강의
실험실
도움말
BOJ Stack
BOJ Book
전체
공지
자유
질문
오타/오역/요청
게시판 공지
홍보
업데이트
solved.ac
글쓰기
질문 도움말
자주묻는 질문
반례 부탁드립니다.
1074번 - Z
goodleeches
3년 전
0
16% 정도에서 틀렸다고 나옵니다. 질문글에 올라온 반례들은 모두 통과합니다.
반례 부탁드립니다.
#include <iostream> #include <cmath> using namespace std; int n, r, c; long long cnt; struct rect { long long left = 0; long long top = 0; long long right = 0; long long bottom = 0; rect() { this->left = 0; this->top = 0; this->right = 0; this->bottom = 0; } rect(long long left, long long top, long long right, long long bottom) { this->left = left; this->top = top; this->right = right; this->bottom = bottom; } rect(const rect& r) { this->left = r.left; this->top = r.top; this->right = r.right; this->bottom = r.bottom; } }; void recursive(long long left, long long top, long long right, long long bottom) { if (right - left == 1 && bottom - top == 1) { for (size_t i = left; i < right; i++) { for (size_t j = top; j < bottom; j++) { if (i == c && j == r) return; cnt++; } } } rect R[4]; R[0] = rect(left, top, (left + right) / 2, (top + bottom) / 2); R[1] = rect((left + right) / 2, top, right, (top + bottom) / 2); R[2] = rect(left, (top + bottom) / 2, (left + right) / 2, bottom); R[3] = rect((left + right) / 2 , (top + bottom) / 2, right, bottom); for (size_t i = 0; i < 4; i++) { if (R[i].left <= c && c < R[i].right && R[i].top <= r && r < R[i].bottom) { recursive(R[i].left, R[i].top, R[i].right, R[i].bottom); return; } else { long long x = ((long long)R[i].right - R[i].left); long long y = ((long long)R[i].bottom - R[i].top); cnt += x * y; } } } int main() { cin >> n >> r >> c; recursive(0, 0, (long long)pow(2, n), (long long)pow(2, n)); cout << cnt; return 0; }
댓글을 작성하려면
로그인
해야 합니다.
goodleeches 3년 전
16% 정도에서 틀렸다고 나옵니다. 질문글에 올라온 반례들은 모두 통과합니다.
반례 부탁드립니다.