QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#599473 | #2001. Tropical Garden | iframe# | 49 | 4ms | 4100kb | C++17 | 628b | 2024-09-29 05:24:25 | 2024-09-29 05:24:26 |
Judging History
answer
#include "garden.h"
#include "gardenlib.h"
#include <vector>
std::vector<int> adj[1000];
int find(int i, int k){
int last = -1;
while(k--){
if(adj[i].size() == 1)
last = i, i = adj[i][0];
else if(adj[i][0] == last)
last = i, i = adj[i][1];
else last = i, i = adj[i][0];
}
return i;
}
void count_routes(int n, int m, int p, int r[][2], int q, int g[]){
for(int i=0; i<m; ++i){
adj[r[i][0]].push_back(r[i][1]);
adj[r[i][1]].push_back(r[i][0]);
}
for(int x=0; x<q; ++x){
int res = 0;
for(int i=0; i<n; ++i)
res += (find(i, g[x]) == p);
answer(res);
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 49
Accepted
Test #1:
score: 49
Accepted
time: 0ms
memory: 3916kb
input:
780 780 0 1 0 0 2 2 3 3 1 4 1 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50...
output:
Correct.
Test #2:
score: 49
Accepted
time: 1ms
memory: 3892kb
input:
950 950 0 1 0 0 2 2 3 3 1 4 1 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50...
output:
Correct.
Test #3:
score: 49
Accepted
time: 1ms
memory: 3840kb
input:
999 1099 0 1 0 0 2 2 3 3 1 4 1 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 5...
output:
Correct.
Test #4:
score: 49
Accepted
time: 0ms
memory: 3860kb
input:
45 44 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 1 100 1
output:
Correct.
Test #5:
score: 49
Accepted
time: 0ms
memory: 3784kb
input:
17 46 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 11 16 14 2 13 1 0 6 3 14 0 15 14 0 12 0 5 3 13 16 8 13 5 16 14 10 10 13 9 12 16 4 11 1 5 0 12 8 8 2 12 16 13 7 9 1 10 3 15 5 15 12 12 7 7 10 9 4 10 12 1 100 3
output:
Correct.
Test #6:
score: 49
Accepted
time: 1ms
memory: 3892kb
input:
1000 2000 7 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 0 0 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
Correct.
Test #7:
score: 49
Accepted
time: 0ms
memory: 3860kb
input:
70 170 10 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 ...
output:
Correct.
Test #8:
score: 49
Accepted
time: 1ms
memory: 3896kb
input:
1000 1000 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 0 8 0 9 0 10 2 11 6 12 11 13 9 14 2 15 3 16 14 17 15 18 5 19 2 20 3 21 1 22 2 23 4 24 9 25 2 26 17 27 15 28 5 29 20 30 12 31 24 32 28 33 26 34 25 35 32 36 8 37 16 38 2 39 18 40 3 41 38 42 15 43 39 44 18 45 23 46 37 47 10 48 24 49 47 50 40 51 4 52 19 53 50 54...
output:
Correct.
Test #9:
score: 49
Accepted
time: 2ms
memory: 4100kb
input:
1000 8000 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 0 13 4 14 0 15 10 16 5 17 6 18 14 19 2 20 6 21 10 22 18 23 18 24 0 25 10 26 22 27 11 28 5 29 16 30 14 31 2 32 0 33 0 34 9 35 24 36 34 37 34 38 37 39 15 40 22 41 1 42 32 43 10 44 18 45 35 46 21 47 45 48 32 49 16 50 30 51 44 52 31 53 ...
output:
Correct.
Subtask #2:
score: 0
Runtime Error
Dependency #1:
100%
Accepted
Test #10:
score: 20
Accepted
time: 4ms
memory: 3792kb
input:
100 100 13 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 0 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 10 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 27 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 ...
output:
Correct.
Test #11:
score: 0
Runtime Error
input:
135000 142500 2 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 65899 68039 16 0 17 18 18 19 19 20 20 21 21 22 125073 94485 22 23 23 24 24 25 25 26 26 27 27 28 77287 19161 28 29 29 30 30 31 31 32 32 33 33 34 34 17 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 ...
output:
Unauthorized output
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%