71932024-01-03 11:54:28horvathabelKazamatacpp17Wrong answer 6/4037ms5800 KiB
#include <bits/stdc++.h>
using namespace std;
void solve(){
    int n;
    cin>>n;
    int x;
    cin>>x;
    int ans=0;
    vector<pair<bool,int>> help;
    help.resize(n+1,{0,0});
    int tol=n+1;
    if (x!=0){
        tol=x;
        ans+=n-abs((0-x)%n);
    }
    int rs=ans;
    bool streak=false;
    int cnt=0;
    int j=0;
    for (int i=1; i<n;i++){
        int kulcs;
        cin>>kulcs;
        kulcs+=rs;
        kulcs%=n;
        help[kulcs]={true,rs};
        if (streak){
            j++;
            if (j==cnt) streak=false;
        }
        else{
            if (!help[i].first && tol>i){
                ans++;
                rs++;
            }
            if(help[i].first){
                streak=true;
                cnt=rs-help[i].second;
                j=0;
            }
        }
    }
    cout<<ans;

}
int main()
{
    int t=1;
    //cin>>t;
    while (t--) solve();
}
SubtaskSumTestVerdictTimeMemory
base6/40
1Accepted0/03ms1808 KiB
2Wrong answer0/019ms2764 KiB
3Accepted2/23ms2144 KiB
4Accepted2/23ms2388 KiB
5Wrong answer0/23ms2632 KiB
6Accepted2/23ms2784 KiB
7Wrong answer0/23ms2852 KiB
8Wrong answer0/23ms2996 KiB
9Wrong answer0/23ms3012 KiB
10Wrong answer0/23ms2984 KiB
11Wrong answer0/237ms4528 KiB
12Wrong answer0/237ms4696 KiB
13Wrong answer0/237ms4952 KiB
14Wrong answer0/237ms5052 KiB
15Wrong answer0/237ms5136 KiB
16Wrong answer0/237ms5260 KiB
17Wrong answer0/237ms5344 KiB
18Wrong answer0/237ms5332 KiB
19Wrong answer0/237ms5568 KiB
20Wrong answer0/235ms5440 KiB
21Wrong answer0/235ms5800 KiB
22Wrong answer0/237ms5756 KiB