제출 #1031834

#제출 시각아이디문제언어결과실행 시간메모리
1031834aymanrs카멜레온의 사랑 (JOI20_chameleon)C++14
4 / 100
8 ms460 KiB
#include "chameleon.h" #include <bits/stdc++.h> using namespace std; void Solve(int N) { bool v[2*N+1] = {false}; int p = 1; vector<int> s = {1}; for(int i = 2;i <= 2*N;i++){ s.push_back(i); if(Query(s) > p){ p++; continue; } p--; int l = 0, r = s.size()-2, m, b = -1; while(l<r){ m = l+r>>1; swap(s[m+1], s.back()); if(Query(vector<int>(s.begin()+l, s.begin()+m+2)) == m-l+2) l = m+1; else r=m; swap(s[m+1], s.back()); } Answer(i, s[l]); s.pop_back(); s.erase(s.begin()+l); } }

컴파일 시 표준 에러 (stderr) 메시지

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:17:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |       m = l+r>>1;
      |           ~^~
chameleon.cpp:15:35: warning: unused variable 'b' [-Wunused-variable]
   15 |     int l = 0, r = s.size()-2, m, b = -1;
      |                                   ^
chameleon.cpp:5:8: warning: unused variable 'v' [-Wunused-variable]
    5 |   bool v[2*N+1] = {false};
      |        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...