Submission #783733

# Submission time Handle Problem Language Result Execution time Memory
783733 2023-07-15T09:13:57 Z PoonYaPat Airline Route Map (JOI18_airline) C++14
0 / 100
2500 ms 29360 KB
#include "Alicelib.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

void Alice( int n, int m, int A[], int B[] ){
	vector<pii> v;
	for (int i=0; i<n; ++i) v.push_back({n,i}), v.push_back({n+1,i});
	for (int i=n+1; i<=n+11; ++i) v.push_back({i-1,i});
	for (int i=0; i<n; ++i) {
		for (int j=0; j<10; ++j) {
			if (i&(1<<j)) v.push_back({i,n+2+j});
		}
	}
	for (int i=0; i<m; ++i) v.push_back({A[i],B[i]});
	InitG(n+12,v.size());
	for (int i=0; i<v.size(); ++i) MakeG(i,v[i].first,v[i].second);
}
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

int st,nx,re[1020];
vector<int> adj[1020];
bool mark[1020];

void dfs(int x, int par, int val) {
	int nxt=-1;
	for (auto s : adj[x]) {
		if (s==par) continue;
		if (mark[s]) re[s]+=val;
		else nxt=s;
	}
	if (nxt!=-1) dfs(nxt,x,val*2);
}

void Bob(int n, int m, int C[], int D[] ){
	vector<pii> v;
	for (int i=0; i<m; ++i) {
		adj[C[i]].push_back(D[i]);
		adj[D[i]].push_back(C[i]);
	}
	for (int i=0; i<n; ++i) {
		if (adj[i].size()==n-11) st=i;
		if (adj[i].size()==n-10) nx=i;
	}

	for (auto s : adj[st]) if (s!=nx) mark[s]=true;
	for (auto s : adj[nx]) if (!mark[s] && s!=st) dfs(s,nx,1);

	for (int i=0; i<m; ++i) {
		if (mark[C[i]] && mark[D[i]]) {
			v.push_back({re[C[i]],re[D[i]]});
		}
	}

	InitMap(n-12,v.size());
	for (auto s : v) MakeMap(s.first,s.second);
}

Compilation message

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:17:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for (int i=0; i<v.size(); ++i) MakeG(i,v[i].first,v[i].second);
      |                ~^~~~~~~~~

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:27:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |   if (adj[i].size()==n-11) st=i;
      |       ~~~~~~~~~~~~~^~~~~~
Bob.cpp:28:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |   if (adj[i].size()==n-10) nx=i;
      |       ~~~~~~~~~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4612 KB Wrong Answer [14]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4612 KB Wrong Answer [14]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 377 ms 29360 KB Output is correct : V - N = 12
2 Correct 365 ms 25696 KB Output is correct : V - N = 12
3 Correct 129 ms 13912 KB Output is correct : V - N = 12
4 Correct 6 ms 5396 KB Output is correct : V - N = 12
5 Correct 98 ms 9836 KB Output is correct : V - N = 12
6 Correct 239 ms 23684 KB Output is correct : V - N = 12
7 Correct 381 ms 28984 KB Output is correct : V - N = 12
8 Correct 324 ms 27392 KB Output is correct : V - N = 12
9 Correct 149 ms 16008 KB Output is correct : V - N = 12
10 Correct 31 ms 6324 KB Output is correct : V - N = 12
11 Correct 55 ms 7332 KB Output is correct : V - N = 12
12 Correct 211 ms 18240 KB Output is correct : V - N = 12
13 Correct 479 ms 28028 KB Output is correct : V - N = 12
14 Correct 494 ms 28612 KB Output is correct : V - N = 12
15 Correct 343 ms 22516 KB Output is correct : V - N = 12
16 Correct 62 ms 8308 KB Output is correct : V - N = 12
17 Correct 20 ms 5660 KB Output is correct : V - N = 12
18 Correct 134 ms 14988 KB Output is correct : V - N = 12
19 Correct 368 ms 26576 KB Output is correct : V - N = 12
20 Execution timed out 3361 ms 24932 KB Time limit exceeded
21 Halted 0 ms 0 KB -