제출 #846149

#제출 시각아이디문제언어결과실행 시간메모리
846149vjudge1ČVENK (COI15_cvenk)C++17
0 / 100
54 ms3612 KiB
#include <bits/stdc++.h> using namespace std; #define int int64_t #define all(x) (x).begin(),(x).end() #define x first #define y second signed main() { //ios_base::sync_with_stdio(false); //cin.tie(); int n; cin >> n; vector<pair<int, int>> v(n); for (auto& i: v) cin >> i.x >> i.y; vector<pair<int, int>> vc(v); vector<pair<int, int>> path1; vector<pair<int, int>> path2; for (int i = 1; i < 40; i++){ path1.push_back(v[0]); v[0].x -= (v[0].x)%(1<<i); v[0].y -= (v[0].y)%(1<<i); } for (int i = 1; i < 40; i++){ path2.push_back(v[1]); v[1].x -= (v[1].x)%(1<<i); v[1].y -= (v[1].y)%(1<<i); } int ans = 1e16; /* for (auto& i: path1){ cout << i.x << ' ' << i.y << endl; } cout << endl; for (auto& i: path2){ cout << i.x << ' ' << i.y << endl; } */ for (int i = 0; i < path1.size(); i++){ for (int j = 0; j < path2.size(); j++){ if (path1[i] == path2[j]) { pair<int, int> point = path1[i]; ans = min(ans, abs(point.x - vc[0].x) + abs(point.x - vc[1].x) + abs(point.y - vc[0].y) + abs(point.y - vc[1].y)); } else if (path1[i].x == path2[j].x){ pair<int, int> point = make_pair(path1[i].x, min(path1[i].y, path2[j].y)); ans = min(ans, abs(point.x - vc[0].x) + abs(point.x - vc[1].x) + abs(point.y - vc[0].y) + abs(point.y - vc[1].y)); } else if (path1[i].y == path2[j].y){ pair<int, int> point = make_pair(min(path1[i].x, path2[j].x), path1[i].y); ans = min(ans, abs(point.x - vc[0].x) + abs(point.x - vc[1].x) + abs(point.y - vc[0].y) + abs(point.y - vc[1].y)); } } } cout << ans << endl; }

컴파일 시 표준 에러 (stderr) 메시지

cvenk.cpp: In function 'int main()':
cvenk.cpp:53:20: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<std::pair<long int, long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |  for (int i = 0; i < path1.size(); i++){
      |                  ~~^~~~~~~~~~~~~~
cvenk.cpp:54:21: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<std::pair<long int, long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |   for (int j = 0; j < path2.size(); j++){
      |                   ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...