#include<bits/stdc++.h>
#include "Annalib.h"
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
#define PB push_back
#define PPB pop_back
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
/*
int niz[300], ret[300];
void Set(int x, int y){
if(!del[x]) ret[x] = y;
}
*/
void Anna(int n, ll x, int k, int* p){
srand(19719);
vi pos, del(151, 0);
pos.clear();
for(int i=0; i<n; i++) pos.PB(i);
random_shuffle(all(pos));
for(int i=0; i<k; i++) del[p[i]] = 1;
for(int i=0; i<75; i++){
int cr = x % 3;
int a = pos[i * 2];
int b = pos[i * 2 + 1];
if(cr == 0 and !del[b]){
Set(a, 0);
Set(b, 1);
}else if(cr == 1 and !del[a]){
Set(a, 1);
Set(b, 0);
}else if(cr == 2 and !del[a] and !del[b]){
Set(a, 1);
Set(b, 1);
}else{
Set(a, 0);
Set(b, 0);
continue;
}
x /= 3;
}
}
/*
int main(){
int n, k;
ll x;
cin >> n >> x >> k;
for(int i=0; i<k; i++) cin >> niz[i];
Anna(150, x, k, niz);
for(int i=0; i<150; i++) cout << ret[i];
cout << "\n";
return 0;
}
*/
#include<bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
#define PB push_back
#define PPB pop_back
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
int niz[300];
ll Bruno(int n, int* p){
srand(19719);
vi pos, ret;
for(int i=0; i<n; i++) pos.PB(i);
random_shuffle(all(pos));
for(int i=0; i<75; i++){
int a = pos[i * 2];
int b = pos[i * 2 + 1];
int vl = p[a] * 2 + p[b];
if(vl == 0) continue;
ret.PB(vl - 1);
}
reverse(all(ret));
ll ans = 0;
for(auto &x : ret) ans *= (ll)3, ans += (ll)x;
return ans;
}
/*
int main(){
for(int i=0; i<150; i++){
char x;
cin >> x;
niz[i] = x - '0';
}
cout << Bruno(150, niz) << "\n";
return 0;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
2760 KB |
Output is correct - L* = 40 |
2 |
Correct |
39 ms |
2836 KB |
Output is correct - L* = 40 |
3 |
Correct |
33 ms |
2768 KB |
Output is correct - L* = 40 |
4 |
Correct |
28 ms |
2764 KB |
Output is correct - L* = 40 |
5 |
Correct |
30 ms |
2580 KB |
Output is correct - L* = 40 |
6 |
Correct |
28 ms |
2736 KB |
Output is correct - L* = 40 |
7 |
Correct |
31 ms |
2756 KB |
Output is correct - L* = 40 |
8 |
Correct |
29 ms |
2760 KB |
Output is correct - L* = 40 |
9 |
Correct |
27 ms |
2764 KB |
Output is correct - L* = 40 |
10 |
Correct |
27 ms |
2760 KB |
Output is correct - L* = 40 |
11 |
Correct |
27 ms |
2760 KB |
Output is correct - L* = 40 |
12 |
Correct |
28 ms |
2760 KB |
Output is correct - L* = 40 |
13 |
Correct |
27 ms |
2852 KB |
Output is correct - L* = 40 |
14 |
Correct |
34 ms |
2732 KB |
Output is correct - L* = 40 |
15 |
Correct |
31 ms |
2684 KB |
Output is correct - L* = 40 |
16 |
Correct |
28 ms |
2680 KB |
Output is correct - L* = 40 |
17 |
Correct |
32 ms |
2764 KB |
Output is correct - L* = 40 |
18 |
Correct |
32 ms |
2756 KB |
Output is correct - L* = 40 |
19 |
Correct |
35 ms |
2676 KB |
Output is correct - L* = 40 |
20 |
Correct |
27 ms |
2748 KB |
Output is correct - L* = 40 |
21 |
Correct |
27 ms |
2756 KB |
Output is correct - L* = 40 |
22 |
Correct |
27 ms |
2764 KB |
Output is correct - L* = 40 |
23 |
Correct |
30 ms |
2768 KB |
Output is correct - L* = 40 |
24 |
Correct |
28 ms |
2760 KB |
Output is correct - L* = 40 |
25 |
Correct |
26 ms |
2760 KB |
Output is correct - L* = 40 |
26 |
Correct |
26 ms |
2760 KB |
Output is correct - L* = 40 |
27 |
Correct |
28 ms |
2760 KB |
Output is correct - L* = 40 |
28 |
Correct |
27 ms |
2680 KB |
Output is correct - L* = 40 |
29 |
Correct |
26 ms |
2700 KB |
Output is correct - L* = 40 |
30 |
Correct |
27 ms |
2756 KB |
Output is correct - L* = 40 |
31 |
Correct |
31 ms |
2756 KB |
Output is correct - L* = 40 |
32 |
Correct |
27 ms |
2760 KB |
Output is correct - L* = 40 |
33 |
Correct |
31 ms |
2568 KB |
Output is correct - L* = 40 |
34 |
Correct |
28 ms |
2848 KB |
Output is correct - L* = 40 |
35 |
Correct |
34 ms |
2736 KB |
Output is correct - L* = 40 |
36 |
Correct |
36 ms |
2664 KB |
Output is correct - L* = 40 |
37 |
Correct |
29 ms |
2736 KB |
Output is correct - L* = 40 |
38 |
Correct |
27 ms |
2732 KB |
Output is correct - L* = 40 |
39 |
Correct |
27 ms |
2756 KB |
Output is correct - L* = 40 |
40 |
Correct |
29 ms |
2628 KB |
Output is correct - L* = 40 |