Submission #260326

# Submission time Handle Problem Language Result Execution time Memory
260326 2020-08-10T05:29:28 Z 최은수(#5043) Library (JOI18_library) C++17
19 / 100
545 ms 632 KB
#include"library.h"
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
int n;
int qu(vector<int>v)
{
    vector<int>m(n,0);
    for(int&t:v)
        m[t-1]=1;
    return Query(m);
}
int qu(int i,int j)
{
    return qu(vector<int>({i,j}));
}
vector<int>adj[205];
int chk[205];
void Solve(int N)
{
    n=N;
    if(n==1)
        return Answer({1});
    vector<int>stk;
    chk[1]=1;
    stk.eb(1);
    while(!stk.empty())
    {
        int x=stk.back();
        stk.pop_back();
        for(int i=0;i++<n;)
            if(chk[i]==0)
                if(qu(x,i)==1)
                    adj[x].eb(i),adj[i].eb(x),chk[i]=1,stk.eb(i);
    }
    int x=0,p=0;
    for(int i=0;i++<n;)
        if((int)adj[i].size()==1)
            x=i;
    vector<int>ans;
    while((int)ans.size()<n)
    {
        ans.eb(x);
        int nx=0;
        for(int&t:adj[x])
            if(t!=p)
                nx=t;
        p=x;
        x=nx;
    }
    Answer(ans);
    return;
}
# Verdict Execution time Memory Grader output
1 Correct 297 ms 256 KB # of queries: 18247
2 Correct 268 ms 376 KB # of queries: 18007
3 Correct 313 ms 372 KB # of queries: 19793
4 Correct 276 ms 500 KB # of queries: 19752
5 Correct 268 ms 504 KB # of queries: 19833
6 Correct 285 ms 500 KB # of queries: 19760
7 Correct 299 ms 376 KB # of queries: 19826
8 Correct 282 ms 256 KB # of queries: 18465
9 Correct 288 ms 376 KB # of queries: 19538
10 Correct 112 ms 372 KB # of queries: 8192
11 Correct 0 ms 256 KB # of queries: 0
12 Correct 0 ms 256 KB # of queries: 1
13 Correct 1 ms 256 KB # of queries: 2
14 Correct 0 ms 256 KB # of queries: 6
15 Correct 2 ms 256 KB # of queries: 105
16 Correct 5 ms 256 KB # of queries: 345
# Verdict Execution time Memory Grader output
1 Correct 297 ms 256 KB # of queries: 18247
2 Correct 268 ms 376 KB # of queries: 18007
3 Correct 313 ms 372 KB # of queries: 19793
4 Correct 276 ms 500 KB # of queries: 19752
5 Correct 268 ms 504 KB # of queries: 19833
6 Correct 285 ms 500 KB # of queries: 19760
7 Correct 299 ms 376 KB # of queries: 19826
8 Correct 282 ms 256 KB # of queries: 18465
9 Correct 288 ms 376 KB # of queries: 19538
10 Correct 112 ms 372 KB # of queries: 8192
11 Correct 0 ms 256 KB # of queries: 0
12 Correct 0 ms 256 KB # of queries: 1
13 Correct 1 ms 256 KB # of queries: 2
14 Correct 0 ms 256 KB # of queries: 6
15 Correct 2 ms 256 KB # of queries: 105
16 Correct 5 ms 256 KB # of queries: 345
17 Runtime error 12 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 22 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 21 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 36 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 12 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 12 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 38 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 7 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 85 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 14 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 197 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 502 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 545 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 522 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)