77392024-01-10 20:09:24horvathabelKazamatacsharpCompilation error
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> room;
    vector<bool> have;
    have.resize(n+1,0);
    set<int> keys;
    for (int i=0; i<n;i++){
        int x;
        cin>>x;
        room.push_back(x);
    }
    int ans=0;
    for (int i=0; i<n;i++){
        int nowkey=room[i]+ans;
        nowkey%=n;
        keys.insert(room[i]);
        have[nowkey]=true;
        while (!have[i]){
            ans++;
            for (int x:keys){
                have[(x+ans)%n]=true;
            }
        }
    }
    cout<<ans<<endl;

}
Compilation error
exit status 1
main.cs(2,0): error CS1024: Wrong preproces