Submission #824606

#TimeUsernameProblemLanguageResultExecution timeMemory
824606LucaIlieMinerals (JOI19_minerals)C++17
40 / 100
18 ms2592 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 43000; const int UNDEF = -1; int pairr[2 * MAX_N + 1]; void solve( vector <int> &v ) { int n = v.size() / 2; vector<int> left, right; if ( n == 1 ) { pairr[v[0]] = v[1]; pairr[v[1]] = v[0]; return; } for ( int i: v ) { int ans = Query( i ); if ( ans > n / 2 ) { right.push_back( i ); Query( i ); } else left.push_back( i ); } for ( int i: left ) Query( i ); solve( left ); solve( right ); } void Solve( int n ) { vector<int> v; for ( int i = 1; i <= 2 * n; i++ ) { pairr[i] = UNDEF; v.push_back( i ); } solve( v ); for ( int i = 1; i <= 2 * n; i++ ) { if ( pairr[i] < i ) Answer( i, pairr[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...