Submission #335945

# Submission time Handle Problem Language Result Execution time Memory
335945 2020-12-14T11:09:58 Z beksultan04 Intergalactic ship (IZhO19_xorsum) C++14
0 / 100
2000 ms 1900 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define OK puts("OK");
#define fr first
#define sc second
#define ret return
#define scan1(a) scanf("%lld",&a);
#define scan2(a,b) scanf("%lld %lld",&a, &b);
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define pb push_back
#define endi puts("");
const int N = 1e6+12,INF=1e9+7;
int q[N],der[4*N],a[N];
main(){
    int n,i,j,ans=0;
    scan1(n)
    for (i=1;i<=n;++i){
        scan1(q[i])
    }
    for (i=1;i<=n;++i){
        int sum=0;
        for (j=i;j<=n;++j){
            sum+=q[j];
            ans+=sum*sum%INF;
            ans%=INF;
        }
    }
    int t,k;
    scan1(t)
    k=t;
    vector <int> v;
    while (t--){
        int l,r,x;
        scan3(l,r,x)
        for (i=1;i<=n;++i){
            a[i] = q[i];
            if (l<=i && i<=r)a[i]^=x;
        }
        int aaa=0;
        for (i=1;i<=n;++i){
            int sum=0;
            for (j=i;j<=n;++j){
                sum+=a[j];
                sum%=INF;
                aaa+=sum*sum%INF;
            }
        }
        v.pb(aaa);
    }
    for (i=0;i<=(1<<k);++i){
        for(j=0;j<k;j++){
            if(i&(1<<j)){
                ans+=v[j]%INF;
                ans%=INF;
            }
        }
    }

    cout <<ans%INF;
}

Compilation message

xorsum.cpp:17:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      |      ^
xorsum.cpp: In function 'int main()':
xorsum.cpp:9:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 | #define scan1(a) scanf("%lld",&a);
      |                  ~~~~~^~~~~~~~~~~
xorsum.cpp:19:5: note: in expansion of macro 'scan1'
   19 |     scan1(n)
      |     ^~~~~
xorsum.cpp:9:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 | #define scan1(a) scanf("%lld",&a);
      |                  ~~~~~^~~~~~~~~~~
xorsum.cpp:21:9: note: in expansion of macro 'scan1'
   21 |         scan1(q[i])
      |         ^~~~~
xorsum.cpp:9:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 | #define scan1(a) scanf("%lld",&a);
      |                  ~~~~~^~~~~~~~~~~
xorsum.cpp:32:5: note: in expansion of macro 'scan1'
   32 |     scan1(t)
      |     ^~~~~
xorsum.cpp:11:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 | #define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
xorsum.cpp:37:9: note: in expansion of macro 'scan3'
   37 |         scan3(l,r,x)
      |         ^~~~~
# 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 Incorrect 1 ms 364 KB Output isn't correct
4 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 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2073 ms 1900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2071 ms 400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 492 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 Incorrect 1 ms 364 KB Output isn't correct
4 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 Incorrect 1 ms 364 KB Output isn't correct
4 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 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -