QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#555426 | #8708. Portal | Bucketsmith | Compile Error | / | / | C++20 | 999b | 2024-09-09 23:03:54 | 2024-09-09 23:03:55 |
Judging History
This is the latest submission verdict.
- [2024-09-09 23:03:55]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-09-09 23:03:54]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 10;
int n, x[N], y[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for(int i = 1; i <= n; i ++)
cin >> x[i] >> y[i];
int px = 0, py = 0;
for(int i = n; i >= 1; i --) {
x[i] -= x[1];
y[i] -= y[1];
if(x[i] < 0) {
x[i] = -x[i];
y[i] = -y[i];
}
if(x[i]) {
px = x[i];
py = y[i];
}
}
if(!px) {
cout << "-1\n";
return 0;
}
int dy = 0;
for(int i = 2; i <= n; i ++) {
while(x[i] > 0) {
int p = px / x[i];
px -= p * x[i];
py -= p * y[i];
swap(px, x[i]);
swap(py, y[i]);
}
if(y[i]) dy = gcd(abs(y[i]), dy);
}
if(!dy) cout << "-1\n";
else cout << abs(1ll * dy * px) << "\n";
}
Details
cc1plus: error: ‘::main’ must return ‘int’