QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#249949#4704. Wall ClocksJeffreyWA 0ms3712kbC++141.7kb2023-11-12 18:28:342023-11-12 18:28:36

Judging History

你现在查看的是最新测评结果

  • [2023-11-12 18:28:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3712kb
  • [2023-11-12 18:28:34]
  • 提交

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, cmp);
    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: 3712kb

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:

3

result:

wrong answer 1st lines differ - expected: '8', found: '3'