Submission #1128218

#TimeUsernameProblemLanguageResultExecution timeMemory
1128218jj_masterFish 3 (JOI24_fish3)C++20
Compilation error
0 ms0 KiB
// JOI 2023 - 2024 #include <bits/stdc++.h> using namespace std; #define int long long int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,d; cin >> n >> d; vector<int> arr(n+1); for(int i=1;i<=n;i++)cin>>arr[i]; int q; cin >> q; for(int i=1;i<=q;i++){ int l,r;cin>>l>>r; vector<int> curr(n+1); for(int x=l;x<=r;x++){ curr[x] = curr[x-1]+((d+(arr[x]%d)-(curr[x-1]%d))%d); } int uses = 1e15; int ans = 0; bool works = true; for(int x=r;x>=l;x--){ int req = (arr[x]-curr[x])/d; if(req<0)works=false; uses = min(uses,req); ans+=req-uses; } if(works)cout<<ans<<'\n'; else cout << "-1" '\n'; } }

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:32:34: error: expected ';' before '\xa'
   32 |                 else cout << "-1" '\n';
      |                                  ^~~~~
      |                                  ;