Submission #1110757

# Submission time Handle Problem Language Result Execution time Memory
1110757 2024-11-10T11:32:20 Z Johan Infinite Race (EGOI24_infiniterace2) C++14
0 / 100
73 ms 14064 KB
#include <bits/stdc++.h>
using namespace std; 
# define int long long
void solve()
{
  map < int , int > mp;
  int n, q, mx = -1;
  bool flag = 0;
  cin >> n >> q;
  while(q--)
  {
    int x;
    cin >> x;
    if(x < 0)
    {
      mp[abs(x)]--;
      flag = 1;  
    }
    else
      mp[x]++;
  }
  for(int i = 1; i <= n; i++)
  {
    mx = max(mx, mp[i]);
  }
  if(!flag)
    mx--;
  if(mx < 0)
    mx = 0;
  cout << mx << endl;
}
signed main()
{   
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt = 1;
  // cin >> tt;
  while(tt--){
    solve();
  }
}   
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 11 ms 940 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 504 KB Output is correct
2 Correct 7 ms 848 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 73 ms 14064 KB Output is correct
6 Correct 41 ms 12880 KB Output is correct
7 Incorrect 9 ms 848 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Incorrect 1 ms 592 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 11 ms 940 KB Output isn't correct
5 Halted 0 ms 0 KB -