제출 #1170529

#제출 시각아이디문제언어결과실행 시간메모리
1170529lopkusInfinite Race (EGOI24_infiniterace2)C++20
29 / 100
1095 ms1096 KiB
#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, q;
  std::cin >> n >> q;
  std::vector<int> a(q + 1);
  for(int i = 1; i <= q; i++) {
    std::cin >> a[i];
  }
  int ans = 0;
  for(int i = 1; i < n; i++) {
    std::map<int,int> was;
    int c = 0;
    for(int j = 1; j <= q; j++) {
      //std::cout << i << " " << j << " " << was[i] << "\n";
      if(a[j] == i) {
        if(was[i]) {
          c += 1;
        }
        was[i] = 1;
      }
      if(a[j] == - i) {
        was[i] = 0;
      }
    }
    ans = std::max(ans, c);
  }
  std::cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...