Submission #118189

# Submission time Handle Problem Language Result Execution time Memory
118189 2019-06-18T10:29:28 Z scanhex Meetings (JOI19_meetings) C++17
29 / 100
2000 ms 9088 KB
#include "meetings.h"
#ifdef ONPC
#include "grader.h"
#endif
#include<bits/stdc++.h>
using namespace std;

map<vector<int>,int>mp;
int que(int a,int b,int c){
	vector<int>v={a,b,c};
	sort(v.begin(),v.end());
	if(mp.count(v))return mp[v];
	return mp[v]=Query(v[0],v[1],v[2]);
}
using uint=unsigned int;
uint seed=239239239;
uint xrand(){
	seed^=seed<<2;
	seed^=seed>>7;
	seed^=seed<<7;
	return seed;
}
mt19937 rnd(228);
void solve(vector<int>v){
//	cerr<<v.size()<<'\n';
//	for(auto&x:v)
//		cerr<<x<<' ';
//	cerr<<'\n';
	if(v.size()<=1)return;
	shuffle(v.begin(),v.end(),rnd);
	int kek=v[0];
	int cur=v[1];
	vector<int>nw={};
	for(int x:v){
		if(x==kek)continue;
		if(x==cur){
			nw.push_back(x);
			continue;
		}
		int mem=que(x,cur,kek);
		if(mem==kek)
			;
		else if(mem==cur)
			nw.push_back(x);
		else
			nw.push_back(x),cur=mem;
	}
	Bridge(min(kek,cur),max(kek,cur));
	solve(nw);
	set<int>nw1(nw.begin(),nw.end());
	vector<int>other;
	for(int x:v)
		if(!nw1.count(x))other.push_back(x);
	solve(other);
}
void Solve(int n) {
	mp.clear();
	vector<int>ord(n);
	iota(ord.begin(),ord.end(),0);
	solve(ord);
}

# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 304 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 304 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 304 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 304 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 512 KB Output is correct
16 Correct 3 ms 512 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 512 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 304 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 304 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 512 KB Output is correct
16 Correct 3 ms 512 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 512 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 28 ms 1272 KB Output is correct
28 Correct 33 ms 1664 KB Output is correct
29 Correct 24 ms 1152 KB Output is correct
30 Correct 29 ms 1528 KB Output is correct
31 Correct 23 ms 1152 KB Output is correct
32 Correct 56 ms 2584 KB Output is correct
33 Correct 78 ms 3240 KB Output is correct
34 Correct 68 ms 2936 KB Output is correct
35 Correct 76 ms 3192 KB Output is correct
36 Correct 32 ms 1528 KB Output is correct
37 Correct 11 ms 640 KB Output is correct
38 Correct 11 ms 640 KB Output is correct
39 Correct 9 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3019 ms 9088 KB Time limit exceeded
2 Halted 0 ms 0 KB -