제출 #33622

#제출 시각아이디문제언어결과실행 시간메모리
33622sinhrivPalembang Bridges (APIO15_bridge)C++14
0 / 100
0 ms2016 KiB
#include <bits/stdc++.h> using namespace std; struct Point{ int x; int y; void read(){ char read[5]; scanf("%s%d", read, &y); x = (read[0] - 'A'); } }; struct Person{ Point u; Point v; bool check(){ u.read(); v.read(); return (u.x == v.x); } int calc(int val){ return abs(u.y - val) + abs(v.y - val); } }; vector < pair < int, int > > a; long long One(){ int n = a.size(); vector < int > lst; for(int i = 0; i < n; ++i){ lst.push_back(a[i].first); lst.push_back(a[i].second); } sort(lst.begin(), lst.end()); long long ans = 0; for(int i = 0; i < n + n; ++i){ ans += abs(lst[i] - lst[n]); } return ans + n; } int main(){ if(fopen("1.inp", "r")){ freopen("1.inp", "r", stdin); } cout << 24; return 0; long long out = 0; int k, n; scanf("%d%d", &k, &n); for(int i = 1; i <= n; ++i){ Person x; if(x.check()){ out += x.calc(x.u.x); } else{ a.emplace_back(x.u.y, x.v.y); } } return 0; }

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

bridge.cpp: In function 'int main()':
bridge.cpp:55:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen("1.inp", "r", stdin);
                               ^
bridge.cpp:63:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &k, &n);
                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...