# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
733188 |
2023-04-30T08:07:45 Z |
yeyso |
Game (APIO22_game) |
C++17 |
|
4000 ms |
12112 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
int n;
int x;
int y;
int k;
void init(int n, int k) {
//n += 1;
vector<vector<int>> matrix(n, vector<int>(n, INT_MAX / 3));
vector<vector<int>> dma(n, vector<int>(n, INT_MAX / 3));
adj = matrix;
for(int i = 0; i < k - 1; i ++){
adj[i][i+1] = -1;
/*for(int j = 0; j < n; j ++){
adj[i][j] = -1;
adj[j][i] = -1;
}*/
//dma[i][i+1] = -1;
}
/*for(int i = 0; i < n; i ++){
for(int j = 0; j < k - 1;)
}*/
x = n;
y = k;
}
int add_teleporter(int u, int v) {
n = x;
k = y;
adj[u][v] = min(adj[u][v], 0);
if(u < k){
adj[u][v] = -1;
}
if(v < k){
adj[u][v] = -1;
}
for(int k = 0; k < n; k ++){
for(int i = 0; i < n; i ++){
for(int j = 0; j < n; j ++){
adj[i][j] = min(adj[i][j], adj[i][k]+adj[k][j]);
}
}
}
for(int i = 0; i < n; i ++){
if(adj[i][i] < 0){
return 1;
}
}
/*for(int i = 0; i < n; i ++){
for(int j = 0; j < n; j ++){
cout << adj[i][j] << " ";
} cout << "\n";
} cout << "\n";*/
return 0;
}
/*
g++ -std=gnu++17 -O2 -pipe -o game grader.cpp game.cpp
6 5 3
3 4
5 0
4 5
5 3
1 4
4 1 2
1 0
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
401 ms |
532 KB |
Output is correct |
4 |
Correct |
16 ms |
208 KB |
Output is correct |
5 |
Correct |
369 ms |
396 KB |
Output is correct |
6 |
Correct |
350 ms |
408 KB |
Output is correct |
7 |
Correct |
372 ms |
408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
401 ms |
532 KB |
Output is correct |
4 |
Correct |
16 ms |
208 KB |
Output is correct |
5 |
Correct |
369 ms |
396 KB |
Output is correct |
6 |
Correct |
350 ms |
408 KB |
Output is correct |
7 |
Correct |
372 ms |
408 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
164 ms |
528 KB |
Output is correct |
12 |
Correct |
156 ms |
336 KB |
Output is correct |
13 |
Correct |
129 ms |
404 KB |
Output is correct |
14 |
Correct |
140 ms |
404 KB |
Output is correct |
15 |
Correct |
316 ms |
400 KB |
Output is correct |
16 |
Correct |
342 ms |
400 KB |
Output is correct |
17 |
Correct |
313 ms |
400 KB |
Output is correct |
18 |
Correct |
209 ms |
404 KB |
Output is correct |
19 |
Correct |
215 ms |
408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
401 ms |
532 KB |
Output is correct |
4 |
Correct |
16 ms |
208 KB |
Output is correct |
5 |
Correct |
369 ms |
396 KB |
Output is correct |
6 |
Correct |
350 ms |
408 KB |
Output is correct |
7 |
Correct |
372 ms |
408 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
164 ms |
528 KB |
Output is correct |
12 |
Correct |
156 ms |
336 KB |
Output is correct |
13 |
Correct |
129 ms |
404 KB |
Output is correct |
14 |
Correct |
140 ms |
404 KB |
Output is correct |
15 |
Correct |
316 ms |
400 KB |
Output is correct |
16 |
Correct |
342 ms |
400 KB |
Output is correct |
17 |
Correct |
313 ms |
400 KB |
Output is correct |
18 |
Correct |
209 ms |
404 KB |
Output is correct |
19 |
Correct |
215 ms |
408 KB |
Output is correct |
20 |
Execution timed out |
4027 ms |
12112 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
401 ms |
532 KB |
Output is correct |
4 |
Correct |
16 ms |
208 KB |
Output is correct |
5 |
Correct |
369 ms |
396 KB |
Output is correct |
6 |
Correct |
350 ms |
408 KB |
Output is correct |
7 |
Correct |
372 ms |
408 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
164 ms |
528 KB |
Output is correct |
12 |
Correct |
156 ms |
336 KB |
Output is correct |
13 |
Correct |
129 ms |
404 KB |
Output is correct |
14 |
Correct |
140 ms |
404 KB |
Output is correct |
15 |
Correct |
316 ms |
400 KB |
Output is correct |
16 |
Correct |
342 ms |
400 KB |
Output is correct |
17 |
Correct |
313 ms |
400 KB |
Output is correct |
18 |
Correct |
209 ms |
404 KB |
Output is correct |
19 |
Correct |
215 ms |
408 KB |
Output is correct |
20 |
Execution timed out |
4027 ms |
12112 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
401 ms |
532 KB |
Output is correct |
4 |
Correct |
16 ms |
208 KB |
Output is correct |
5 |
Correct |
369 ms |
396 KB |
Output is correct |
6 |
Correct |
350 ms |
408 KB |
Output is correct |
7 |
Correct |
372 ms |
408 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
164 ms |
528 KB |
Output is correct |
12 |
Correct |
156 ms |
336 KB |
Output is correct |
13 |
Correct |
129 ms |
404 KB |
Output is correct |
14 |
Correct |
140 ms |
404 KB |
Output is correct |
15 |
Correct |
316 ms |
400 KB |
Output is correct |
16 |
Correct |
342 ms |
400 KB |
Output is correct |
17 |
Correct |
313 ms |
400 KB |
Output is correct |
18 |
Correct |
209 ms |
404 KB |
Output is correct |
19 |
Correct |
215 ms |
408 KB |
Output is correct |
20 |
Execution timed out |
4027 ms |
12112 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |