# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
824237 | 2023-08-13T19:45:17 Z | LucaIlie | Minerals (JOI19_minerals) | C++17 | 14 ms | 1360 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 43000; const int B = 100; const int UNDEF = -1; int perm[2 * MAX_N + 1], pairr[2 * MAX_N + 1]; set<int> notPaired, s; vector<int> pairedQueue; void Solve( int n ) { for ( int i = 0; i < 2 * n; i++ ) { perm[i] = i + 1; pairr[i] = UNDEF; notPaired.insert( i ); } random_shuffle( perm, perm + 2 * n ); while ( !notPaired.empty() ) { pairedQueue.clear(); for ( int i: notPaired ) { int x = Query( perm[i] ); if ( x > B ) { Query( perm[i] ); continue; } if ( x == s.size() ) { int p = UNDEF; for ( int j: s ) { int y = Query( perm[j] ); if ( x == y ) { p = j; break; } else Query( perm[j] ); } pairr[i] = p; pairr[p] = i; pairedQueue.push_back( i ); pairedQueue.push_back( p ); s.erase( p ); Query( perm[i] ); } else s.insert( i ); } for ( int i: pairedQueue ) notPaired.erase( i ); } for ( int i = 0; i < 2 * n; i++ ) { if ( pairr[i] < i ) Answer( perm[pairr[i]], perm[i] ); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 464 KB | Output is correct |
2 | Correct | 3 ms | 592 KB | Output is correct |
3 | Correct | 8 ms | 844 KB | Output is correct |
4 | Incorrect | 14 ms | 1360 KB | Wrong Answer [2] |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 3 ms | 592 KB | Output is correct |
7 | Correct | 8 ms | 844 KB | Output is correct |
8 | Incorrect | 14 ms | 1360 KB | Wrong Answer [2] |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 3 ms | 592 KB | Output is correct |
7 | Correct | 8 ms | 844 KB | Output is correct |
8 | Incorrect | 14 ms | 1360 KB | Wrong Answer [2] |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 3 ms | 592 KB | Output is correct |
7 | Correct | 8 ms | 844 KB | Output is correct |
8 | Incorrect | 14 ms | 1360 KB | Wrong Answer [2] |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 3 ms | 592 KB | Output is correct |
7 | Correct | 8 ms | 844 KB | Output is correct |
8 | Incorrect | 14 ms | 1360 KB | Wrong Answer [2] |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 3 ms | 592 KB | Output is correct |
7 | Correct | 8 ms | 844 KB | Output is correct |
8 | Incorrect | 14 ms | 1360 KB | Wrong Answer [2] |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 3 ms | 592 KB | Output is correct |
7 | Correct | 8 ms | 844 KB | Output is correct |
8 | Incorrect | 14 ms | 1360 KB | Wrong Answer [2] |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 3 ms | 592 KB | Output is correct |
7 | Correct | 8 ms | 844 KB | Output is correct |
8 | Incorrect | 14 ms | 1360 KB | Wrong Answer [2] |
9 | Halted | 0 ms | 0 KB | - |