QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#249935#4704. Wall ClocksJeffreyWA 1ms3412kbC++141.7kb2023-11-12 18:15:072023-11-12 18:15:07

Judging History

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

  • [2023-11-12 18:15:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3412kb
  • [2023-11-12 18:15:07]
  • 提交

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].second, 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';
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3412kb

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:

12 14
13 15
8 16
6 18
12 18
7 19
9 19
15 19
6 20
8 20
7 21
15 21
17 21
3 23
7 23
6 24
18 24
5 25
13 25
15 25
6 26
10 26
14 26
22 26
25 27
8 28
12 28
18 28
20 28
26 28
11 29
12 30
27 31
20 32
24 32
19 33
23 33
25 33
27 33
31 33
18 34
17 35
23 35
27 35
18 36
24 36
25 37
27 37
31 37
35 37
19 39
23 39
2...

result:

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