Submission #1281723

#TimeUsernameProblemLanguageResultExecution timeMemory
1281723quangminh412Portal (BOI24_portal)C++17
100 / 100
28 ms1216 KiB
/* Ben Watson Quang Minh MasterDDDDD */ #include <bits/stdc++.h> using namespace std; #define ll long long const string name = "test"; void solve(); signed main() { if (fopen((name + ".inp").c_str(), "r")) { freopen((name + ".inp").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; } // main program ll GCD(ll a, ll b) { return (b == 0 ? a : GCD(b, a % b)); } ll a = 0, b = 0, c = 0; void euclid(ll x, ll y) { while (x) { ll t = a / x; a -= t * x; b -= t * y; swap(a, x); swap(b, y); } c = GCD(c, y); if (c != 0) b %= c; } void solve() { int n; cin >> n; int X[n], Y[n]; for (int i = 0; i < n; i++) cin >> X[i] >> Y[i]; for (int i = 1; i < n; i++) euclid(X[i] - X[0], Y[i] - Y[0]); if (a == 0 || c == 0) cout << -1 << '\n'; else cout << abs(a * c) << '\n'; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:19:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         freopen((name + ".inp").c_str(), "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((name + ".out").c_str(), "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...