# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
383996 |
2021-03-31T07:10:30 Z |
MODDI |
Saveit (IOI10_saveit) |
C++14 |
|
462 ms |
20668 KB |
#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
using namespace std;
void encode(int nv, int nh, int ne, int* v1, int* v2){
//encode_bit(1);
//encode_bit(0);
int G[nv][nv];
memset(G, 0, sizeof(G));
for(int i = 0; i < ne; i++)
G[v1[i]][v2[i]] = 1;
bool vis[nv][nv];
memset(vis, false, sizeof(vis));
for(int i = 0; i < nv ;i++){
for(int j = 0; j < nv; j++)
{
if(!vis[i][j] && !vis[j][i]){
encode_bit(G[i][j]);
//cout<<G[i][j]<<" ";
vis[i][j] = true;
vis[j][i] = true;
}
else
continue;
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define mp make_pair
#define pb push_back
using namespace std;
void decode(int nv, int nh) {
//int a = decode_bit();
//int b = decode_bit();
//hops(0,0,0);
//hops(1,2,3);
int G[nv][nv];
bool vis[nv][nv];
memset(vis, false, sizeof(vis));
for(int i = 0; i < nv; i++){
for(int j = 0; j < nv; j++){
//cout<<"HERE"<<endl;
if(vis[i][j] && vis[j][i]) continue;
else{
G[i][j] = decode_bit();
vis[i][j] = true;
vis[j][i] = true;
G[j][i] = G[i][j];
//cout<<G[i][j]<<" ";
}
}
}
for(int i = 0; i < nh; i++){
queue<pii> q;
q.push(mp(i, 0));
int dist[nv];
for(int j = 0; j < nv; j++)
dist[j] = 1e9;
dist[i] = 0;
bool visited[nv];
memset(visited, false, sizeof(visited));
while(!q.empty()){
pii at = q.front(); q.pop();
//cout<<at.first<<" "<<at.second<<endl;
for(int j = 0; j < nv; j++){
if(!visited[j] && G[at.first][j] == 1){
visited[j] = true;
dist[j] = min(dist[j], 1 + dist[at.first]);
q.push(mp(j, at.second + 1));
}
}
}
for(int j = 0; j < nv; j++){
hops(i, j, dist[j]);
//cout<<dist[j]<<" ";
}
//cout<<endl;
}
}
Compilation message
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:17:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
17 | for(int i = 0; i < ne; i++)
| ^~~
encoder.cpp:20:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
20 | bool vis[nv][nv];
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
462 ms |
20668 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4780 KB |
Output is correct - 15 call(s) of encode_bit() |
3 |
Correct |
138 ms |
15968 KB |
Output is partially correct - 405450 call(s) of encode_bit() |
4 |
Correct |
4 ms |
4704 KB |
Output is correct - 15 call(s) of encode_bit() |
5 |
Correct |
130 ms |
15968 KB |
Output is partially correct - 405450 call(s) of encode_bit() |
6 |
Correct |
163 ms |
18680 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
7 |
Correct |
164 ms |
18804 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
8 |
Incorrect |
121 ms |
17512 KB |
wrong parameter |
9 |
Incorrect |
118 ms |
18644 KB |
wrong parameter |
10 |
Incorrect |
122 ms |
18656 KB |
wrong parameter |
11 |
Incorrect |
130 ms |
18756 KB |
wrong parameter |
12 |
Incorrect |
123 ms |
18656 KB |
wrong parameter |
13 |
Incorrect |
140 ms |
19028 KB |
wrong parameter |
14 |
Incorrect |
121 ms |
18528 KB |
wrong parameter |
15 |
Incorrect |
129 ms |
18540 KB |
wrong parameter |
16 |
Incorrect |
156 ms |
18896 KB |
wrong parameter |
17 |
Incorrect |
149 ms |
18836 KB |
wrong parameter |
18 |
Incorrect |
159 ms |
18784 KB |
wrong parameter |
19 |
Incorrect |
138 ms |
18792 KB |
wrong parameter |
20 |
Incorrect |
177 ms |
18912 KB |
wrong parameter |
21 |
Incorrect |
187 ms |
19072 KB |
wrong parameter |
22 |
Incorrect |
157 ms |
18784 KB |
wrong parameter |
23 |
Incorrect |
174 ms |
19108 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
462 ms |
20668 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4780 KB |
Output is correct - 15 call(s) of encode_bit() |
3 |
Correct |
138 ms |
15968 KB |
Output is partially correct - 405450 call(s) of encode_bit() |
4 |
Correct |
4 ms |
4704 KB |
Output is correct - 15 call(s) of encode_bit() |
5 |
Correct |
130 ms |
15968 KB |
Output is partially correct - 405450 call(s) of encode_bit() |
6 |
Correct |
163 ms |
18680 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
7 |
Correct |
164 ms |
18804 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
8 |
Incorrect |
121 ms |
17512 KB |
wrong parameter |
9 |
Incorrect |
118 ms |
18644 KB |
wrong parameter |
10 |
Incorrect |
122 ms |
18656 KB |
wrong parameter |
11 |
Incorrect |
130 ms |
18756 KB |
wrong parameter |
12 |
Incorrect |
123 ms |
18656 KB |
wrong parameter |
13 |
Incorrect |
140 ms |
19028 KB |
wrong parameter |
14 |
Incorrect |
121 ms |
18528 KB |
wrong parameter |
15 |
Incorrect |
129 ms |
18540 KB |
wrong parameter |
16 |
Incorrect |
156 ms |
18896 KB |
wrong parameter |
17 |
Incorrect |
149 ms |
18836 KB |
wrong parameter |
18 |
Incorrect |
159 ms |
18784 KB |
wrong parameter |
19 |
Incorrect |
138 ms |
18792 KB |
wrong parameter |
20 |
Incorrect |
177 ms |
18912 KB |
wrong parameter |
21 |
Incorrect |
187 ms |
19072 KB |
wrong parameter |
22 |
Incorrect |
157 ms |
18784 KB |
wrong parameter |
23 |
Incorrect |
174 ms |
19108 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
462 ms |
20668 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4780 KB |
Output is correct - 15 call(s) of encode_bit() |
3 |
Correct |
138 ms |
15968 KB |
Output is partially correct - 405450 call(s) of encode_bit() |
4 |
Correct |
4 ms |
4704 KB |
Output is correct - 15 call(s) of encode_bit() |
5 |
Correct |
130 ms |
15968 KB |
Output is partially correct - 405450 call(s) of encode_bit() |
6 |
Correct |
163 ms |
18680 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
7 |
Correct |
164 ms |
18804 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
8 |
Incorrect |
121 ms |
17512 KB |
wrong parameter |
9 |
Incorrect |
118 ms |
18644 KB |
wrong parameter |
10 |
Incorrect |
122 ms |
18656 KB |
wrong parameter |
11 |
Incorrect |
130 ms |
18756 KB |
wrong parameter |
12 |
Incorrect |
123 ms |
18656 KB |
wrong parameter |
13 |
Incorrect |
140 ms |
19028 KB |
wrong parameter |
14 |
Incorrect |
121 ms |
18528 KB |
wrong parameter |
15 |
Incorrect |
129 ms |
18540 KB |
wrong parameter |
16 |
Incorrect |
156 ms |
18896 KB |
wrong parameter |
17 |
Incorrect |
149 ms |
18836 KB |
wrong parameter |
18 |
Incorrect |
159 ms |
18784 KB |
wrong parameter |
19 |
Incorrect |
138 ms |
18792 KB |
wrong parameter |
20 |
Incorrect |
177 ms |
18912 KB |
wrong parameter |
21 |
Incorrect |
187 ms |
19072 KB |
wrong parameter |
22 |
Incorrect |
157 ms |
18784 KB |
wrong parameter |
23 |
Incorrect |
174 ms |
19108 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
462 ms |
20668 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4780 KB |
Output is correct - 15 call(s) of encode_bit() |
3 |
Correct |
138 ms |
15968 KB |
Output is partially correct - 405450 call(s) of encode_bit() |
4 |
Correct |
4 ms |
4704 KB |
Output is correct - 15 call(s) of encode_bit() |
5 |
Correct |
130 ms |
15968 KB |
Output is partially correct - 405450 call(s) of encode_bit() |
6 |
Correct |
163 ms |
18680 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
7 |
Correct |
164 ms |
18804 KB |
Output is partially correct - 500500 call(s) of encode_bit() |
8 |
Incorrect |
121 ms |
17512 KB |
wrong parameter |
9 |
Incorrect |
118 ms |
18644 KB |
wrong parameter |
10 |
Incorrect |
122 ms |
18656 KB |
wrong parameter |
11 |
Incorrect |
130 ms |
18756 KB |
wrong parameter |
12 |
Incorrect |
123 ms |
18656 KB |
wrong parameter |
13 |
Incorrect |
140 ms |
19028 KB |
wrong parameter |
14 |
Incorrect |
121 ms |
18528 KB |
wrong parameter |
15 |
Incorrect |
129 ms |
18540 KB |
wrong parameter |
16 |
Incorrect |
156 ms |
18896 KB |
wrong parameter |
17 |
Incorrect |
149 ms |
18836 KB |
wrong parameter |
18 |
Incorrect |
159 ms |
18784 KB |
wrong parameter |
19 |
Incorrect |
138 ms |
18792 KB |
wrong parameter |
20 |
Incorrect |
177 ms |
18912 KB |
wrong parameter |
21 |
Incorrect |
187 ms |
19072 KB |
wrong parameter |
22 |
Incorrect |
157 ms |
18784 KB |
wrong parameter |
23 |
Incorrect |
174 ms |
19108 KB |
wrong parameter |