Submission #286976

#TimeUsernameProblemLanguageResultExecution timeMemory
286976tqbfjotldIntergalactic ship (IZhO19_xorsum)C++14
17 / 100
2050 ms1536 KiB
#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 (stderr)

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]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...