답안 #133900

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
133900 2019-07-21T16:58:30 Z ekrem Minerals (JOI19_minerals) C++14
40 / 100
208 ms 12528 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;
typedef set < int > si;

int n, top, onc, h[MAXN];
set < int > :: iterator it;

int sor(int x){
	if(h[x])
		top--;
	else
		top++;
	h[x] = 1 - h[x];
	return top - Query(x);
}

void coz(si a, si b){
	if(a.size() == 1){
		Answer(*a.begin(), *b.begin());
		return;
	}
	int n = a.size();
	si x, y;
	for(int i = 1; i <= n/2; i++){
		int of = *a.begin();
		a.erase(of);
		x.insert(of);
		onc = sor(of);
	}
	for(it = b.begin(); it != b.end(); it++){
		int don = sor(*it);
		if(don != onc){
			y.insert(*it);
		}
		onc = don;
	}
	for(it = y.begin(); it != y.end(); it++)
		b.erase(*it);
	for(it = x.begin(); it != x.end(); it++)
		onc = sor(*it);
	coz(a, y);
	coz(x, b);
}

void Solve(int N) {
	n = N+N;
	set < int > a, b;
	for(int i = 1; i <= n; i++){
		int don = sor(i);
		// cout << don << " " << onc << endl;
		if(don > onc)
			a.insert(i);
		else
			b.insert(i);
		onc = don;
	}
	coz(a, b);
	// for(it = a.begin(); it != a.end(); it++)cout << *it << " ";cout << endl;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 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
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 10 ms 888 KB Output is correct
3 Correct 20 ms 1528 KB Output is correct
4 Correct 43 ms 2864 KB Output is correct
5 Correct 89 ms 4984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 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 5 ms 632 KB Output is correct
6 Correct 10 ms 888 KB Output is correct
7 Correct 20 ms 1528 KB Output is correct
8 Correct 43 ms 2864 KB Output is correct
9 Correct 89 ms 4984 KB Output is correct
10 Correct 6 ms 632 KB Output is correct
11 Correct 55 ms 3620 KB Output is correct
12 Correct 87 ms 5156 KB Output is correct
13 Correct 71 ms 5112 KB Output is correct
14 Correct 69 ms 4984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 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 5 ms 632 KB Output is correct
6 Correct 10 ms 888 KB Output is correct
7 Correct 20 ms 1528 KB Output is correct
8 Correct 43 ms 2864 KB Output is correct
9 Correct 89 ms 4984 KB Output is correct
10 Correct 6 ms 632 KB Output is correct
11 Correct 55 ms 3620 KB Output is correct
12 Correct 87 ms 5156 KB Output is correct
13 Correct 71 ms 5112 KB Output is correct
14 Correct 69 ms 4984 KB Output is correct
15 Incorrect 208 ms 12528 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 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 5 ms 632 KB Output is correct
6 Correct 10 ms 888 KB Output is correct
7 Correct 20 ms 1528 KB Output is correct
8 Correct 43 ms 2864 KB Output is correct
9 Correct 89 ms 4984 KB Output is correct
10 Correct 6 ms 632 KB Output is correct
11 Correct 55 ms 3620 KB Output is correct
12 Correct 87 ms 5156 KB Output is correct
13 Correct 71 ms 5112 KB Output is correct
14 Correct 69 ms 4984 KB Output is correct
15 Incorrect 208 ms 12528 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 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 5 ms 632 KB Output is correct
6 Correct 10 ms 888 KB Output is correct
7 Correct 20 ms 1528 KB Output is correct
8 Correct 43 ms 2864 KB Output is correct
9 Correct 89 ms 4984 KB Output is correct
10 Correct 6 ms 632 KB Output is correct
11 Correct 55 ms 3620 KB Output is correct
12 Correct 87 ms 5156 KB Output is correct
13 Correct 71 ms 5112 KB Output is correct
14 Correct 69 ms 4984 KB Output is correct
15 Incorrect 208 ms 12528 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 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 5 ms 632 KB Output is correct
6 Correct 10 ms 888 KB Output is correct
7 Correct 20 ms 1528 KB Output is correct
8 Correct 43 ms 2864 KB Output is correct
9 Correct 89 ms 4984 KB Output is correct
10 Correct 6 ms 632 KB Output is correct
11 Correct 55 ms 3620 KB Output is correct
12 Correct 87 ms 5156 KB Output is correct
13 Correct 71 ms 5112 KB Output is correct
14 Correct 69 ms 4984 KB Output is correct
15 Incorrect 208 ms 12528 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 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 5 ms 632 KB Output is correct
6 Correct 10 ms 888 KB Output is correct
7 Correct 20 ms 1528 KB Output is correct
8 Correct 43 ms 2864 KB Output is correct
9 Correct 89 ms 4984 KB Output is correct
10 Correct 6 ms 632 KB Output is correct
11 Correct 55 ms 3620 KB Output is correct
12 Correct 87 ms 5156 KB Output is correct
13 Correct 71 ms 5112 KB Output is correct
14 Correct 69 ms 4984 KB Output is correct
15 Incorrect 208 ms 12528 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 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 5 ms 632 KB Output is correct
6 Correct 10 ms 888 KB Output is correct
7 Correct 20 ms 1528 KB Output is correct
8 Correct 43 ms 2864 KB Output is correct
9 Correct 89 ms 4984 KB Output is correct
10 Correct 6 ms 632 KB Output is correct
11 Correct 55 ms 3620 KB Output is correct
12 Correct 87 ms 5156 KB Output is correct
13 Correct 71 ms 5112 KB Output is correct
14 Correct 69 ms 4984 KB Output is correct
15 Incorrect 208 ms 12528 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -