//#define local
#ifndef local
#include "Annalib.h"
#endif
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
mt19937 rng(1);
int rnd(int l, int r){
int temp = rng() % (r - l + 1);
return abs(temp) + l;
}
bool out[N];
int arr1[] = {1, 2, 2, 4, 2, 4, 4, 4};
int arr2[] = {0, 0, 0, 0, 1, 1, 2, 3};
void Anna(int N, long long X, int K, int P[]){
for(int i = 0; i < K; i++) out[P[i]] = 1;
//cout << X << "\n";
for(int i = 0; i < N; i += 3){
// if(!X) break;
int msk = (!out[i]) + (!out[i + 1]) * 2 + (!out[i + 2]) * 4;
int ind = -1;
for(int j = 7; j >= 0; j--){
if((X % arr1[j] == arr2[j]) && ((msk | j) == msk)){
ind = j;
break;
}
}
X /= arr1[ind];
Set(i, ((ind & 1) != 0));
Set(i + 1, ((ind & 2) != 0));
Set(i + 2, ((ind & 4) != 0));
// cout << X << " " << ind << "\n";
}
}
#ifdef local
void process(){
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--) process();
}
#endif
//#define local
#ifndef local
#include "Brunolib.h"
#endif
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
//mt19937 rng(1);
int arr11[] = {1, 2, 2, 4, 2, 4, 4, 4};
int arr22[] = {0, 0, 0, 0, 1, 1, 2, 3};
long long Bruno(int N, int A[]){
long long ans = 0;
for(int i = N - 3; i >= 0; i -= 3){
int temp = A[i] + 2 * A[i + 1] + 4 * A[i + 2];
// cout << temp << "\n";
ans = (ans * arr11[temp]) + arr22[temp];
}
//cout << ans << "\n";
return ans;
}
#ifdef local
void process(){
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--) process();
}
#endif
Compilation message
Anna.cpp:22:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
22 | const int oo = 1e18 + 7, mod = 1e9 + 7;
| ~~~~~^~~
Bruno.cpp:22:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
22 | const int oo = 1e18 + 7, mod = 1e9 + 7;
| ~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
28 ms |
2376 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
30 ms |
2320 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
30 ms |
2280 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
28 ms |
2260 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
30 ms |
2316 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
30 ms |
2360 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
30 ms |
2264 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
30 ms |
2360 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
33 ms |
2368 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
35 ms |
2288 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
28 ms |
2240 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
30 ms |
2376 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
30 ms |
2284 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
28 ms |
2332 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
36 ms |
2200 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
34 ms |
2348 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
30 ms |
2328 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
30 ms |
2252 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
28 ms |
2324 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
30 ms |
2388 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
28 ms |
2288 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
30 ms |
2324 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
30 ms |
2168 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
28 ms |
2420 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
28 ms |
2304 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
31 ms |
2524 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
28 ms |
2324 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
31 ms |
2284 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
31 ms |
2376 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
34 ms |
2436 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
33 ms |
2196 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
28 ms |
2324 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
28 ms |
2220 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
30 ms |
2376 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
31 ms |
2328 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
32 ms |
2264 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
30 ms |
2256 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
31 ms |
2652 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
33 ms |
2828 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
31 ms |
2680 KB |
Output isn't correct - L* = 0 |