Submission #789462

# Submission time Handle Problem Language Result Execution time Memory
789462 2023-07-21T12:13:58 Z Trisanu_Das Martian DNA (BOI18_dna) C++17
0 / 100
84 ms 4684 KB
#include <bits/stdc++.h>
using namespace std;
 
int x;
 
int main(){
  int n, k, cnt; cin >> n >> k >> cnt;
  int a[n + 1], b[n + 1], ccnt[n + 1]; memset(ccnt, 0, sizeof(ccnt));
  for(int i = 1; i < n + 1; i++) cin >> a[i];
  for(int i = 1; i < cnt + 1; i++){
    cin >> x; cin >> b[x];
  }
  int l = 1, r = 0, ans = INT_MAX;
  while(r < n + 1){
    if(cnt){
      r++; ccnt[a[r]]++;
      if(ccnt[a[r]] == b[a[r]]) cnt--;
    }else{
      ans = min(ans, r - l + 1);
      if(ccnt[a[l]] == b[a[l]]) cnt++;
      ccnt[a[l]]--; l++;
    }
  }
  if(ans == INT_MAX) cout << "impossible\n";
  else cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 304 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 3008 KB Output is correct
2 Correct 25 ms 3000 KB Output is correct
3 Correct 25 ms 3008 KB Output is correct
4 Correct 27 ms 3008 KB Output is correct
5 Correct 45 ms 3756 KB Output is correct
6 Correct 22 ms 3028 KB Output is correct
7 Correct 30 ms 3132 KB Output is correct
8 Correct 42 ms 3900 KB Output is correct
9 Correct 36 ms 3568 KB Output is correct
10 Correct 25 ms 3004 KB Output is correct
11 Runtime error 1 ms 432 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 84 ms 4284 KB Output is correct
2 Correct 61 ms 4140 KB Output is correct
3 Correct 46 ms 3892 KB Output is correct
4 Correct 35 ms 3028 KB Output is correct
5 Correct 73 ms 4684 KB Output is correct
6 Correct 73 ms 4648 KB Output is correct
7 Correct 37 ms 3512 KB Output is correct
8 Correct 42 ms 3768 KB Output is correct
9 Correct 22 ms 3008 KB Output is correct
10 Correct 27 ms 3116 KB Output is correct
11 Correct 24 ms 2996 KB Output is correct
12 Correct 23 ms 3028 KB Output is correct
13 Correct 39 ms 3768 KB Output is correct
14 Correct 21 ms 3032 KB Output is correct
15 Correct 26 ms 3156 KB Output is correct
16 Correct 42 ms 3768 KB Output is correct
17 Correct 36 ms 3576 KB Output is correct
18 Correct 22 ms 3004 KB Output is correct
19 Runtime error 1 ms 468 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -