Submission #905737

# Submission time Handle Problem Language Result Execution time Memory
905737 2024-01-13T04:31:33 Z vjudge1 Intergalactic ship (IZhO19_xorsum) C++17
0 / 100
2000 ms 2648 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
long double rnd(){return (long double)(rand()/RAND_MAX);}
main(){
    srand(time(NULL));
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    int q;
    cin>>q;
    int l[q+1],r[q+1],x[q+1];
    for(int i=1;i<=q;i++){
        cin>>l[i]>>r[i]>>x[i];
    }
    int to=0;
    for(int j=0;j<(1<<q);j++){
        int b[n+1];
        for(int i=1;i<=n;i++){
            b[i]=a[i];
        }
        for(int i=0;i<q;i++){
            if((j>>i)&1){
                for(int j=l[i+1];j<=r[i+1];j++){
                    b[j]^=x[i+1];
                }
            }
        }
        int ans=0;
        for(int i=1;i<=n;i++){
            int sum=0;
            for(int j=i;j<=n;j++){
                sum+=a[j];
                sum%=1000000007;
                ans+=sum*sum;
                ans%=1000000007;
            }
        }
        to+=ans;
        to%=1000000007;
    }
    cout<<to<<endl;
}

Compilation message

xorsum.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2025 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1983 ms 428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1983 ms 428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -