Submission #510348

# Submission time Handle Problem Language Result Execution time Memory
510348 2022-01-15T00:37:19 Z jamezzz Stations (IOI20_stations) C++17
8 / 100
1247 ms 556 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> label(int n,int k,vector<int> u,vector<int> v){
	vector<int> l(n);
	for(int i=0;i<n;++i)l[i]=i;
	return l;
}

int pre[1005],pst[1005],cnt;

void dfs(int u){
	if(u>1000)return;
	pre[u]=cnt++;
	dfs(2*u);dfs(2*u+1);
	pst[u]=cnt-1;
}

int find_next_station(int s,int t,vector<int> c){
	++s;++t;
	if(cnt==0)dfs(1);
	if(2*s>1000)return c[0];
	if(pre[2*s]<=pre[t]&&pst[t]<=pst[2*s])return 2*s-1;
	if(pre[2*s+1]<=pre[t]&&pst[t]<=pst[2*s+1])return 2*s;
	return s/2-1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 653 ms 480 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 490 ms 472 KB Output is correct
2 Correct 689 ms 464 KB Output is correct
3 Correct 1247 ms 468 KB Output is correct
4 Correct 690 ms 472 KB Output is correct
5 Correct 710 ms 400 KB Output is correct
6 Correct 677 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 588 ms 400 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 947 ms 400 KB Output is correct
2 Incorrect 951 ms 524 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 771 ms 556 KB Wrong query response.
2 Halted 0 ms 0 KB -