제출 #1134350

#제출 시각아이디문제언어결과실행 시간메모리
1134350saidponNaval battle (CEOI24_battle)C++20
12 / 100
3096 ms4972 KiB
#include <bits/stdc++.h>
#define nemeshay ios_base::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
#define int long long
#define sigma signed
#define pb push_back
#define fr first
#define sc second
#define pii pair<int, int>
using namespace std;
const int N = 1e6 + 2, inf = 1e18 + 7;
pair<pii, char> a[N];
int used[N];
sigma main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i].fr.fr >> a[i].fr.sc >> a[i].sc;
    int q = 200;
    while (q--) {
        for (int i = 0; i < n; i++) {
            if (used[i]) continue;
            if (a[i].sc == 'N') a[i].fr.sc--;
            else if (a[i].sc == 'S') a[i].fr.sc++;
            else if (a[i].sc == 'W') a[i].fr.fr--;
            else a[i].fr.fr++;
        }
        for (int i = 0; i < n; i++) {
            if (used[i]) continue;
            for (int j = i + 1; j < n; j++) {
                if (!used[j] && a[i].fr.fr == a[j].fr.fr && a[i].fr.sc == a[j].fr.sc) {
                    used[i] = 1, used[j] = 1;
                }
            }
        }
    }
    for (int i = 0; i < n; i++) if (!used[i]) cout << i + 1 << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...