Submission #238863

# Submission time Handle Problem Language Result Execution time Memory
238863 2020-06-13T09:47:21 Z Sorting Secret Permutation (RMI19_permutation) C++14
3 / 100
3431 ms 384 KB
#include <bits/stdc++.h>
#include "permutationc.h"

using namespace std;

int query(int v[]);
int query(vector<int> v);
void answer(int v[]);
void answer(vector<int> v);

void solve(int n){
    vector<int> v;
    for(int i = 1; i <= n; ++i)
        v.push_back(i);

    do{
        if(query(v) == n - 1){
            vector<int> p(n);
            for(int i = 0; i < n; ++i)
                p[v[i] - 1] = i + 1;

            answer(p);
            return;
        }
    }
    while(next_permutation(v.begin(), v.end()));
}

Compilation message

stub.cpp: In function 'int query(int*)':
stub.cpp:15:9: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   fscanf(stdin, "%d", &x);
   ~~~~~~^~~~~~~~~~~~~~~~~
stub.cpp: In function 'int main(int, char**)':
stub.cpp:48:9: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   fscanf(stdin, "%d", &N);
   ~~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 21 ms 256 KB Partially correct
2 Partially correct 5 ms 384 KB Partially correct
3 Partially correct 9 ms 384 KB Partially correct
4 Partially correct 12 ms 256 KB Partially correct
5 Partially correct 8 ms 256 KB Partially correct
6 Partially correct 6 ms 384 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 21 ms 256 KB Partially correct
2 Partially correct 5 ms 384 KB Partially correct
3 Partially correct 9 ms 384 KB Partially correct
4 Partially correct 12 ms 256 KB Partially correct
5 Partially correct 8 ms 256 KB Partially correct
6 Partially correct 6 ms 384 KB Partially correct
7 Execution timed out 3431 ms 256 KB Time limit exceeded (wall clock)
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 21 ms 256 KB Partially correct
2 Partially correct 5 ms 384 KB Partially correct
3 Partially correct 9 ms 384 KB Partially correct
4 Partially correct 12 ms 256 KB Partially correct
5 Partially correct 8 ms 256 KB Partially correct
6 Partially correct 6 ms 384 KB Partially correct
7 Execution timed out 3431 ms 256 KB Time limit exceeded (wall clock)
8 Halted 0 ms 0 KB -