답안 #158847

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
158847 2019-10-19T06:02:27 Z username Minerals (JOI19_minerals) C++14
70 / 100
46 ms 2292 KB
#include "minerals.h"
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define REP(i,j,k) for(int i=(j);i<(k);++i)
#define pb push_back
// #define __debug
#ifdef __debug
	#define pr(...) cerr<<__VA_ARGS__
	#define ar(a,s,t) {rep(zy,s,t)pr(a[zy]<<' ');pr(endl);}
#else
	#define pr(...) (void)0
	#define ar(...) (void)0
#endif
//
int ls=0,ll=0;
vector<int>v[2];

int qr(int x){
	int t=Query(x+1);
	swap(t,ls);
	return ls==t;
}

void sol(int l,int r,vector<int>&vec){
	if(l+1==r)Answer(v[0][l]+1,vec[0]+1);
	else{
		int mid=(2*l+r+1)/3;
		vector<int>vv[2];
		if(l>ll)REP(i,l,mid)qr(v[0][i]);
		else REP(i,mid,r)qr(v[0][i]);
		ll=l;
		REP(i,0,vec.size()){
			int t=vec[i];
			vv[qr(t)].pb(t);
		}
		sol(l,mid,vv[1]);
		sol(mid,r,vv[0]);
	}
	vector<int>().swap(vec);
}

void Solve(int n){
	REP(i,0,2*n)v[qr(i)].pb(i);
	sol(0,n,v[1]);
}

Compilation message

minerals.cpp: In function 'void sol(int, int, std::vector<int>&)':
minerals.cpp:5:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,j,k) for(int i=(j);i<(k);++i)
                                   ^
minerals.cpp:33:3: note: in expansion of macro 'REP'
   REP(i,0,vec.size()){
   ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 9 ms 632 KB Output is correct
5 Correct 17 ms 1036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 9 ms 632 KB Output is correct
9 Correct 17 ms 1036 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 12 ms 788 KB Output is correct
12 Correct 17 ms 1144 KB Output is correct
13 Correct 16 ms 1064 KB Output is correct
14 Correct 14 ms 1016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 9 ms 632 KB Output is correct
9 Correct 17 ms 1036 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 12 ms 788 KB Output is correct
12 Correct 17 ms 1144 KB Output is correct
13 Correct 16 ms 1064 KB Output is correct
14 Correct 14 ms 1016 KB Output is correct
15 Correct 45 ms 2292 KB Output is correct
16 Correct 45 ms 2164 KB Output is correct
17 Correct 36 ms 2212 KB Output is correct
18 Correct 37 ms 1956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 9 ms 632 KB Output is correct
9 Correct 17 ms 1036 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 12 ms 788 KB Output is correct
12 Correct 17 ms 1144 KB Output is correct
13 Correct 16 ms 1064 KB Output is correct
14 Correct 14 ms 1016 KB Output is correct
15 Correct 45 ms 2292 KB Output is correct
16 Correct 45 ms 2164 KB Output is correct
17 Correct 36 ms 2212 KB Output is correct
18 Correct 37 ms 1956 KB Output is correct
19 Incorrect 46 ms 2212 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 9 ms 632 KB Output is correct
9 Correct 17 ms 1036 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 12 ms 788 KB Output is correct
12 Correct 17 ms 1144 KB Output is correct
13 Correct 16 ms 1064 KB Output is correct
14 Correct 14 ms 1016 KB Output is correct
15 Correct 45 ms 2292 KB Output is correct
16 Correct 45 ms 2164 KB Output is correct
17 Correct 36 ms 2212 KB Output is correct
18 Correct 37 ms 1956 KB Output is correct
19 Incorrect 46 ms 2212 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 9 ms 632 KB Output is correct
9 Correct 17 ms 1036 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 12 ms 788 KB Output is correct
12 Correct 17 ms 1144 KB Output is correct
13 Correct 16 ms 1064 KB Output is correct
14 Correct 14 ms 1016 KB Output is correct
15 Correct 45 ms 2292 KB Output is correct
16 Correct 45 ms 2164 KB Output is correct
17 Correct 36 ms 2212 KB Output is correct
18 Correct 37 ms 1956 KB Output is correct
19 Incorrect 46 ms 2212 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 9 ms 632 KB Output is correct
9 Correct 17 ms 1036 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 12 ms 788 KB Output is correct
12 Correct 17 ms 1144 KB Output is correct
13 Correct 16 ms 1064 KB Output is correct
14 Correct 14 ms 1016 KB Output is correct
15 Correct 45 ms 2292 KB Output is correct
16 Correct 45 ms 2164 KB Output is correct
17 Correct 36 ms 2212 KB Output is correct
18 Correct 37 ms 1956 KB Output is correct
19 Incorrect 46 ms 2212 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 9 ms 632 KB Output is correct
9 Correct 17 ms 1036 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 12 ms 788 KB Output is correct
12 Correct 17 ms 1144 KB Output is correct
13 Correct 16 ms 1064 KB Output is correct
14 Correct 14 ms 1016 KB Output is correct
15 Correct 45 ms 2292 KB Output is correct
16 Correct 45 ms 2164 KB Output is correct
17 Correct 36 ms 2212 KB Output is correct
18 Correct 37 ms 1956 KB Output is correct
19 Incorrect 46 ms 2212 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -