이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(x) x.begin(),x.end()
typedef long long ll;
#define pb push_back
#define INF 9999999999999999
vector<vector<int>>g;
ll nn;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
/*
g.assign(n,vector<int>());
for (int i = 0; i < n-1; i++) {
g[u[i]].pb(v[i]);
g[v[i]].pb(u[i]);
}
*/
nn =n;
vector<int>labels(n);
for(int i=0;i<n;i++)
labels[i]=i;
return labels;
}
int find_next_station(int s, int t, vector<int> c)
{
int mini=INF;
for(auto x:c)
mini=min(x,mini);
if(t<s)
return mini;
queue<pair<int,int>>q;
q.push({s*2+2,1});
q.push({s*2+1,0});
int tf=-1;
while(!q.empty())
{
pair<int,int> curr=q.front();
q.pop();
if(curr.F*2+1 ==t)
{
tf=curr.S;
break;
}
if(curr.F*2+2 ==t)
{
tf=curr.S;
break;
}
if(curr.F*2+1<t)
q.push({curr.F*2+1,curr.S});
if(curr.F*2+2<t)
q.push({curr.F*2+2,curr.S});
}
if(tf==-1)
return mini;
if(tf==0)
return s*2+1;
else
return s*2+2;
}
컴파일 시 표준 에러 (stderr) 메시지
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:11:13: warning: overflow in conversion from 'long int' to 'int' changes value from '9999999999999999' to '1874919423' [-Woverflow]
11 | #define INF 9999999999999999
| ^~~~~~~~~~~~~~~~
stations.cpp:35:11: note: in expansion of macro 'INF'
35 | int mini=INF;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |