이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "highway.h"
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
// #define int long long
typedef long long ll ;
const ll ooo = 1e14 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7 ;
const int N = 10000010 ;
vector<ll> g[100010] , cost;
int a , b , p[100010];
map<pair<int,int> , int>mp;
void dis(int i){
cost[i] = 0 ;
priority_queue<pair<ll,ll>> q;
q.push({0 , i});
while(q.size()){
int src = q.top().second , c = -q.top().first;
q.pop();
if(cost[src] < c) continue ;
for(auto x : g[src])
if(cost[x] > c + a){
p[x] = src;
cost[x] = c + a;
q.push({-cost[x] , x});
}
}
}
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
int M = U.size();
a = A;b = B;
for(int i = 0 ; i < M ; ++i)
g[U[i]].push_back(V[i]) , mp[{U[i] , V[i]}] = i , mp[{V[i] , U[i]}] = i;
cost = vector<ll>(N , ooo);
dis(0);
vector<int> w(M , 0);
ll toll = ask(w);
vector<int> ans;
for(int i = 1 ; i < N; ++i) if(cost[i] == toll) ans.push_back(mp[{i , p[i]}]);
while(ans.size() - 1){
for(int i = 0 ; i < ans.size() / 2 ; ++i) w[ans[i]] = 1;
ll tll = ask(w);
for(int i = 0 ; i < ans.size() / 2 ; ++i) w[ans[i]] = 0;
if(toll == tll){
vector<int> ans1 ;
for(int i = ans.size() / 2 ; i < ans.size() ; ++i)
ans1.push_back(ans[i]) ;
ans = ans1;
}else{
vector<int> ans1 ;
for(int i = 0 ; i < ans.size() / 2 ; ++i)
ans1.push_back(ans[i]) ;
ans = ans1;
}
}
int i = ans[0];
ll y = (p[U[i]] == V[i] ? U[i] : V[i]);
answer(0, y );
}
컴파일 시 표준 에러 (stderr) 메시지
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:48:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
48 | for(int i = 0 ; i < ans.size() / 2 ; ++i) w[ans[i]] = 1;
| ~~^~~~~~~~~~~~~~~~
highway.cpp:50:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | for(int i = 0 ; i < ans.size() / 2 ; ++i) w[ans[i]] = 0;
| ~~^~~~~~~~~~~~~~~~
highway.cpp:53:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for(int i = ans.size() / 2 ; i < ans.size() ; ++i)
| ~~^~~~~~~~~~~~
highway.cpp:58:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
58 | for(int i = 0 ; i < ans.size() / 2 ; ++i)
| ~~^~~~~~~~~~~~~~~~
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |