QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#864380 | #9161. Naval battle | UmairAhmadMIrza | 6 | 1ms | 3712kb | C++14 | 2.4kb | 2025-01-20 15:32:37 | 2025-01-20 15:32:39 |
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const N=2e5+5;
int const mod=1e9+7;
char d[N];
int x[N];
int y[N];
bool sink[N];
int main(){
int n;
cin>>n;
// bool b=0;
for (int i = 0; i < n; ++i)
cin>>y[i]>>x[i]>>d[i];
// cerr<<"we"<<endl;
vector<vector<int>> mov;
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++){
if(d[i]==d[j])
continue;
if((d[i]=='E' && d[j]=='W')){
if(x[i]==x[j] && y[i]<=y[j] && abs(y[i]-y[j])%2==0)
mov.push_back({abs(y[i]-y[j])/2,i,j});
}
else if((d[i]=='W' && d[j]=='E')){
if(x[i]==x[j] && y[j]<=y[i] && abs(y[i]-y[j])%2==0)
mov.push_back({abs(y[i]-y[j])/2,i,j});
}
else if((d[i]=='S' && d[j]=='N')){
if(y[i]==y[j] && x[i]<=x[j] && abs(x[i]-x[j])%2==0)
mov.push_back({abs(x[i]-x[j])/2,i,j});
}
else if((d[i]=='N' && d[j]=='S')){
if(y[i]==y[j] && x[j]<=x[i] && abs(x[i]-x[j])%2==0)
mov.push_back({abs(x[i]-x[j])/2,i,j});
}
else if((d[i]=='E' && d[j]=='S')){
if(-(x[i]-x[j])==(y[i]-y[j]))
mov.push_back({abs(x[i]-x[j]),i,j});
}
else if((d[i]=='E' && d[j]=='N')){
if((x[i]-x[j])==(y[i]-y[j]))
mov.push_back({abs(x[i]-x[j]),i,j});
}
else if((d[i]=='W' && d[j]=='S')){
if((x[i]-x[j])==(y[i]-y[j]))
mov.push_back({abs(x[i]-x[j]),i,j});
}
else if((d[i]=='W' && d[j]=='N')){
if(-(x[i]-x[j])==(y[i]-y[j]))
mov.push_back({abs(x[i]-x[j]),i,j});
}
else if((d[i]=='S' && d[j]=='E')){
if(-(x[i]-x[j])==(y[i]-y[j]))
mov.push_back({abs(x[i]-x[j]),i,j});
}
else if((d[i]=='S' && d[j]=='W')){
if((x[i]-x[j])==(y[i]-y[j]))
mov.push_back({abs(x[i]-x[j]),i,j});
}
else if((d[i]=='N' && d[j]=='E')){
if((x[i]-x[j])==(y[i]-y[j]))
mov.push_back({abs(x[i]-x[j]),i,j});
}
else if((d[i]=='N' && d[j]=='W')){
if(-(x[i]-x[j])==(y[i]-y[j]))
mov.push_back({abs(x[i]-x[j]),i,j});
}
}
sort(mov.begin(), mov.end());
vector<int> rem;
int pre=-1;
for(vector<int> vv:mov){
if(pre!=vv[0]){
for(int i:rem)
sink[i]=1;
rem.clear();
pre=vv[0];
}
// cout<<vv[0]<<' '<<vv[1]<<' '<<vv[2]<<endl;
if(sink[vv[1]]==0 && sink[vv[2]]==0){
rem.push_back(vv[2]);
rem.push_back(vv[1]);
}
}
for(int i:rem)
sink[i]=1;
for(int i=0;i<n;i++)
if(sink[i]==0)
cout<<i+1<<endl;
return 0;
}
詳細信息
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 1ms
memory: 3584kb
input:
2 675333810 792019962 W 851860476 960355168 W
output:
1 2
result:
ok
Test #2:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 714148610 688520844 W 359519570 789553998 S
output:
1 2
result:
ok
Test #3:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 743286406 87591094 E 108453484 326740470 S
output:
1 2
result:
ok
Test #4:
score: 6
Accepted
time: 1ms
memory: 3584kb
input:
2 629499666 659260200 W 391550936 897208930 N
output:
result:
ok
Test #5:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 509095668 374922996 W 325521434 191348762 S
output:
result:
ok
Test #6:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 357656592 713571312 E 456601638 614626266 S
output:
result:
ok
Test #7:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 353512742 374956722 W 265604916 462864548 N
output:
result:
ok
Test #8:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 253519292 302668732 E 436627396 119560628 S
output:
result:
ok
Test #9:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 741954822 709863076 W 516385128 484293380 S
output:
1 2
result:
ok
Test #10:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 268851874 524109226 E 503673708 758931058 N
output:
1 2
result:
ok
Test #11:
score: 6
Accepted
time: 1ms
memory: 3584kb
input:
2 629380956 395789270 S 557401140 467769088 E
output:
1 2
result:
ok
Test #12:
score: 6
Accepted
time: 1ms
memory: 3584kb
input:
2 606361496 587557658 N 667076156 526843000 W
output:
1 2
result:
ok
Test #13:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
2 270428340 629167054 N 270428342 179345630 S
output:
1 2
result:
ok
Subtask #2:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 1ms
memory: 3712kb
input:
100 32 46 N 8 24 W 74 86 W 2 76 N 90 70 N 34 74 N 4 68 N 42 26 N 66 94 N 28 40 W 96 12 W 82 78 W 54 24 N 36 42 W 92 68 W 0 26 N 14 54 N 94 66 N 26 52 N 66 12 W 72 6 W 64 96 W 6 20 N 4 22 W 26 42 N 40 28 W 70 76 N 18 60 N 62 16 N 30 48 N 36 36 W 42 36 W 52 94 N 62 98 N 0 78 N 70 2 W 28 50 N 80 80 W 8...
output:
45 78 86
result:
FAIL Unexpected end of file - token expected (/var/uoj_data/9161/14.ans)
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Time Limit Exceeded
Test #58:
score: 0
Time Limit Exceeded
input:
200000 526715640 430855204 E 731546662 226024182 S 254814720 702756124 E 227354364 730216480 S 764250602 193320242 S 150102088 807468756 E 204858572 752712272 S 635512190 322058654 E 403910248 553660596 S 257917918 4587926 S 949444340 8126504 S 907805098 49765746 S 553836306 403734538 S 40977864 617...
output:
result:
Subtask #7:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%