답안 #1095292

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1095292 2024-10-01T18:48:53 Z vjudge1 Infinite Race (EGOI24_infiniterace2) C++17
29 / 100
11 ms 2568 KB
#include <bits/stdc++.h>
#define ss second
#define pb push_back
#define mod 1000000007
#define N 200005
#define INF 1000000000000000005
#define pu push
#define ff first
#define pint pair<int,int>
 
typedef long long ll;
 
using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int t;
    cin>>t;
    bool take[n];
    int cnt[n],ans=0;
    set<int> st;
    memset(cnt,0,sizeof(cnt));
    memset(take,false,sizeof(take));
    while(t--)
    {
        int a;
        cin>>a;
        if(a>0)
        {
            if(take[a]&&(st.size()==0||st.count(a))){
                st.insert(a);
                cnt[a]++;
            }
            else if(st.count(a))
            {
                st.clear();
                st.insert(a);
            }
            else if(!take[a]){
                st.clear();
                take[a]=true;
            }
        }
        else{
            st.clear();
            take[-a]=false;
        }
    }
    for(int i=1;i<n;i++)
        ans=max(ans,cnt[i]);
    cout<<ans<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 10 ms 820 KB Output is correct
5 Correct 9 ms 860 KB Output is correct
6 Correct 9 ms 944 KB Output is correct
7 Correct 9 ms 856 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 7 ms 604 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 7 ms 860 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 9 ms 824 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 9 ms 860 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 7 ms 604 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 8 ms 824 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 11 ms 2568 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Incorrect 9 ms 604 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 10 ms 820 KB Output is correct
5 Correct 9 ms 860 KB Output is correct
6 Correct 9 ms 944 KB Output is correct
7 Correct 9 ms 856 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 7 ms 604 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 7 ms 860 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 9 ms 824 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 9 ms 860 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 7 ms 604 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 456 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 8 ms 824 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 11 ms 2568 KB Output is correct
26 Correct 1 ms 1372 KB Output is correct
27 Incorrect 9 ms 604 KB Output isn't correct
28 Halted 0 ms 0 KB -