QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#332040#1362. Bad Packingishmeal#WA 1ms3572kbC++14400b2024-02-19 06:28:532024-02-19 06:28:54

Judging History

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

  • [2024-02-19 06:28:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3572kb
  • [2024-02-19 06:28:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, m;
  cin >> n >> m;
  map<int, int> prev;
  long long cnt = 0;
  for (int i = 0; i < m; i++) {
    int s;
    cin >> s;

    cnt += n - 1;
    if (prev.count(s)) {
      cnt -= i - prev[s] - 1;
    } else {
      cnt -= i;
    }
    prev[s] = i;
    cout << cnt << "\n";
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 10
9
6
5
7

output:

3
5
6
6
9
12
15
18
21
24

result:

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