QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#88106 | #2301. Jet Set | Bitroll | WA | 2ms | 3656kb | C++11 | 1.3kb | 2023-03-15 10:32:06 | 2023-03-15 10:32:10 |
Judging History
answer
#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
// debug util
#ifdef DEBUG
#define deb(x) cerr << #x << " = " << x << endl
#else
#define deb(x)
#endif
// useful
#define ll long long
#define umap unordered_map
bool multi = false;
void solve(){
int n;
cin >> n;
int firstVal;
bool vis[720] = {};
int from, to, bk;
// get input
for (int h = 0; h <= n; h++){
if (h != n){
cin >> to >> to;
}
else{
to = firstVal;
}
to += 360;
to %= 360;
if (h == 0){
firstVal = to;
from = to;
continue;
}
int i = from, j = to;
if ((abs(j-i) != 180)){
// make sure i is less than j
if (i > j){
bk = i;
i = j;
j = bk;
}
// get shortest path
if ((j - i) > (360 - j + i)){
bk = i;
i = j;
j = bk;
}
}
int f = i;
while (true){
int s = f*2;
vis[s] = true;
if (f != j){
vis[s+1] = true;
}
else{
break;
}
f++;
f %= 360;
}
from = to;
}
// check everything is visited
for (int i = 0; i < 720; i++){
if (!vis[i]){
cout << "no " << fixed << setprecision(1) << (double)((i%360)-360)/2 << endl;
return;
}
}
cout << "yes";
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t=1;
if(multi)cin>>t;
while(t--)solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3656kb
input:
6 0 -180 0 60 0 -60 0 -179 0 -60 0 60
output:
no -179.5
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3312kb
input:
6 0 -180 0 60 0 -60 0 -180 0 -60 0 60
output:
yes
result:
ok correct
Test #3:
score: 0
Accepted
time: 2ms
memory: 3312kb
input:
6 0 -180 0 60 0 -60 0 179 0 -60 0 60
output:
yes
result:
ok correct
Test #4:
score: 0
Accepted
time: 2ms
memory: 3636kb
input:
2 0 0 1 0
output:
no -179.5
result:
ok correct
Test #5:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
2 -75 -48 5 -163
output:
no -180.0
result:
ok correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3344kb
input:
3 1 32 -74 -100 15 119
output:
yes
result:
ok correct
Test #7:
score: -100
Wrong Answer
time: 2ms
memory: 3576kb
input:
4 30 170 48 83 -42 -104 65 135
output:
no -180.0
result:
wrong answer Wrong answer: the route passes through the given meridian.