Submission #371154

# Submission time Handle Problem Language Result Execution time Memory
371154 2021-02-26T01:44:39 Z daniel920712 Intergalactic ship (IZhO19_xorsum) C++14
17 / 100
2000 ms 5740 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
long long all[200005];
pair < pair < long long , long long > , long long > tt[200005];
long long ans=0,N,M,MOD=1e9+7;
void F(long long here)
{
    long long i,j,t;
    if(here==M)
    {
        t=0;
        for(i=1;i<=N;i++)
        {
            t+=2*all[i]*(N-i+1)%MOD;
            t%=MOD;
        }
        for(i=1;i<=N;i++)
        {
            ans+=all[i]*all[i]*i*(N-i+1);
            ans%=MOD;
            t-=2*all[i]*(N-i+1)%MOD;
            t+=MOD;
            t%=MOD;
            ans+=all[i]*i*t%MOD;
            ans%=MOD;


        }
        return;
    }
    F(here+1);
    for(i=tt[here].first.first;i<=tt[here].first.second;i++) all[i]^=tt[here].second;
    F(here+1);
    for(i=tt[here].first.first;i<=tt[here].first.second;i++) all[i]^=tt[here].second;
}
int main()
{
    long long i;
    scanf("%lld",&N);
    for(i=1;i<=N;i++) scanf("%lld",&all[i]);
    scanf("%lld",&M);
    //printf("%lld\n",M);
    for(i=0;i<M;i++) scanf("%lld %lld %lld",&tt[i].first.first,&tt[i].first.second,&tt[i].second);
    F(0);
    printf("%lld\n",ans);
    return 0;
}

Compilation message

xorsum.cpp: In function 'void F(long long int)':
xorsum.cpp:11:17: warning: unused variable 'j' [-Wunused-variable]
   11 |     long long i,j,t;
      |                 ^
xorsum.cpp: In function 'int main()':
xorsum.cpp:42:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   42 |     scanf("%lld",&N);
      |     ~~~~~^~~~~~~~~~~
xorsum.cpp:43:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   43 |     for(i=1;i<=N;i++) scanf("%lld",&all[i]);
      |                       ~~~~~^~~~~~~~~~~~~~~~
xorsum.cpp:44:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   44 |     scanf("%lld",&M);
      |     ~~~~~^~~~~~~~~~~
xorsum.cpp:46:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   46 |     for(i=0;i<M;i++) scanf("%lld %lld %lld",&tt[i].first.first,&tt[i].first.second,&tt[i].second);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 5 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2089 ms 5740 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2085 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1180 ms 384 KB Output is correct
2 Correct 1176 ms 492 KB Output is correct
3 Correct 1178 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1180 ms 384 KB Output is correct
2 Correct 1176 ms 492 KB Output is correct
3 Correct 1178 ms 492 KB Output is correct
4 Execution timed out 2092 ms 620 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 5 ms 364 KB Output is correct
9 Correct 1180 ms 384 KB Output is correct
10 Correct 1176 ms 492 KB Output is correct
11 Correct 1178 ms 492 KB Output is correct
12 Execution timed out 2085 ms 364 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 5 ms 364 KB Output is correct
9 Correct 1180 ms 384 KB Output is correct
10 Correct 1176 ms 492 KB Output is correct
11 Correct 1178 ms 492 KB Output is correct
12 Execution timed out 2092 ms 620 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 5 ms 364 KB Output is correct
9 Execution timed out 2089 ms 5740 KB Time limit exceeded
10 Halted 0 ms 0 KB -