제출 #1147479

#제출 시각아이디문제언어결과실행 시간메모리
1147479zakimoiCircle Passing (EGOI24_circlepassing)C++20
14 / 100
131 ms8620 KiB
#include <iostream> #include <fstream> #include <string> #include <vector> #include <algorithm> #include <cstdint> #include <set> #include <unordered_map> #define int long long int using namespace std; int MAX = 1e9 + 7; void iO() { freopen("output.txt","w",stdout); freopen("input.txt","r",stdin); } int32_t main () { // iO(); int n, m, q; cin >> n >> m >> q; vector<int> bestie; for (int i = 0; i < m; i++) { int temp; cin >> temp; bestie.push_back(temp); bestie.push_back(temp + n); } sort(bestie.begin(), bestie.end()); for (int i_ = 0; i_ < q; i_++) { int begin, end; cin >> begin >> end; int notp = abs(end - begin); notp = min(notp, 2*n - notp); int lower = bestie[lower_bound(bestie.begin(), bestie.end(), begin) - bestie.begin()]; int bigger = bestie[(lower + 1) % (2*m)]; int closest_lower = abs(lower - begin); closest_lower = min(closest_lower, 2*n - closest_lower) + 1; int closest_bigger = abs(bigger - begin); closest_bigger = min(closest_bigger, 2*n - closest_bigger) + 1; int lower2end = abs(((lower + n) % (2*n)) - end); lower2end = min(lower2end, 2*n - lower2end); int bigger2end = abs(((bigger + n) % (2*n)) - end); bigger2end = min(bigger2end, 2*n - bigger2end); int closestp = min(closest_bigger + bigger2end, closest_lower + lower2end); cout << min(notp, closestp) << endl; } } // 1 1 2 5 7

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

Main.cpp: In function 'void iO()':
Main.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     freopen("output.txt","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:14:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen("input.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...