# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
994720 |
2024-06-08T04:25:45 Z |
김은성(#10865) |
Closing Time (IOI23_closing) |
C++17 |
|
113 ms |
38304 KB |
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<int, ll> > graph[200009];
ll distx[200009], disty[200009];
void dfs(int v, ll* dist, ll cur){
if(dist[v] != -1)
return;
dist[v] = cur;
int i;
for(i=0; i<graph[v].size(); i++)
dfs(graph[v][i].first, dist, cur + graph[v][i].second);
}
int max_score(int N, int X, int Y, long long K,
std::vector<int> U, std::vector<int> V, std::vector<int> W){
int i;
for(i=0; i<N; i++){
graph[i].clear();
distx[i] = -1;
disty[i] = -1;
}
for(i=0; i<N-1; i++){
graph[U[i]].push_back(make_pair(V[i], W[i]));
graph[V[i]].push_back(make_pair(U[i], W[i]));
}
dfs(X, distx, 0);
dfs(Y, disty, 0);
vector<ll> temp;
for(i=0; i<N; i++)
temp.push_back(distx[i]), temp.push_back(disty[i]);
sort(temp.begin(), temp.end());
ll now=0;
for(i=0; i<2*N; i++){
now += temp[i];
if(now > K)
break;
}
return i;
}
Compilation message
closing.cpp: In function 'void dfs(int, ll*, ll)':
closing.cpp:12:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
12 | for(i=0; i<graph[v].size(); i++)
| ~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
34500 KB |
Output is correct |
2 |
Correct |
113 ms |
38304 KB |
Output is correct |
3 |
Correct |
61 ms |
13136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8024 KB |
Output is correct |
2 |
Incorrect |
1 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '30', found: '24' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8024 KB |
Output is correct |
2 |
Incorrect |
1 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '30', found: '24' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8024 KB |
Output is correct |
2 |
Incorrect |
1 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '30', found: '24' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
8028 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |