Submission #1054689

#TimeUsernameProblemLanguageResultExecution timeMemory
1054689anangoPortal (BOI24_portal)C++17
1 / 100
1908 ms2500 KiB
#include <bits/stdc++.h> #define int long long using namespace std; mt19937 rng; #pragma GCC optimize("Ofast,fast-math") vector<int> cords; int area(int i, int j, int k) { return cords[2*i]*cords[2*j+1]-cords[2*i+1]*cords[2*j]+cords[2*j]*cords[2*k+1]-cords[2*j+1]*cords[2*k]+cords[2*k]*cords[2*i+1]-cords[2*k+1]*cords[2*i]; } 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; for (int i=0; i<n; i++) { int x,y; cin >> x >> y; cords.push_back(x); cords.push_back(y); } sort(cords.begin(), cords.end()); int g = 0; for (int it=0; it<100000000; it++) { int j,k; j=rng()%n; k=rng()%n; //cout << i <<" " << j <<" " << k <<" " << area(i,j,k) << endl; g=gcd(g,area(0,j,k)); } g=abs(g); if (g==0) { cout << -1 << endl; } else { cout << g << endl; } }

Compilation message (stderr)

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