# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
824668 | 2023-08-14T08:40:25 Z | LucaIlie | Minerals (JOI19_minerals) | C++17 | 110 ms | 262144 KB |
#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], perm[2 * MAX_N + 1]; int ans = 0; void solve( vector <int> &v, bool active ) { int n = v.size() / 2, ln = n / 2; vector<int> left, right; /*printf( "%d: ", n ); for ( int i: v ) printf( "%d ", i ); printf( "\n" );*/ if ( n == 1 ) { pairr[v[0]] = v[1]; pairr[v[1]] = v[0]; return; } int firstAns = ans; for ( int i: v ) { if ( left.size() == ln * 2 ) { right.push_back( i ); continue; } ans = Query( perm[i] ); if ( abs( ans - firstAns ) > ln ) { right.push_back( i ); Query( perm[i] ); } else left.push_back( i ); } solve( left, !active ); solve( right, active ); } void Solve( int n ) { vector<int> v; for ( int i = 1; i <= 2 * n; i++ ) { pairr[i] = UNDEF; v.push_back( i ); perm[i] = i; } //random_shuffle( perm + 1, perm + 1 + 2 * n ); solve( v, false ); for ( int i = 1; i <= 2 * n; i++ ) { if ( pairr[i] < i ) Answer( perm[i], perm[pairr[i]] ); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 260 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 110 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 260 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 260 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 260 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 260 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 260 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 260 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 260 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |