Submission #1338084

#TimeUsernameProblemLanguageResultExecution timeMemory
1338084KhoaDuySum Zero (RMI20_sumzero)C++20
0 / 100
1 ms344 KiB
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const int STLG=7,MAXN=4e5+10,MAXLG=19;
int lift[MAXLG-STLG][MAXN+2];
int nxt[MAXN+2];
signed main(){
    if(fopen("input.txt","r")){
        freopen("input.txt","r",stdin);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // int n;
    // cin >> n;
    // int c[n];
    // ll sum=0;
    // for(int i=0;i<n;i++){
    //     cin >> c[i];
    //     sum+=c[i];
    // }
    // map<ll,int> mp;
    // nxt[n]=n+1,nxt[n+1]=n+1;
    // for(int l=n-1;l>=0;l--){
    //     mp[sum]=l;
    //     sum-=c[l];
    //     if(mp.find(sum)==mp.end()){
    //         nxt[l]=n+1;
    //     }
    //     else{
    //         nxt[l]=mp[sum]+1;
    //     }
    // }
    // for(int i=n;i>=0;i--){
    //     nxt[i]=min(nxt[i],nxt[i+1]);
    // }
    // // for(int i=0;i<=n;i++){
    // //     cout << i << ' ' << nxt[i] << endl;
    // // }
    // for(int i=0;i<=n+1;i++){
    //     lift[0][i]=i;
    //     for(int bruh=0;bruh<(1<<STLG);bruh++){
    //         lift[0][i]=nxt[lift[0][i]];
    //     }
    // }
    // for(int i=1;i<MAXLG-STLG;i++){
    //     for(int j=0;j<=n+1;j++){
    //         lift[i][j]=lift[i-1][lift[i-1][j]];
    //     }
    // }
    // int q;
    // cin >> q;
    // while(q--){
    //     int l,r;
    //     cin >> l >> r;
    //     l--,r--;
    //     int ans=0;
    //     for(int i=MAXLG-STLG-1;i>=0;i--){
    //         if(lift[i][l]<=r+1){
    //             l=lift[i][l];
    //             ans+=(1<<(i+STLG));
    //         }
    //     }
    //     for(int i=0;i<(1<<STLG);i++){
    //         if(nxt[l]<=r+1){
    //             l=nxt[l];
    //             ans++;
    //         }
    //         else{
    //             break; 
    //         }
    //     }
    //     cout << ans << endl;
    // }
}

Compilation message (stderr)

sumzero.cpp: In function 'int main()':
sumzero.cpp:10:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         freopen("input.txt","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...