QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#82086 | #2301. Jet Set | larry | WA | 2ms | 3260kb | C++17 | 1.4kb | 2023-02-27 03:58:30 | 2023-02-27 03:58:31 |
Judging History
answer
#include <iostream>
using namespace std;
bool longtitude[720];
int main() {
ios::sync_with_stdio(false);
cout.tie(nullptr);
cin.tie(nullptr);
int n;
cin >> n;
int arr[n + 1];
int latitude;
for (int i = 0; i < n; i++) {
cin >> latitude >> arr[i];
}
arr[n] = arr[0];
bool flag = false;
for (int i = 1; i <= n; i++) {
int start = arr[i - 1], end = arr[i];
int diff = abs(start - end);
if (diff == 180) {
flag = true;
break;
} else if (diff < 180) { // cross longtitude 0
int newStart = (start + 180) * 2, newEnd = (end + 180) * 2;
for (int j = newStart; j <= newEnd; j++) {
longtitude[j] = true;
}
} else { // not cross longtitude 0
int newStart = (start + 180) * 2, newEnd = (end + 180) * 2;
for (int j = 0; j <= newStart; j++) {
longtitude[j] = true;
}
for (int j = newEnd; j < 720; j++) {
longtitude[j] = true;
}
}
}
int i;
double res;
for (i = 0; i < 720; i++) {
if (!longtitude[i]) {
res = i / 2 - 180;
break;
}
}
if (flag || i == 720) {
cout << "yes" << endl;
} else {
printf("no %.1f", res);
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3260kb
input:
6 0 -180 0 60 0 -60 0 -179 0 -60 0 60
output:
yes
result:
wrong answer Wrong answer: expected 'no', got 'yes'.