# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
100637 |
2019-03-13T04:18:19 Z |
Pro_ktmr |
None (JOI16_snowy) |
C++14 |
|
0 ms |
0 KB |
#include"bits/stdc++.h"
using namespace std;
#include"Anyalib.h"
#define MP(a,b) make_pair(a,b)
static int n;
static int par[500];
static int toPar[500];
static int type = 0;
void InitAnya(int N, int A[], int B[]){
if(N > 100) type = 1;
n = N;
vector<pair<int,int> > tonari[500];
for(int i=0; i<N-1; i++){
tonari[A[i]].push_back(MP(B[i],i));
tonari[B[i]].push_back(MP(A[i],i));
}
par[0] = 0;
queue<int> que;
que.push(0);
while(!que.empty()){
int now = que.front();
que.pop();
for(int i=0; i<tonari[now].size(); i++){
if(tonari[now][i].first == par[now]) continue;
par[tonari[now][i].first] = now;
toPar[tonari[now][i].first] = tonari[now][i].second;
que.push(tonari[now][i].first);
}
}
}
//void Save(int place, int bit)
static int memo[100];
static int C2[99];
static int wa(int i){
if(memo[i] != -1) return memo[i];
return memo[i] = wa(par[i]) + C2[toPar[i]];
}
void Anya(int C[]){
for(int i=0; i<n-1; i++) C2[i] = C[i];
if(type == 0){
for(int i=0; i<n; i++) memo[i] = -1;
memo[0] = 0;
for(int i=0; i<n; i++){
int tmp = wa(i);
for(int j=0; j<10; j++){
Save(i*10+j, (tmp>>9-j)%2);
}
}
}
if(type == 1){
}
}
#include"bits/stdc++.h"
using namespace std;
#include"Borislib.h"
#define MP(a,b) make_pair(a,b)
static int n;
static int par[500];
static int toPar[500];
static int type = 0;
void InitAnya(int N, int A[], int B[]){
if(N > 100) type = 1;
n = N;
vector<pair<int,int> > tonari[500];
for(int i=0; i<N-1; i++){
tonari[A[i]].push_back(MP(B[i],i));
tonari[B[i]].push_back(MP(A[i],i));
}
par[0] = 0;
queue<int> que;
que.push(0);
while(!que.empty()){
int now = que.front();
que.pop();
for(int i=0; i<tonari[now].size(); i++){
if(tonari[now][i].first == par[now]) continue;
par[tonari[now][i].first] = now;
toPar[tonari[now][i].first] = tonari[now][i].second;
que.push(tonari[now][i].first);
}
}
}
//Ask(int place)
int Boris(int city){
int ans = 0;
if(type == 0){
for(int i=0; i<10; i++){
ans += Ask(city*10+i)<<9-i;
}
}
if(type == 1){
}
return ans;
}
Compilation message
Anya.cpp: In function 'void InitAnya(int, int*, int*)':
Anya.cpp:24:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<tonari[now].size(); i++){
~^~~~~~~~~~~~~~~~~~~
Anya.cpp: In function 'void Anya(int*)':
Anya.cpp:48:25: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
Save(i*10+j, (tmp>>9-j)%2);
~^~
Boris.cpp: In function 'void InitAnya(int, int*, int*)':
Boris.cpp:24:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<tonari[now].size(); i++){
~^~~~~~~~~~~~~~~~~~~
Boris.cpp: In function 'int Boris(int)':
Boris.cpp:38:28: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
ans += Ask(city*10+i)<<9-i;
~^~
/tmp/cc4CFGWk.o: In function `main':
grader_boris.cpp:(.text.startup+0x1b1): undefined reference to `InitBoris(int, int*, int*)'
collect2: error: ld returned 1 exit status