#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define pb push_back
#define mp make_pair
#define rept(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define vec vector
#define all(x) (x).begin(), (x).end()
#define fs first
#define sc second
#define sum(x) (x).fs + (x).sc
#define diff(x) (x).fs - (x).sc
typedef long long ll;
typedef vec<int> vi;
typedef vec<vi> v2i;
typedef pair<int, int> pi;
typedef vec<pi> vpi;
typedef vec<bool> vb;
//sub 1 to 5
bool collides(pi c1, pi c2, char d1, char d2) {
if (d1==d2) return false;
if (d1>d2) {
swap(d1,d2);
swap(c1,c2);
} // order: e, n, s, w
if (d1=='E' && d2=='N') return c1.first < c2.first && (c2.first-c2.second == c1.first-c1.second);
if (d1=='E' && d2=='S') return c1.first < c2.first && (c2.first+c2.second == c1.first+c1.second);
if (d1=='E' && d2=='W') return c1.second = c2.second && c1.first < c2.first;
if (d1=='N' && d2=='S') return c1.first = c2.first && c1.second > c2.second;
if (d1=='N' && d2=='W') return c1.fs < c2.fs && (sum(c1) == sum(c2));
if (d1=='S' && d2=='W') return c1.fs < c2.fs && (diff(c1)==diff(c2));
exit(1);
}
void sub1(int n) {
vpi c(n);
vec<char> d(n);
rep(i,n) {
cin >> c[i].first >> c[i].second >> d[i];
}
if (!collides(c[0], c[1], d[0], d[1])) {
cout << "1 2\n";
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
if (n==2) sub1(n);
return 0;
}
# | 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... |