Submission #232680

# Submission time Handle Problem Language Result Execution time Memory
232680 2020-05-17T19:57:03 Z crossing0ver Saveit (IOI10_saveit) C++17
0 / 100
250 ms 14824 KB
#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
vector<int> adj[1005];
bool vis[1005];
int dis[1005];
void binary (int n) {
	for (int i = 0; i < 10; i++) 
		if ((1 << i) & n) encode_bit(1);
		else encode_bit(0);
}
bool COOL[1001][1001];
void encode(int nv, int nh, int ne, int *v1, int *v2){
  for (int i = 0; i < ne; i++) {
  	adj[v1[i]].push_back(v2[i]);
  	adj[v2[i]].push_back(v1[i]);
  }
  for (int  s = 0; s < nh; s++) {
  	queue<int> q;
  	q.push(s);
  	vis[s] = 1;
  	while (!q.empty()) {
		  int v = q.front();
		  q.pop();
		  for (auto i : adj[v]) {
		  	if (!vis[i]) {
		  		vis[i] = 1;
		  		dis[i] = dis[v] + 1; 
		  		q.push(i);
		  		COOL[i][v] = COOL[v][i] = 1;
			  }
		  }
	  }
	 memset(vis,0,sizeof vis);
	  memset(dis,0,sizeof dis);
}
	  int ans = 0;
	  vector<pair<int,int> > v;
	  for (int i = 0; i < nv; i++)
	  for (int j = i; j < nv; j++)
	  	if (COOL[i][j]) {
	  		ans++;
	  		v.push_back({i,j});
	  	}
	sort(v.begin(),v.end());
	int cur = 0;
	for (auto i : v) {
		while (cur != i.first) {
			binary(1023);
			cur++;
		}
		binary(i.second);
	}
	binary(1022);
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;  
vector<int> adj[1005];
bool vis[1005];
int dis[1005];
void decode(int nv, int nh) {
	int cur = 0;
	while (cur <= nv) {
		int s = 0;
		for (int i = 0; i < 10; i++)
			if (decode_bit())
				s |= (1 << i);
		if (s == 1022) break;
		if (s == 1023) cur++;
		else {
		adj[cur].push_back(s);
		adj[s].push_back(cur);
	}
	}
	
	for (int  s = 0; s < nh; s++) {
		hops(s,s,0);
  	queue<int> q;
  	q.push(s);
  	vis[s] = 1;
  	while (!q.empty()) {
		  int v = q.front();
		  q.pop();
		  for (auto i : adj[v]) {
		  	if (!vis[i]) {
		  		hops(s,i,dis[v] + 1);
		  		vis[i] = 1;
		  		dis[i] = dis[v] + 1; 
		  		q.push(i);
			  }
		  }
	  }
}

}
# Verdict Execution time Memory Grader output
1 Incorrect 250 ms 14824 KB function hops(h,c,d) must be called exactly N×H times
2 Incorrect 11 ms 4800 KB function hops(h,c,d) must be called exactly N×H times
3 Incorrect 28 ms 6292 KB function hops(h,c,d) must be called exactly N×H times
4 Incorrect 12 ms 4736 KB function hops(h,c,d) must be called exactly N×H times
5 Incorrect 46 ms 7260 KB function hops(h,c,d) must be called exactly N×H times
6 Incorrect 41 ms 7348 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 74 ms 8576 KB function hops(h,c,d) must be called exactly N×H times
8 Incorrect 26 ms 6144 KB function hops(h,c,d) must be called exactly N×H times
9 Incorrect 25 ms 6280 KB function hops(h,c,d) must be called exactly N×H times
10 Incorrect 26 ms 6148 KB function hops(h,c,d) must be called exactly N×H times
11 Incorrect 33 ms 6784 KB function hops(h,c,d) must be called exactly N×H times
12 Incorrect 22 ms 6260 KB function hops(h,c,d) must be called exactly N×H times
13 Incorrect 70 ms 8092 KB function hops(h,c,d) must be called exactly N×H times
14 Incorrect 25 ms 6372 KB function hops(h,c,d) must be called exactly N×H times
15 Incorrect 26 ms 6272 KB function hops(h,c,d) must be called exactly N×H times
16 Incorrect 51 ms 7160 KB function hops(h,c,d) must be called exactly N×H times
17 Incorrect 49 ms 7148 KB function hops(h,c,d) must be called exactly N×H times
18 Incorrect 61 ms 7808 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 46 ms 7432 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 79 ms 8432 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 93 ms 8500 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 76 ms 8440 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 101 ms 9292 KB function hops(h,c,d) must be called exactly N×H times
# Verdict Execution time Memory Grader output
1 Incorrect 250 ms 14824 KB function hops(h,c,d) must be called exactly N×H times
2 Incorrect 11 ms 4800 KB function hops(h,c,d) must be called exactly N×H times
3 Incorrect 28 ms 6292 KB function hops(h,c,d) must be called exactly N×H times
4 Incorrect 12 ms 4736 KB function hops(h,c,d) must be called exactly N×H times
5 Incorrect 46 ms 7260 KB function hops(h,c,d) must be called exactly N×H times
6 Incorrect 41 ms 7348 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 74 ms 8576 KB function hops(h,c,d) must be called exactly N×H times
8 Incorrect 26 ms 6144 KB function hops(h,c,d) must be called exactly N×H times
9 Incorrect 25 ms 6280 KB function hops(h,c,d) must be called exactly N×H times
10 Incorrect 26 ms 6148 KB function hops(h,c,d) must be called exactly N×H times
11 Incorrect 33 ms 6784 KB function hops(h,c,d) must be called exactly N×H times
12 Incorrect 22 ms 6260 KB function hops(h,c,d) must be called exactly N×H times
13 Incorrect 70 ms 8092 KB function hops(h,c,d) must be called exactly N×H times
14 Incorrect 25 ms 6372 KB function hops(h,c,d) must be called exactly N×H times
15 Incorrect 26 ms 6272 KB function hops(h,c,d) must be called exactly N×H times
16 Incorrect 51 ms 7160 KB function hops(h,c,d) must be called exactly N×H times
17 Incorrect 49 ms 7148 KB function hops(h,c,d) must be called exactly N×H times
18 Incorrect 61 ms 7808 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 46 ms 7432 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 79 ms 8432 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 93 ms 8500 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 76 ms 8440 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 101 ms 9292 KB function hops(h,c,d) must be called exactly N×H times
# Verdict Execution time Memory Grader output
1 Incorrect 250 ms 14824 KB function hops(h,c,d) must be called exactly N×H times
2 Incorrect 11 ms 4800 KB function hops(h,c,d) must be called exactly N×H times
3 Incorrect 28 ms 6292 KB function hops(h,c,d) must be called exactly N×H times
4 Incorrect 12 ms 4736 KB function hops(h,c,d) must be called exactly N×H times
5 Incorrect 46 ms 7260 KB function hops(h,c,d) must be called exactly N×H times
6 Incorrect 41 ms 7348 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 74 ms 8576 KB function hops(h,c,d) must be called exactly N×H times
8 Incorrect 26 ms 6144 KB function hops(h,c,d) must be called exactly N×H times
9 Incorrect 25 ms 6280 KB function hops(h,c,d) must be called exactly N×H times
10 Incorrect 26 ms 6148 KB function hops(h,c,d) must be called exactly N×H times
11 Incorrect 33 ms 6784 KB function hops(h,c,d) must be called exactly N×H times
12 Incorrect 22 ms 6260 KB function hops(h,c,d) must be called exactly N×H times
13 Incorrect 70 ms 8092 KB function hops(h,c,d) must be called exactly N×H times
14 Incorrect 25 ms 6372 KB function hops(h,c,d) must be called exactly N×H times
15 Incorrect 26 ms 6272 KB function hops(h,c,d) must be called exactly N×H times
16 Incorrect 51 ms 7160 KB function hops(h,c,d) must be called exactly N×H times
17 Incorrect 49 ms 7148 KB function hops(h,c,d) must be called exactly N×H times
18 Incorrect 61 ms 7808 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 46 ms 7432 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 79 ms 8432 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 93 ms 8500 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 76 ms 8440 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 101 ms 9292 KB function hops(h,c,d) must be called exactly N×H times
# Verdict Execution time Memory Grader output
1 Incorrect 250 ms 14824 KB function hops(h,c,d) must be called exactly N×H times
2 Incorrect 11 ms 4800 KB function hops(h,c,d) must be called exactly N×H times
3 Incorrect 28 ms 6292 KB function hops(h,c,d) must be called exactly N×H times
4 Incorrect 12 ms 4736 KB function hops(h,c,d) must be called exactly N×H times
5 Incorrect 46 ms 7260 KB function hops(h,c,d) must be called exactly N×H times
6 Incorrect 41 ms 7348 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 74 ms 8576 KB function hops(h,c,d) must be called exactly N×H times
8 Incorrect 26 ms 6144 KB function hops(h,c,d) must be called exactly N×H times
9 Incorrect 25 ms 6280 KB function hops(h,c,d) must be called exactly N×H times
10 Incorrect 26 ms 6148 KB function hops(h,c,d) must be called exactly N×H times
11 Incorrect 33 ms 6784 KB function hops(h,c,d) must be called exactly N×H times
12 Incorrect 22 ms 6260 KB function hops(h,c,d) must be called exactly N×H times
13 Incorrect 70 ms 8092 KB function hops(h,c,d) must be called exactly N×H times
14 Incorrect 25 ms 6372 KB function hops(h,c,d) must be called exactly N×H times
15 Incorrect 26 ms 6272 KB function hops(h,c,d) must be called exactly N×H times
16 Incorrect 51 ms 7160 KB function hops(h,c,d) must be called exactly N×H times
17 Incorrect 49 ms 7148 KB function hops(h,c,d) must be called exactly N×H times
18 Incorrect 61 ms 7808 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 46 ms 7432 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 79 ms 8432 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 93 ms 8500 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 76 ms 8440 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 101 ms 9292 KB function hops(h,c,d) must be called exactly N×H times