QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#249948 | #4704. Wall Clocks | Jeffrey | WA | 0ms | 3384kb | C++14 | 1.7kb | 2023-11-12 18:27:39 | 2023-11-12 18:27:40 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;
bool cmp(pii a, pii b) {
if (a.second != b.second) return a.second < b.second;
return a.first < b.first;
}
int main() {
int n, w, d, z = 1003;
pii a[2023] = {};
cin >> n >> w >> d;
for (int i = 1; i <= n; i++) {
int x, y;
char f;
cin >> x >> y >> f;
if (f == 'N') {
a[i].first = x + y;
a[i].second = x - y + d + d;
} else if (f == 'E') {
a[i].first = x - y + d + d;
a[i].second = d + d + w + w - x - y;
} else if (f == 'S') {
a[i].first = d + d + w + w - x - y;
a[i].second = d + d + w + w - x + y;
} else {
a[i].first = d + d + w + w - x + y;
a[i].second = d + d + w + w + x + y;
}
//cout << a[i].first << ' ' << a[i].second << '\n';
swap(a[i].first, a[i].second);
}
sort(a + 1, a + n + 1);
for (int i = n + 1; i <= n + n; i++) a[i].first = a[i - n].first + d + d + w + w, a[i].second = a[i - n].second + d + d + w + w;
//for (int i = 1; i <= n + n; i++) cout << a[i].second << ' ' << a[i].first << '\n';
for (int i = 1; i <= n; i++) {
int l = a[i].first, c = 1, l0 = l;
//cout << l << ' ';
for (int j = i + 1; j < i + n; j++) {
if (a[j].second > l && a[j].first < l0 + d + d + w + w) l = a[j].first, c++;//, cout << l << ' ';
}
//cout << c << '\n';
z = min(z, c);
}
cout << z << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3384kb
input:
100 11 11 4 1 N 7 5 E 10 1 E 6 1 E 7 3 N 10 5 S 5 5 S 4 6 W 9 9 E 4 4 W 8 8 W 6 9 N 6 7 W 5 1 N 10 3 S 2 8 S 6 8 S 10 7 E 7 9 E 1 10 S 9 5 N 3 8 W 4 9 S 5 3 E 2 6 E 5 6 W 8 9 N 10 10 W 1 6 S 3 4 N 6 10 E 8 7 S 8 2 W 10 8 N 2 5 N 10 2 N 7 4 E 1 7 N 2 9 S 3 10 N 6 3 S 2 7 E 5 4 E 4 8 N 7 8 N 4 2 N 9 3...
output:
7
result:
wrong answer 1st lines differ - expected: '8', found: '7'