제출 #1054612

#제출 시각아이디문제언어결과실행 시간메모리
1054612anangoPortal (BOI24_portal)C++17
10 / 100
43 ms6432 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int local = 0; if (local) { // for getting input from input.txt freopen("input.txt", "r", stdin); // for writing output to output.txt freopen("output.txt", "w", stdout); } #ifdef ONLINE_JUDGE ios_base::sync_with_stdio(false); cin.tie(NULL); #endif //fast IO int n; cin >> n; vector<pair<int,int>> cords; vector<int> xv; vector<int> yv; for (int i=0; i<n; i++) { int x,y; cin >> x >> y; cords.push_back({x,y}); xv.push_back(x); yv.push_back(y); } sort(xv.begin(), xv.end()); sort(yv.begin(), yv.end()); int gx,gy; gx=gy=0; for (int i=0; i<n-1; i++) { gx=gcd(gx,xv[i+1]-xv[i]); gy=gcd(gy,yv[i+1]-yv[i]); } if (gx==0 || gy==0) { cout << -1 << endl; return 0; } cout << gx*gy << endl; }

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

Main.cpp: In function 'int main()':
Main.cpp:11:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:13:16: 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);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...