Submission #869633

# Submission time Handle Problem Language Result Execution time Memory
869633 2023-11-05T06:22:01 Z irmuun Ancient Machine 2 (JOI23_ancient2) C++17
10 / 100
94 ms 1404 KB
#include<bits/stdc++.h>
#include "ancient2.h"

using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

string Solve(int n){
    vector<int>a={1,1,2},b={2,1,2};
    vector<int>A,B;
    for(int i=0;i<950;i++){
        if(i<511/2){
            A.pb(i*2+1);
            B.pb(i*2+2);
        }
        else{
            A.pb(i);
            B.pb(i);
        }
    }
    int cur=0;
    string ans="";
    for(int i=0;i<50;i++){
        int q=Query(950,A,B);
        q++;
        q%=256;
        for(int j=7;j>=0;j--){
            if(q&(1<<j)){
                ans+='1';
            }
            else{
                ans+='0';
            }
        }
        for(int j=511+i*8;j<511+i*8+8;j++){
            swap(A[cur],A[j]);
            swap(B[cur],B[j]);
            cur=j;
        }
    }
    int m=3;
    for(int i=0;i<n;i++){
        if(i>=400){
            int q=Query(m,a,b);
            if(q==i+1){
                ans+='0';
            }
            else{
                ans+='1';
            }
        }
        a.insert(a.begin(),0);
        b.insert(b.begin(),0);
        for(auto &x:a){
            x++;
        }
        for(auto &x:b){
            x++;
        }
        m++;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 65 ms 1120 KB Output is partially correct
2 Partially correct 66 ms 708 KB Output is partially correct
3 Partially correct 65 ms 1236 KB Output is partially correct
4 Partially correct 64 ms 896 KB Output is partially correct
5 Partially correct 64 ms 784 KB Output is partially correct
6 Partially correct 65 ms 704 KB Output is partially correct
7 Partially correct 65 ms 724 KB Output is partially correct
8 Partially correct 65 ms 756 KB Output is partially correct
9 Partially correct 66 ms 1260 KB Output is partially correct
10 Partially correct 66 ms 740 KB Output is partially correct
11 Partially correct 65 ms 1280 KB Output is partially correct
12 Partially correct 65 ms 920 KB Output is partially correct
13 Partially correct 65 ms 1244 KB Output is partially correct
14 Partially correct 67 ms 780 KB Output is partially correct
15 Partially correct 65 ms 1024 KB Output is partially correct
16 Partially correct 67 ms 1060 KB Output is partially correct
17 Partially correct 65 ms 1024 KB Output is partially correct
18 Partially correct 65 ms 1100 KB Output is partially correct
19 Partially correct 65 ms 1112 KB Output is partially correct
20 Partially correct 66 ms 848 KB Output is partially correct
21 Partially correct 66 ms 804 KB Output is partially correct
22 Partially correct 66 ms 992 KB Output is partially correct
23 Partially correct 67 ms 1056 KB Output is partially correct
24 Partially correct 65 ms 984 KB Output is partially correct
25 Partially correct 65 ms 944 KB Output is partially correct
26 Partially correct 94 ms 1404 KB Output is partially correct
27 Partially correct 65 ms 692 KB Output is partially correct
28 Partially correct 66 ms 996 KB Output is partially correct
29 Partially correct 65 ms 924 KB Output is partially correct
30 Partially correct 66 ms 1128 KB Output is partially correct
31 Partially correct 66 ms 1124 KB Output is partially correct
32 Partially correct 65 ms 1024 KB Output is partially correct
33 Partially correct 67 ms 1328 KB Output is partially correct
34 Partially correct 65 ms 952 KB Output is partially correct
35 Partially correct 64 ms 656 KB Output is partially correct
36 Partially correct 68 ms 1200 KB Output is partially correct
37 Partially correct 66 ms 1212 KB Output is partially correct
38 Partially correct 70 ms 1140 KB Output is partially correct
39 Partially correct 69 ms 1352 KB Output is partially correct
40 Partially correct 73 ms 912 KB Output is partially correct
41 Partially correct 65 ms 976 KB Output is partially correct
42 Partially correct 67 ms 876 KB Output is partially correct
43 Partially correct 67 ms 1036 KB Output is partially correct
44 Partially correct 65 ms 1396 KB Output is partially correct
45 Partially correct 64 ms 936 KB Output is partially correct
46 Partially correct 65 ms 920 KB Output is partially correct
47 Partially correct 65 ms 752 KB Output is partially correct
48 Partially correct 68 ms 980 KB Output is partially correct
49 Partially correct 65 ms 716 KB Output is partially correct
50 Partially correct 68 ms 880 KB Output is partially correct
51 Partially correct 65 ms 1012 KB Output is partially correct
52 Partially correct 67 ms 1280 KB Output is partially correct
53 Partially correct 65 ms 1052 KB Output is partially correct
54 Partially correct 64 ms 1268 KB Output is partially correct
55 Partially correct 68 ms 920 KB Output is partially correct
56 Partially correct 66 ms 1092 KB Output is partially correct
57 Partially correct 72 ms 1260 KB Output is partially correct
58 Partially correct 66 ms 824 KB Output is partially correct
59 Partially correct 65 ms 956 KB Output is partially correct
60 Partially correct 65 ms 856 KB Output is partially correct
61 Partially correct 64 ms 892 KB Output is partially correct
62 Partially correct 64 ms 788 KB Output is partially correct
63 Partially correct 65 ms 1224 KB Output is partially correct