제출 #502643

#제출 시각아이디문제언어결과실행 시간메모리
502643sidonMinerals (JOI19_minerals)C++17
40 / 100
29 ms2424 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; const int LIM = 43e3; int A[LIM], L, R = -1; void extend(int lv, int rv) { while(lv < L) Query(A[--L]); while(rv > R) Query(A[++R]); while(lv > L) Query(A[L++]); while(rv < R) Query(A[R--]); } void dfs(int l, int r, vector<int> b) { assert(size(b) == r-l); if(l == r) return; if(l == r - 1) return Answer(A[l], b[0]); int m = (l + r) / 2; extend(l, m-1); vector<int> bL, bR; for(int &i : b) { if((int)size(bL) == m - l) bR.push_back(i); else if((int)size(bR) == r - m) bL.push_back(i); else (Query(i) == Query(i) ? bL : bR).push_back(i); } dfs(l, m, bL); dfs(m, r, bR); } void Solve(int N) { vector<int> b; for(int i = 1; i <= N * 2; ++i) { if(R == N - 1 || Query(i) < R + 2) { b.push_back(i); Query(i); } else A[++R] = i; } dfs(0, N, b); }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from minerals.cpp:2:
minerals.cpp: In function 'void dfs(int, int, std::vector<int>)':
minerals.cpp:17:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |  assert(size(b) == r-l);
      |         ~~~~~~~~^~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...