Submission #1072702

#TimeUsernameProblemLanguageResultExecution timeMemory
1072702CyanberryMinerals (JOI19_minerals)C++14
40 / 100
14 ms2012 KiB
// minecraft #include <bits/stdc++.h> using namespace std; #include "minerals.h" void Solve(int types) { bool side[types * 2]; int sT[types], sF[types], relT[types], relF[types], match[types * 2]; for (int i=0; i<types * 2; ++i) { side[i] = false; match[i] = 0; } int last = 0, sTc = 0, sFc = 0; for (int i=0; i<types * 2; ++i) { int curr = Query(i+1); if (curr > last) { ++last; sT[sTc] = i+1; ++sTc; side[i] = true; } else { sF[sFc] = i+1; ++sFc; } } bool inside[types]; for (int i =0; i < types; ++i) { inside[i] = true; } for (int i = log2(types) + 1; i >= 0; --i) { // for (int i : match) { // cerr<<i<<' '; // } // cerr<<'\n'; for (int j = 0; j < types; ++j) { if (((sT[j] & (1<<i)) > 0) == inside[j]) { last = Query(sT[j]); inside[j] = !inside[j]; } } for (int j =0; j < types; ++j) { int curr = Query(sF[j]); if (curr != last) { match[sF[j]-1] |= (1<<i); last = curr; } } } for (int i = 0; i < types * 2; ++i) { if (match[i] > 0) { Answer(i+1, match[i]); } } }

Compilation message (stderr)

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:6:10: warning: variable 'side' set but not used [-Wunused-but-set-variable]
    6 |     bool side[types * 2];
      |          ^~~~
minerals.cpp:7:31: warning: unused variable 'relT' [-Wunused-variable]
    7 |     int sT[types], sF[types], relT[types], relF[types], match[types * 2];
      |                               ^~~~
minerals.cpp:7:44: warning: unused variable 'relF' [-Wunused-variable]
    7 |     int sT[types], sF[types], relT[types], relF[types], match[types * 2];
      |                                            ^~~~
#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...