#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 getL;
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++) {
for(int j=csum[i-1]; j<csum[i]; j++) {
if((sum[i] - sum[p[i]]) & (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:57:38: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
if((sum[i] - sum[p[i]]) & (1 << j - csum[i-1])) Save(j, 1);
~~^~~~~~~~~~~
Anya.cpp: At global scope:
Anya.cpp:22:12: warning: 'getL' defined but not used [-Wunused-variable]
static int getL;
^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
916 KB |
Output is correct |
2 |
Incorrect |
1 ms |
916 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
1332 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
1964 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
1792 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |