Submission #401595

# Submission time Handle Problem Language Result Execution time Memory
401595 2021-05-10T14:38:10 Z victoriad Library (JOI18_library) C++14
19 / 100
391 ms 320 KB
#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;
 
void Solve(int N)
{ vector<vector<int> >p(N);
  int f;
  for(int i=1;i<=N;i++){
    if(p[i-1].size()<2){
    for(int k=i+1;k<=N;k++){
      vector<int> M(N,0);
      M[k-1]=1;
        M[i-1]=1;
		if(p[k-1].size()==2)continue;
      if(Query(M)==1){
        p[i-1].push_back(k-1);
        p[k-1].push_back(i-1);
      }
      if(p[i-1].size()==2)break;
    }
    if(p[i-1].size()==1)f=i-1;
    }
  }
  vector<bool>c(N,false);
  vector<int> res(N);
  res[0]=f+1;
  c[f]=true;
  for(int i=1;i<N;i++){
    for(int k=0;k<p[f].size();k++){
      if(!c[p[f][k]]){
        c[p[f][k]]=true;
        res[i]=p[f][k]+1;
        f=res[i]-1;
        break;
      }
    }
  }
	
 
	Answer(res);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for(int k=0;k<p[f].size();k++){
      |                 ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 111 ms 300 KB # of queries: 8277
2 Correct 137 ms 284 KB # of queries: 8239
3 Correct 131 ms 280 KB # of queries: 9230
4 Correct 140 ms 296 KB # of queries: 9178
5 Correct 142 ms 284 KB # of queries: 9216
6 Correct 134 ms 320 KB # of queries: 8800
7 Correct 144 ms 284 KB # of queries: 9069
8 Correct 147 ms 284 KB # of queries: 8272
9 Correct 139 ms 284 KB # of queries: 9253
10 Correct 47 ms 320 KB # of queries: 3883
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: 5
15 Correct 2 ms 200 KB # of queries: 57
16 Correct 4 ms 200 KB # of queries: 210
# Verdict Execution time Memory Grader output
1 Correct 111 ms 300 KB # of queries: 8277
2 Correct 137 ms 284 KB # of queries: 8239
3 Correct 131 ms 280 KB # of queries: 9230
4 Correct 140 ms 296 KB # of queries: 9178
5 Correct 142 ms 284 KB # of queries: 9216
6 Correct 134 ms 320 KB # of queries: 8800
7 Correct 144 ms 284 KB # of queries: 9069
8 Correct 147 ms 284 KB # of queries: 8272
9 Correct 139 ms 284 KB # of queries: 9253
10 Correct 47 ms 320 KB # of queries: 3883
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: 5
15 Correct 2 ms 200 KB # of queries: 57
16 Correct 4 ms 200 KB # of queries: 210
17 Runtime error 391 ms 300 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -