# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
133199 |
2019-07-20T09:10:56 Z |
ekrem |
Minerals (JOI19_minerals) |
C++17 |
|
17 ms |
504 KB |
#include "minerals.h"
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define MAXN 1000005
using namespace std;
typedef long long ll;
typedef pair < int , int > ii;
int n, top = 1, a[MAXN], u[MAXN];
int myrandom(int x){
return rand()%x;
}
void Solve(int n) {n*= 2;
srand(time(0));
::n = n;
for(int i = 1; i <= n; i++)
a[i] = i;
random_shuffle(a + 1, a + n + 1, myrandom);
// for(int i = 1; i <= n; i++)
// cout << a[i] << " ";cout << endl;
// n *= 2;
for(int i = 1; i <= n; i++){
top++;
int don = top - Query(a[i]);
// cout << i << " " << don << endl;
if(don == 2){
for(int j = 1; j < i; j++){
if(u[a[j]])
continue;
top--;
int don = top - Query(a[j]);
// cout << j << " " << don << endl;
if(don == 1){
for(int k = j - 1; k >= 1; k--)
if(!u[a[k]]){
top++;
Query(a[k]);
}
u[a[j]] = u[a[i]] = 1;
// cout << "Buldum " << i << " " << j << endl;
Answer(a[i], a[j]);
top--;
Query(a[i]);
break;
}
}
// cout << "Bitti" << endl;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Output is correct |
2 |
Incorrect |
17 ms |
504 KB |
Wrong Answer [2] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
6 ms |
376 KB |
Output is correct |
6 |
Incorrect |
17 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
6 ms |
376 KB |
Output is correct |
6 |
Incorrect |
17 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
6 ms |
376 KB |
Output is correct |
6 |
Incorrect |
17 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
6 ms |
376 KB |
Output is correct |
6 |
Incorrect |
17 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
6 ms |
376 KB |
Output is correct |
6 |
Incorrect |
17 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
6 ms |
376 KB |
Output is correct |
6 |
Incorrect |
17 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
6 ms |
376 KB |
Output is correct |
6 |
Incorrect |
17 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |