Submission #853347

# Submission time Handle Problem Language Result Execution time Memory
853347 2023-09-24T07:59:10 Z vjudge1 Art Collections (BOI22_art) C++17
20 / 100
108 ms 5744 KB
/*
SAMPLE GRADER for task ART

USAGE:
place together with your solution and art.h in the same directory, then open the terminal in this directory
(right-click onto an empty spot in the directory, left click on "Open in terminal") and enter:
    g++ <flags> sample_grader.cpp <solution_file>
e.g.:
    g++ -std=c++17 sample_grader.cpp art.cpp
This will create a file a.out in the current directory which you can execute from the terminal as ./a.out

INPUT/OUTPUT:
The sample grader first expects on standard input two lines. The first line should
contain the integer N. The second line should contain a list of N space-separated
integers, the correct ranking of the collections in the same format as for publish
and answer. Then, the grader calls solve(N) and writes to standard output a protocol
of all grader functions called by your program. Upon termination, it writes your
verdict to standard output.
*/



#include<bits/stdc++.h>

#include "art.h"

using namespace std;

void solve(int N){
  vector<int> v(N); for(int i = 0; i<N; i++) v[i] = i+1;
  map<vector<int>, int> oc;
  for(int k = 0; k<N; k++){
    for(int i = 0; i<N-1; i++){
      int query = -1, query1 = -1; 
      if(oc.find(v) != oc.end()) query = oc[v];
      else query = publish(v), oc[v] = query;
      swap(v[i],v[i+1]);
      if(oc.find(v) != oc.end()) query1 = oc[v];
      else query1 = publish(v), oc[v] = query1;
      if(!query1) answer(v);
      if(!query){
        swap(v[i],v[i+1]);
        answer(v);
      }
      if(query < query1) swap(v[i],v[i+1]);
    }
  }
}

Compilation message

interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 596 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 12 ms 944 KB Output is correct
10 Correct 13 ms 1196 KB Output is correct
11 Correct 10 ms 1164 KB Output is correct
12 Correct 13 ms 1208 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 16 ms 1704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 596 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 12 ms 944 KB Output is correct
10 Correct 13 ms 1196 KB Output is correct
11 Correct 10 ms 1164 KB Output is correct
12 Correct 13 ms 1208 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 16 ms 1704 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 10 ms 952 KB Output is correct
23 Correct 12 ms 1392 KB Output is correct
24 Correct 10 ms 996 KB Output is correct
25 Correct 13 ms 908 KB Output is correct
26 Correct 0 ms 432 KB Output is correct
27 Incorrect 108 ms 5744 KB Not correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 596 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 12 ms 944 KB Output is correct
10 Correct 13 ms 1196 KB Output is correct
11 Correct 10 ms 1164 KB Output is correct
12 Correct 13 ms 1208 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 16 ms 1704 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 10 ms 952 KB Output is correct
23 Correct 12 ms 1392 KB Output is correct
24 Correct 10 ms 996 KB Output is correct
25 Correct 13 ms 908 KB Output is correct
26 Correct 0 ms 432 KB Output is correct
27 Incorrect 108 ms 5744 KB Not correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 596 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 12 ms 944 KB Output is correct
10 Correct 13 ms 1196 KB Output is correct
11 Correct 10 ms 1164 KB Output is correct
12 Correct 13 ms 1208 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 16 ms 1704 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 10 ms 952 KB Output is correct
23 Correct 12 ms 1392 KB Output is correct
24 Correct 10 ms 996 KB Output is correct
25 Correct 13 ms 908 KB Output is correct
26 Correct 0 ms 432 KB Output is correct
27 Incorrect 108 ms 5744 KB Not correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 596 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 12 ms 944 KB Output is correct
10 Correct 13 ms 1196 KB Output is correct
11 Correct 10 ms 1164 KB Output is correct
12 Correct 13 ms 1208 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 16 ms 1704 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 10 ms 952 KB Output is correct
23 Correct 12 ms 1392 KB Output is correct
24 Correct 10 ms 996 KB Output is correct
25 Correct 13 ms 908 KB Output is correct
26 Correct 0 ms 432 KB Output is correct
27 Incorrect 108 ms 5744 KB Not correct
28 Halted 0 ms 0 KB -