Submission #336369

# Submission time Handle Problem Language Result Execution time Memory
336369 2020-12-15T05:44:26 Z juggernaut Intergalactic ship (IZhO19_xorsum) C++14
9 / 100
2000 ms 492 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[105],pref[105],q,l[15],r[15],val[15],mod=1e9+7;
void _xor(int mask){
    for(int i=0;i<q;i++)if(mask&(1<<i))for(int pos=l[i+1];pos<=r[i+1];pos++)a[pos]^=val[i+1];
}
ll sq(ll x){return (x*x)%mod;}
ll go(int mask){
    _xor(mask);
    ll res=0;
    for(int i=1;i<=n;i++)pref[i]=pref[i-1]+a[i];
    for(int i=1;i<=n;i++)
    for(int j=1;j<=i;j++)
        res=(res+sq(pref[i]-pref[j-1]))%mod;
    _xor(mask);
    return res;
}
int main(){
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
    scanf("%lld",&q);
    for(int i=1;i<=q;i++)scanf("%lld%lld%lld",&l[i],&r[i],&val[i]);
    ll ans=go(0);
    for(int mask=1;mask<(1<<q);mask++)ans=(ans+go(mask))%mod;
    cout<<ans;
}

Compilation message

xorsum.cpp: In function 'int main()':
xorsum.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   20 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
xorsum.cpp:21:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |     for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
      |                          ~~~~~^~~~~~~~~~~~~~
xorsum.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |     scanf("%lld",&q);
      |     ~~~~~^~~~~~~~~~~
xorsum.cpp:23:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |     for(int i=1;i<=q;i++)scanf("%lld%lld%lld",&l[i],&r[i],&val[i]);
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 56 ms 492 KB Output is correct
7 Correct 56 ms 364 KB Output is correct
8 Correct 57 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2080 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 56 ms 492 KB Output is correct
7 Correct 56 ms 364 KB Output is correct
8 Correct 57 ms 376 KB Output is correct
9 Incorrect 1 ms 364 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 56 ms 492 KB Output is correct
7 Correct 56 ms 364 KB Output is correct
8 Correct 57 ms 376 KB Output is correct
9 Incorrect 1 ms 364 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 56 ms 492 KB Output is correct
7 Correct 56 ms 364 KB Output is correct
8 Correct 57 ms 376 KB Output is correct
9 Execution timed out 2080 ms 364 KB Time limit exceeded
10 Halted 0 ms 0 KB -