답안 #286976

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
286976 2020-08-31T08:20:46 Z tqbfjotld Intergalactic ship (IZhO19_xorsum) C++14
17 / 100
2000 ms 1536 KB
#include <bits/stdc++.h>
using namespace std;

///why not grab subtask

int orig[1005];
int l[100005];
int r[100005];
int v[100005];

int newv[1005];


int main(){
    int n;
    scanf("%d",&n);
    for (int x = 1; x<=n; x++){
        scanf("%d",&orig[x]);
    }
    int q;
    scanf("%d",&q);
    for (int x = 0; x<q; x++){
        scanf("%d%d%d",&l[x],&r[x],&v[x]);
    }
    long long ans = 0;
    for (int bitmask = 0; bitmask<(1<<q); bitmask++){
        for (int x = 1; x<=n; x++){
            newv[x] = orig[x];
        }
        for (int x = 0; x<q; x++){
            if (bitmask & (1<<x)){
                for (int y = l[x]; y<=r[x]; y++){
                    newv[y] ^= v[x];
                }
            }
        }
        long long something = 0;
        long long tans = 0;
        for (int x = 1; x<=n; x++){
            tans += newv[x]*newv[x]*x*(n-x+1);
            tans += 2*newv[x]*(n-x+1)*something;
            tans %= 1000000007LL;
            something += newv[x]*x;
            something %= 1000000007LL;
        }
        ans += tans;
        ans %= 1000000007LL;
    }
    printf("%lld",ans);
}

Compilation message

xorsum.cpp: In function 'int main()':
xorsum.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
xorsum.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |         scanf("%d",&orig[x]);
      |         ~~~~~^~~~~~~~~~~~~~~
xorsum.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |     scanf("%d",&q);
      |     ~~~~~^~~~~~~~~
xorsum.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |         scanf("%d%d%d",&l[x],&r[x],&v[x]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2050 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 357 ms 384 KB Output is correct
2 Correct 379 ms 384 KB Output is correct
3 Correct 357 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 357 ms 384 KB Output is correct
2 Correct 379 ms 384 KB Output is correct
3 Correct 357 ms 384 KB Output is correct
4 Incorrect 6 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 357 ms 384 KB Output is correct
10 Correct 379 ms 384 KB Output is correct
11 Correct 357 ms 384 KB Output is correct
12 Incorrect 15 ms 512 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 357 ms 384 KB Output is correct
10 Correct 379 ms 384 KB Output is correct
11 Correct 357 ms 384 KB Output is correct
12 Incorrect 6 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Incorrect 27 ms 1536 KB Output isn't correct
10 Halted 0 ms 0 KB -