제출 #520054

#제출 시각아이디문제언어결과실행 시간메모리
520054drkarlicio2107Minerals (JOI19_minerals)C++14
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> #include "minerals.h" using namespace std; vector <int> a, b; int cnt=0; int diff (int x){ int a=Query (x); if (a!=cnt){ cnt=a; return 1; } else{ cnt=a; return 0; } } int solve (vector <int> a, vector <int> b, int x){ random_shuffle (a.begin(), a.end()); random_shuffle (b.begin(), b.end()); if (a.size()==1){ Answer (a[0], b[0]); return 0; } int mid=a.size()/2; vector <int> a1, a2, b1, b2; for (int i=0; i<mid; i++){ diff (a[i]); a1.push_back(a[i]); } for (int i=mid; i<a.size(); i++) a2.push_back(a[i]); for (int i=0; i<b.size(); i++){ if (b1.size()==a1.size()) b2.push_back(b[i]); else if (b2.size()==a2.size()) b1.push_back(b[i]); else if ((diff (b[i])==0 && x==1) || (diff (b[i])==1 && x==0)) b1.push_back(b[i]); else b2.push_back(b[i]); } solve (a1, b1, x ^ 1); solve (a2, b2, x); } void Solve(int n){ for (int i=1; i<2*n+1; i++){ if (diff (i)) b.push_back(i); else a.push_back(i); } solve (a,b,1); }

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

minerals.cpp: In function 'int solve(std::vector<int>, std::vector<int>, int)':
minerals.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |  for (int i=mid; i<a.size(); i++) a2.push_back(a[i]);
      |                  ~^~~~~~~~~
minerals.cpp:26:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for (int i=0; i<b.size(); i++){
      |                ~^~~~~~~~~
minerals.cpp:21:15: warning: control reaches end of non-void function [-Wreturn-type]
   21 |  vector <int> a1, a2, b1, b2;
      |               ^~
#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...