답안 #335944

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
335944 2020-12-14T11:09:01 Z beksultan04 Intergalactic ship (IZhO19_xorsum) C++14
0 / 100
1381 ms 1508 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;
        }
    }
    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];
                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;
            }
        }
    }

    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:31:5: note: in expansion of macro 'scan1'
   31 |     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:36:9: note: in expansion of macro 'scan3'
   36 |         scan3(l,r,x)
      |         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 916 ms 1508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1381 ms 532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 76 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 76 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -