# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1027716 |
2024-07-19T09:26:06 Z |
김은성(#10950) |
None (JOI16_dungeon2) |
C++14 |
|
16 ms |
600 KB |
#include "dungeon2.h"
#include <bits/stdc++.h>
using namespace std;
int ans[209];
vector<pair<int, int> > tree[209];
int root, dist, paridx[209], orgc[209];
int numberofcalls = 0;
int cnt = 1;
void extendtree(int v){
int i;
if(tree[v].empty()){
for(i=1; i<=NumberOfRoads(); i++){
Move(i, Color());
//printf("cnt+1=%d Color=%d\n", cnt+1, Color());
if(Color() == 3){
Move(LastRoad(), Color());
continue;
}
cnt++;
orgc[cnt] = Color();
//printf("orgc[%d]=%d\n", cnt, orgc[cnt]);
paridx[cnt] = LastRoad();
// printf("cnt=%d paridx=%d\n", cnt, paridx[cnt]);
//printf("Line 23\n");
Move(LastRoad(), 3);
tree[v].push_back(make_pair(i, cnt));
ans[dist]++;
//printf("dist=%d\n", dist);
}
}
else{
for(i=0; i<tree[v].size(); i++){
//printf("Line 32\n");
Move(tree[v][i].first, 3);
extendtree(tree[v][i].second);
}
}
if(v==root)
return;
//printf("v=%d Line 38 paridx[v]=%d\n", v, paridx[v]);
Move(paridx[v], Color());
}
void backcolor(int v){
int i;
//printf("v=%d\n", v);
for(i=0; i<tree[v].size(); i++){
// printf("Line 45 v=%d tree[v][i].second=%d\n", v, tree[v][i].second);
Move(tree[v][i].first, orgc[v]);
// printf("v=%d\n", v);
//printf("v=%d tree[v][i].second=%d\n", v, tree[v][i].second);
backcolor(tree[v][i].second);
}
if(v==root)
return;
//printf("v=%d\n", v);
//printf("v=%d Line 54 paridx[v]=%d\n", v, paridx[v]);
Move(paridx[v], orgc[v]);
}
void dfs(){
root = 1;
numberofcalls++;
cnt = 1;
int l = LastRoad();
orgc[1] = Color();
Move(1, 3);
Move(LastRoad(), Color());
for(int i=1; i<=208; i++)
tree[i].clear();
for(dist=1; dist<=208; dist++)
extendtree(root);
backcolor(root);
for(int i=1; i<=NumberOfRoads(); i++){
// printf("realmove\n");
//printf("Line 73\n");
Move(i, 2);
if(Color() == 2){
// printf("Line 74\n");
Move(LastRoad(), 2);
continue;
}
dfs();
}
// printf("realmove\n");
//printf("Line 83\n");
if(l==-1)
return;
Move(l, 2);
}
void Inspect(int R)
{
dfs();
assert(numberofcalls == cnt);
for(int i=1; i<=R; i++){
Answer(i, ans[i]/2);
}
}
Compilation message
dungeon2.cpp: In function 'void extendtree(int)':
dungeon2.cpp:32:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for(i=0; i<tree[v].size(); i++){
| ~^~~~~~~~~~~~~~~
dungeon2.cpp: In function 'void backcolor(int)':
dungeon2.cpp:46:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | for(i=0; i<tree[v].size(); i++){
| ~^~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
344 KB |
Output is correct |
2 |
Correct |
11 ms |
348 KB |
Output is correct |
3 |
Correct |
14 ms |
600 KB |
Output is correct |
4 |
Incorrect |
10 ms |
348 KB |
Wrong Answer [7] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
14 ms |
552 KB |
Output is correct |
3 |
Correct |
9 ms |
348 KB |
Output is correct |
4 |
Correct |
10 ms |
548 KB |
Output is correct |
5 |
Incorrect |
10 ms |
344 KB |
Wrong Answer [7] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
600 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |