# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
520215 |
2022-01-28T21:17:26 Z |
new_acc |
Saveit (IOI10_saveit) |
C++14 |
|
195 ms |
13180 KB |
#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
#define fi first
#define se second
#define rep(a, b) for(int a = 0; a < (b); a++)
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<ll> vl;
const int N=1e3+10;
vi graf[N];
int odl[N],oj[N];
int s[N];
bool vis[N];
void dfs(int v,int o){
vis[v]=1;
oj[v]=o;
for(auto u:graf[v]){
if(vis[u]) continue;
dfs(u,v);
}
}
void bfs(int x,int n){
rep(i,n) odl[i]=-1;
deque<int> deq;
odl[x]=0;
deq.push_back(x);
while(!deq.empty()){
int v=deq.front();
deq.pop_front();
for(auto u:graf[v]) if(odl[v]==-1) deq.push_back(u),odl[u]=odl[v]+1;
}
}
void encode(int n,int h,int p,int a[],int b[]){
rep(i,p) graf[a[i]].push_back(b[i]),graf[b[i]].push_back(a[i]);
dfs(0,0);
rep(i,n){
rep(j,10){
if(oj[i]&(1<<j)) encode_bit(1);
else encode_bit(0);
}
}
rep(i,h){
bfs(i,n);
rep(j,n){
if(odl[j]==odl[oj[j]]+1) encode_bit(0),encode_bit(0);
if(odl[j]==odl[oj[j]]) encode_bit(0),encode_bit(1);
if(odl[j]+1==odl[oj[j]]) encode_bit(1),encode_bit(1);
}
}
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
#define fi first
#define se second
#define rep(a, b) for(int a = 0; a < (b); a++)
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<ll> vl;
const int N=1e3+10;
vi graf[N];
int odl[N],oj[N];
int s[N];
bool vis[N];
void decode(int n,int h){
rep(i,n) graf[i].clear();
rep(i,n){
int x=0;
rep(j,10){
int xd=decode_bit();
if(xd==1) x+=(1<<j);
}
graf[i].push_back(x),graf[x].push_back(i);
oj[i]=x;
}
rep(i,h){
deque<int> deq;
deq.push_back(i);
rep(j,n) vis[j]=0;
odl[i]=0,vis[i]=1;
rep(j,n){
bool xd=decode_bit(),xd2=decode_bit();
if(!xd and !xd2) s[j]=3;
if(!xd and xd2) s[j]=1;
if(xd and xd2) s[j]=0;
}
while(!deq.empty()){
int v=deq.front();
deq.pop_front();
if(vis[oj[v]]){
if(s[v]==3) odl[v]=odl[oj[v]]-1;
if(s[v]==1) odl[v]=odl[oj[v]];
if(s[v]==0) odl[v]=odl[oj[v]]+1;
}else{
if(s[v]==3) odl[oj[v]]=odl[v]+1;
if(s[v]==1) odl[oj[v]]=odl[v];
if(s[v]==0) odl[oj[v]]=odl[v]-1;
}
for(auto u:graf[v]) if(!vis[u]) deq.push_back(u),vis[u]=1;
}
rep(j,n) hops(i,j,odl[j]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
195 ms |
13180 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4580 KB |
Output isn't correct |
3 |
Incorrect |
22 ms |
5432 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
4580 KB |
Output isn't correct |
5 |
Incorrect |
31 ms |
5648 KB |
Output isn't correct |
6 |
Incorrect |
33 ms |
5668 KB |
Output isn't correct |
7 |
Incorrect |
41 ms |
6332 KB |
Output isn't correct |
8 |
Incorrect |
27 ms |
5444 KB |
Output isn't correct |
9 |
Incorrect |
30 ms |
5488 KB |
Output isn't correct |
10 |
Incorrect |
28 ms |
5488 KB |
Output isn't correct |
11 |
Incorrect |
34 ms |
5692 KB |
Output isn't correct |
12 |
Incorrect |
23 ms |
5520 KB |
Output isn't correct |
13 |
Incorrect |
53 ms |
6560 KB |
Output isn't correct |
14 |
Incorrect |
27 ms |
5524 KB |
Output isn't correct |
15 |
Incorrect |
39 ms |
5636 KB |
Output isn't correct |
16 |
Incorrect |
65 ms |
6272 KB |
Output isn't correct |
17 |
Incorrect |
54 ms |
6308 KB |
Output isn't correct |
18 |
Incorrect |
47 ms |
6776 KB |
Output isn't correct |
19 |
Incorrect |
46 ms |
6032 KB |
Output isn't correct |
20 |
Incorrect |
66 ms |
7224 KB |
Output isn't correct |
21 |
Incorrect |
69 ms |
7364 KB |
Output isn't correct |
22 |
Incorrect |
57 ms |
6540 KB |
Output isn't correct |
23 |
Incorrect |
98 ms |
7748 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
195 ms |
13180 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4580 KB |
Output isn't correct |
3 |
Incorrect |
22 ms |
5432 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
4580 KB |
Output isn't correct |
5 |
Incorrect |
31 ms |
5648 KB |
Output isn't correct |
6 |
Incorrect |
33 ms |
5668 KB |
Output isn't correct |
7 |
Incorrect |
41 ms |
6332 KB |
Output isn't correct |
8 |
Incorrect |
27 ms |
5444 KB |
Output isn't correct |
9 |
Incorrect |
30 ms |
5488 KB |
Output isn't correct |
10 |
Incorrect |
28 ms |
5488 KB |
Output isn't correct |
11 |
Incorrect |
34 ms |
5692 KB |
Output isn't correct |
12 |
Incorrect |
23 ms |
5520 KB |
Output isn't correct |
13 |
Incorrect |
53 ms |
6560 KB |
Output isn't correct |
14 |
Incorrect |
27 ms |
5524 KB |
Output isn't correct |
15 |
Incorrect |
39 ms |
5636 KB |
Output isn't correct |
16 |
Incorrect |
65 ms |
6272 KB |
Output isn't correct |
17 |
Incorrect |
54 ms |
6308 KB |
Output isn't correct |
18 |
Incorrect |
47 ms |
6776 KB |
Output isn't correct |
19 |
Incorrect |
46 ms |
6032 KB |
Output isn't correct |
20 |
Incorrect |
66 ms |
7224 KB |
Output isn't correct |
21 |
Incorrect |
69 ms |
7364 KB |
Output isn't correct |
22 |
Incorrect |
57 ms |
6540 KB |
Output isn't correct |
23 |
Incorrect |
98 ms |
7748 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
195 ms |
13180 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4580 KB |
Output isn't correct |
3 |
Incorrect |
22 ms |
5432 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
4580 KB |
Output isn't correct |
5 |
Incorrect |
31 ms |
5648 KB |
Output isn't correct |
6 |
Incorrect |
33 ms |
5668 KB |
Output isn't correct |
7 |
Incorrect |
41 ms |
6332 KB |
Output isn't correct |
8 |
Incorrect |
27 ms |
5444 KB |
Output isn't correct |
9 |
Incorrect |
30 ms |
5488 KB |
Output isn't correct |
10 |
Incorrect |
28 ms |
5488 KB |
Output isn't correct |
11 |
Incorrect |
34 ms |
5692 KB |
Output isn't correct |
12 |
Incorrect |
23 ms |
5520 KB |
Output isn't correct |
13 |
Incorrect |
53 ms |
6560 KB |
Output isn't correct |
14 |
Incorrect |
27 ms |
5524 KB |
Output isn't correct |
15 |
Incorrect |
39 ms |
5636 KB |
Output isn't correct |
16 |
Incorrect |
65 ms |
6272 KB |
Output isn't correct |
17 |
Incorrect |
54 ms |
6308 KB |
Output isn't correct |
18 |
Incorrect |
47 ms |
6776 KB |
Output isn't correct |
19 |
Incorrect |
46 ms |
6032 KB |
Output isn't correct |
20 |
Incorrect |
66 ms |
7224 KB |
Output isn't correct |
21 |
Incorrect |
69 ms |
7364 KB |
Output isn't correct |
22 |
Incorrect |
57 ms |
6540 KB |
Output isn't correct |
23 |
Incorrect |
98 ms |
7748 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
195 ms |
13180 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4580 KB |
Output isn't correct |
3 |
Incorrect |
22 ms |
5432 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
4580 KB |
Output isn't correct |
5 |
Incorrect |
31 ms |
5648 KB |
Output isn't correct |
6 |
Incorrect |
33 ms |
5668 KB |
Output isn't correct |
7 |
Incorrect |
41 ms |
6332 KB |
Output isn't correct |
8 |
Incorrect |
27 ms |
5444 KB |
Output isn't correct |
9 |
Incorrect |
30 ms |
5488 KB |
Output isn't correct |
10 |
Incorrect |
28 ms |
5488 KB |
Output isn't correct |
11 |
Incorrect |
34 ms |
5692 KB |
Output isn't correct |
12 |
Incorrect |
23 ms |
5520 KB |
Output isn't correct |
13 |
Incorrect |
53 ms |
6560 KB |
Output isn't correct |
14 |
Incorrect |
27 ms |
5524 KB |
Output isn't correct |
15 |
Incorrect |
39 ms |
5636 KB |
Output isn't correct |
16 |
Incorrect |
65 ms |
6272 KB |
Output isn't correct |
17 |
Incorrect |
54 ms |
6308 KB |
Output isn't correct |
18 |
Incorrect |
47 ms |
6776 KB |
Output isn't correct |
19 |
Incorrect |
46 ms |
6032 KB |
Output isn't correct |
20 |
Incorrect |
66 ms |
7224 KB |
Output isn't correct |
21 |
Incorrect |
69 ms |
7364 KB |
Output isn't correct |
22 |
Incorrect |
57 ms |
6540 KB |
Output isn't correct |
23 |
Incorrect |
98 ms |
7748 KB |
Output isn't correct |