QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#510919#7841. Boat CommuterheganhefeishuiWA 7ms3544kbC++14882b2024-08-09 14:04:502024-08-09 14:04:50

Judging History

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

  • [2024-08-09 14:04:50]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3544kb
  • [2024-08-09 14:04:50]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define ll long long
#define PII std::pair<int,int>
using namespace std;
const int maxn = 1e5 + 5;
bool vis[maxn];
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(2);
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> A(m + 1);
    vector<int> ans(m + 1);
    for (int i = 1; i <= k; ++i) {
        int a, b;
        cin >> a >> b;
        if (A[b]) {
            if (a == A[b])vis[b]=0,ans[b]+=100,A[b]=0;
            else {
                ans[b]+=abs(a- A[b]);
                A[b] = 0;
                vis[b] = 0;
            }
        }
        else A[b] = a,vis[b]=1;
    }
    for (int i = 1; i <= n; ++i) {
        if(vis[i])cout << ans[i]+100<< " ";
        else cout << ans[i]<< " ";
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

3 3 5
1 1
1 2
1 2
3 1
2 3

output:

2 100 100 

result:

ok single line: '2 100 100 '

Test #2:

score: -100
Wrong Answer
time: 7ms
memory: 3544kb

input:

50 10 100000
16 6
7 1
18 1
39 3
30 3
27 5
27 1
25 8
8 4
30 5
48 10
20 1
25 9
40 1
1 8
15 6
24 5
49 9
46 1
42 8
35 4
47 4
28 6
16 7
46 9
30 9
32 8
8 7
40 5
29 10
48 6
42 2
25 8
16 5
41 6
23 7
40 10
33 9
50 8
13 9
41 3
27 5
38 6
7 3
46 10
26 4
33 5
31 9
27 7
50 10
37 5
9 6
30 2
7 8
27 4
20 9
25 4
47 9...

output:

94844 94854 93814 91551 95910 91226 92395 94770 92170 93178 101441 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

wrong answer 1st lines differ - expected: '94844 94854 93814 91551 95910 91226 92395 94770 92170 93178', found: '94844 94854 93814 91551 95910 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '