#include "Anyalib.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(NULL)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed; cout.precision(a)
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,pii> pipii;
const int inf = 1e9;
const ll INF = 1e18;
static int n;
static int cnt[555];
static int p[555];
static int csum[555];
void InitAnya(int N , int A[] , int B[]) {
n = N;
int l = 1, r = n;
while(l != r) {
for(int i=l; i<r; i++) {
cnt[i]++;
}
l = (l + r + 1) / 2;
}
for(int i=0; i<n; i++) {
csum[i+1] = csum[i] + cnt[i+1];
p[i] = i - (1 << cnt[i]) + 1;
p[i] = max(p[i], 0);
}
}
void Anya(int C[]) {
int sum[555] = {};
for(int i=0; i<n-1; i++) {
sum[i+1] = sum[i] + C[i];
}
for(int i=1; i<n; i++) {
int s = 0;
for(int j=p[i]; j<i; j++) s += C[j];
for(int j=csum[i-1]; j<csum[i]; j++) {
if(s & (1 << j - csum[i-1])) Save(j, 1);
else Save(j, 0);
}
}
}
#include "Borislib.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(NULL)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed; cout.precision(a)
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,pii> pipii;
const int inf = 1e9;
const ll INF = 1e18;
static int n;
static int cnt[555];
static int p[555];
static int csum[555];
void InitBoris(int N , int A[] , int B[]) {
n = N;
int l = 1, r = n;
while(l != r) {
for(int i=l; i<r; i++) {
cnt[i]++;
}
l = (l + r + 1) / 2;
}
for(int i=0; i<n; i++) {
csum[i+1] = csum[i] + cnt[i+1];
p[i] = i - (1 << cnt[i]) + 1;
p[i] = max(p[i], 0);
}
}
int Boris(int city) {
int ans = 0;
for(int i = city; i; i = p[i]) {
int sum = 0;
for(int j = csum[i-1]; j < csum[i]; j++) {
sum ^= Ask(j) << (j - csum[i-1]);
}
ans += sum;
}
return ans;
}
Compilation message
Anya.cpp: In function 'void Anya(int*)':
Anya.cpp:58:19: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
if(s & (1 << j - csum[i-1])) Save(j, 1);
~~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1020 KB |
Output is correct |
2 |
Incorrect |
2 ms |
792 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
1452 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
1852 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
1852 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |