# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1055109 | anango | Portal (BOI24_portal) | C++17 | 762 ms | 2612 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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() {
rng.discard(time(NULL)%8888);
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);
}
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;
}*/
if (n<10000) {
for (int j=0; j<n; j++) {
for (int k=0; k<n; k++) {
g=gcd(g,area(0,j,k));
}
}
}
else {
for (int j=0; j<3; j++) {
int root=rng()%n;
for (int it=0; it<10000000; it++) {
int j,k;
j=rng()%n; k=rng()%n;
//cout << i <<" " << j <<" " << k <<" " << area(i,j,k) << endl;
g=gcd(g,area(root,j,k));
}
}
}
g=abs(g);
if (g==0) {
cout << -1 << endl;
}
else {
cout << g << endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |