QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#528317 | #9161. Naval battle | Mispertion# | 0 | 0ms | 3664kb | C++23 | 3.0kb | 2024-08-23 12:40:34 | 2024-08-23 12:40:35 |
answer
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define int ll
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mispertion ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define F first
#define S second
#define getlast(s) (*s.rbegin())
#define debg cout << "OK\n"
const ld PI = 3.1415926535;
const int N = 5000 + 10;
const int M = 1e5 + 10;
int mod = 998244353;
const int infi = INT_MAX;
const ll infl = 1e16;
const int P = 2;
int mult(int a, int b){
return a * 1LL * b % mod;
}
int sum(int a, int b){
if(a + b >= mod)
return a + b - mod;
if(a + b < 0)
return a + b + mod;
return a + b;
}
int binpow(int a, int n){
if (n == 0)
return 1;
if (n % 2 == 1){
return mult(binpow(a, n - 1), a);
}
else{
auto b = binpow(a, n / 2);
return mult(b, b);
}
}
int n, x[N], y[N], dead[N];
char d[N];
void solve(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> x[i] >> y[i] >> d[i];
}
debg;
vector<pair<int, pii>> col = {};
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
if(i == j) continue;
if(d[i] == 'W' && d[j] == 'N'){
if(x[i] - x[j] == y[j] - y[i] && x[i] - x[j] > 0){
col.pb({x[i] - x[j], {i, j}});
}
}else if(d[i] == 'W' && d[j] == 'S'){
if(x[i] - x[j] == y[i] - y[j] && x[i] - x[j] > 0){
col.pb({x[i] - x[j], {i, j}});
}
}else if(d[i] == 'E' && d[j] == 'N'){
if(x[j] - x[i] == y[j] - y[i] && x[j] - x[i] > 0){
col.pb({x[j] - x[i], {i, j}});
}
}else if(d[i] == 'E' && d[j] == 'S'){
if(x[j] - x[i] == y[i] - y[j] && x[j] - x[i] > 0){
col.pb({x[j] - x[i], {i, j}});
}
}else if(d[i] == 'N' && d[j] == 'S' && y[i] - y[j] > 0 && x[i] == x[j]){
col.pb({(y[i] - y[j]) / 2, {i, j}});
}else if(d[i] == 'E' && d[j] == 'W' && x[j] - x[i] > 0 && y[i] == y[j]){
col.pb({(x[j] - x[i]) / 2, {i, j}});
}
}
}
debg;
for(int i = 1; i <= n; i++)
dead[i] = infi;
sort(all(col));
debg;
for(auto e : col){
if(dead[e.S.F] < e.F || dead[e.S.S] < e.F) continue;
dead[e.S.F] = e.F;
dead[e.S.S] = e.F;
}
debg;
vector<int> ans = {};
for(int i = 1; i <= n; i++)
if(dead[i] == infi)
ans.pb(i);
for(auto e : ans){
cout << e << '\n';
}
}
signed main(){
//mispertion;
int t = 1;
//cin >> t;
while (t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3664kb
input:
2 675333810 792019962 W 851860476 960355168 W
output:
OK OK OK OK 1 2
result:
FAIL Unexpected end of file - token expected (/var/uoj_data/9161/1.ans)
Subtask #2:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 3640kb
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:
OK OK OK OK
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:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Runtime Error
Test #58:
score: 0
Runtime Error
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:
0%