Submission #436104

# Submission time Handle Problem Language Result Execution time Memory
436104 2021-06-24T08:52:04 Z AmineWeslati Library (JOI18_library) C++14
19 / 100
611 ms 320 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;

typedef long long ll;
typedef vector<int>vi;
#define pb push_back
#define sz(v) (int)v.size()
#define all(x) begin(x),end(x)

#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=b-1; i>=a; i--)

//----------------------

void Solve(int N){
	vi adj[N];
	FOR(i,0,N){
		FOR(j,i+1,N){
			vi a(N,0); a[i]=a[j]=1;
			if(Query(a)==1) adj[i].pb(j),adj[j].pb(i);
		}
	}

	vi ans;
	FOR(i,0,N) if(sz(adj[i])<=1){
		int prev=-1,u=i;
		while(1){
			ans.pb(u+1);
			int nxt=-1;
			for(int v: adj[u]) if(v!=prev) nxt=v; 
			if(nxt==-1) break;
			prev=u; 
			u=nxt; 
		}

		break;
	}
	Answer(ans);
	return; 
}
# Verdict Execution time Memory Grader output
1 Correct 353 ms 280 KB # of queries: 18336
2 Correct 281 ms 280 KB # of queries: 18145
3 Correct 379 ms 276 KB # of queries: 19900
4 Correct 242 ms 288 KB # of queries: 19900
5 Correct 314 ms 280 KB # of queries: 19900
6 Correct 303 ms 200 KB # of queries: 19900
7 Correct 342 ms 320 KB # of queries: 19900
8 Correct 384 ms 272 KB # of queries: 18528
9 Correct 440 ms 272 KB # of queries: 19701
10 Correct 175 ms 276 KB # of queries: 8256
11 Correct 1 ms 200 KB # of queries: 0
12 Correct 1 ms 200 KB # of queries: 1
13 Correct 1 ms 200 KB # of queries: 3
14 Correct 1 ms 200 KB # of queries: 6
15 Correct 3 ms 200 KB # of queries: 105
16 Correct 8 ms 200 KB # of queries: 351
# Verdict Execution time Memory Grader output
1 Correct 353 ms 280 KB # of queries: 18336
2 Correct 281 ms 280 KB # of queries: 18145
3 Correct 379 ms 276 KB # of queries: 19900
4 Correct 242 ms 288 KB # of queries: 19900
5 Correct 314 ms 280 KB # of queries: 19900
6 Correct 303 ms 200 KB # of queries: 19900
7 Correct 342 ms 320 KB # of queries: 19900
8 Correct 384 ms 272 KB # of queries: 18528
9 Correct 440 ms 272 KB # of queries: 19701
10 Correct 175 ms 276 KB # of queries: 8256
11 Correct 1 ms 200 KB # of queries: 0
12 Correct 1 ms 200 KB # of queries: 1
13 Correct 1 ms 200 KB # of queries: 3
14 Correct 1 ms 200 KB # of queries: 6
15 Correct 3 ms 200 KB # of queries: 105
16 Correct 8 ms 200 KB # of queries: 351
17 Runtime error 611 ms 200 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -