이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define div /
#define ll long long
#define fore(i, l, r) for(int i=int(l); i<int(r); i++)
#define sz(a) int((a).size())
using namespace std;
const int INF = 1e9;
const int MX = 5e5 + 23;
const int MOD = 1000000007;
const int MAX_N = 5e5+23;
const int N = 1e6;
void solve() {
int n; cin >> n;
int x[n],y[n],destroyed[n+5];
memset(destroyed,0,sizeof destroyed);
char d[n];
fore(i,0,n)
cin >> x[i] >> y[i] >> d[i];
fore(korak,0,101) {
fore(i,0,n) {
if(destroyed[i])
continue;
if(d[i] == 'E')
x[i]++;
else if(d[i] == 'W')
x[i]--;
else if(d[i] == 'N')
y[i]--;
else
y[i]++;
}
fore(i,0,n) {
fore(j,0,n) {
if(i == j or (destroyed[i] and destroyed[i] < korak) or (destroyed[j] and destroyed[j] < korak))
continue;
if(x[i] == x[j] and y[i] == y[j]) {
destroyed[i] = korak;
destroyed[j] = korak;
}
}
}
}
fore(i,0,n)
if(!destroyed[i])
cout << i+1 << endl;
}
int main() {
ios::sync_with_stdio(false);
int t=1;
while(t--) solve();
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |