Submission #416945

# Submission time Handle Problem Language Result Execution time Memory
416945 2021-06-03T08:10:16 Z oolimry Ancient Machine (JOI21_ancient_machine) C++17
69 / 100
88 ms 9060 KB
    #include "Anna.h"
    #include <bits/stdc++.h>
    using namespace std;
    #define all(x) (x).begin(), (x).end()
    #define sz(x) ((int) x.size())
    #define show(x) cerr << #x << " is " << x << endl;
    #define show2(x, y) cerr << #x << " is " << x << ", " << #y << " is " << y << endl;
    typedef long long lint;
    typedef pair<lint, lint> ii;
     
    void Anna(int n, vector<char> s){	
    	int X = -1;
    	for(int i = 0;i < n;i++){
    		if(s[i] == 'X'){
    			X = i;
    			break;
    		}
    	}
    	
    	if(X == -1) return;
    	
    	vector<int> tosend;
    	for(int i = X+1;i < n;i++){
    		if(s[i] == 'Z') tosend.push_back(1);
    		else tosend.push_back(0);
    	}
    	
    	for(int x : tosend) Send(x);
    	
    	for(int i = 0;i < 18;i++){
    		Send(X&1);
    		X >>= 1;
    	}
    }
    #include "Bruno.h"
    #include <bits/stdc++.h>
    using namespace std;
    #define all(x) (x).begin(), (x).end()
    #define sz(x) ((int) x.size())
    #define show(x) cerr << #x << " is " << x << endl;
    #define show2(x, y) cerr << #x << " is " << x << ", " << #y << " is " << y << endl;
    typedef long long lint;
    typedef pair<lint, lint> ii;
     
     
    void Bruno(int n, int L, vector<int> A){
    	int vis[n]; fill(vis,vis+n,0);
    	
    	if(sz(A) == 0){
    		for(int i = 0;i < n;i++) Remove(i);
    		return;
    	}
    	
    	int X = 0;
    	for(int i = 0;i < 18;i++){
    		X *= 2;
    		X += A.back();
    		A.pop_back();
    	}
    	
    	int prev = X+1;
    	for(int i = X+1;i < n;i++){
    		int a = A[i-X-1];
    		if(a == 1){
    			for(int j = i-1;j >= prev;j--) Remove(j), vis[j] = 1;
    			Remove(i); vis[i] = 1;
    			prev = i+1;
    		}
    	}
    	
    	for(int i = 0;i < n;i++){
    		if(not vis[i]) Remove(i);
    	}
    }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 484 KB Output is correct
2 Correct 1 ms 488 KB Output is correct
3 Correct 1 ms 496 KB Output is correct
4 Correct 1 ms 496 KB Output is correct
5 Correct 1 ms 488 KB Output is correct
6 Correct 1 ms 488 KB Output is correct
7 Correct 1 ms 576 KB Output is correct
8 Correct 1 ms 488 KB Output is correct
9 Correct 1 ms 488 KB Output is correct
10 Correct 1 ms 496 KB Output is correct
11 Correct 1 ms 540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 63 ms 8544 KB Partially correct
2 Partially correct 64 ms 8924 KB Partially correct
3 Partially correct 64 ms 8972 KB Partially correct
4 Partially correct 65 ms 8844 KB Partially correct
5 Partially correct 65 ms 8840 KB Partially correct
6 Partially correct 66 ms 8960 KB Partially correct
7 Partially correct 65 ms 8832 KB Partially correct
8 Partially correct 65 ms 9060 KB Partially correct
9 Partially correct 66 ms 8860 KB Partially correct
10 Partially correct 65 ms 8856 KB Partially correct
11 Partially correct 77 ms 8896 KB Partially correct
12 Partially correct 67 ms 8832 KB Partially correct
13 Partially correct 74 ms 8836 KB Partially correct
14 Partially correct 88 ms 8892 KB Partially correct
15 Partially correct 68 ms 8760 KB Partially correct
16 Partially correct 69 ms 8968 KB Partially correct
17 Partially correct 73 ms 8972 KB Partially correct
18 Correct 53 ms 7004 KB Output is correct
19 Correct 53 ms 7124 KB Output is correct
20 Partially correct 64 ms 8792 KB Partially correct
21 Partially correct 68 ms 8788 KB Partially correct
22 Partially correct 76 ms 8972 KB Partially correct
23 Partially correct 64 ms 8860 KB Partially correct
24 Partially correct 65 ms 8932 KB Partially correct
25 Correct 54 ms 7248 KB Output is correct
26 Partially correct 75 ms 8960 KB Partially correct
27 Correct 53 ms 7060 KB Output is correct
28 Partially correct 74 ms 8828 KB Partially correct
29 Correct 55 ms 7100 KB Output is correct
30 Correct 53 ms 7060 KB Output is correct
31 Correct 54 ms 7088 KB Output is correct
32 Partially correct 67 ms 8956 KB Partially correct
33 Partially correct 64 ms 8952 KB Partially correct