Submission #907325

#TimeUsernameProblemLanguageResultExecution timeMemory
907325lightonMinerals (JOI19_minerals)C++17
40 / 100
19 ms2408 KiB
#include "minerals.h" #include <bits/stdc++.h> #define forf(i,a,b) for(int i = a; i<=b; i++) using namespace std; int N,M; vector<int> pre,sec; vector<int> match; void dnc(int s, int e , vector<int> v){ if(s==e){ for(int i : v) match[i] = sec[s]; return; } int m = s+e>>1; int now = 0; forf(i,s,m){ now = Query(sec[i]); } vector<int> v1,v2; for(int i : v){ int prv = now; now = Query(pre[i]); if(now == prv) v1.push_back(i); else v2.push_back(i); now = Query(pre[i]); } forf(i,s,m){ now = Query(sec[i]); } dnc(s,m,v1); dnc(m+1,e,v2); } void Solve(int N) { int now = 0; forf(i,1,2*N){ int prv = now; now = Query(i); if(now == prv+1) pre.push_back(i); else sec.push_back(i); } assert(pre.size() == N); match.resize(N); forf(i,1,2*N){int tmp = Query(i);} vector<int> v; forf(i,0,N-1) v.push_back(i); dnc(0,N-1,v); forf(i,0,N-1) Answer(pre[i],match[i]); }

Compilation message (stderr)

minerals.cpp: In function 'void dnc(int, int, std::vector<int>)':
minerals.cpp:13:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   13 |     int m = s+e>>1;
      |             ~^~
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 Solve(int)':
minerals.cpp:37:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |     assert(pre.size() == N);
      |            ~~~~~~~~~~~^~~~
minerals.cpp:39:23: warning: unused variable 'tmp' [-Wunused-variable]
   39 |     forf(i,1,2*N){int tmp = Query(i);}
      |                       ^~~
#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...