Submission #498214

#TimeUsernameProblemLanguageResultExecution timeMemory
498214sireanu_vladHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
0 / 100
3076 ms332 KiB
#include <iostream> using namespace std; int mod = 1e9 + 7; int n, a[1001], q, res, s[100001][3]; void read() { cin >> n; for(int i = 1; i <= n; ++i) cin >> a[i]; cin >> q; for(int i = 1; i <= q; ++i) cin >> s[i][1] >> s[i][2] >> s[i][3]; } void sum() { for(int i = 1; i <= n; ++i) for(int j = i, p; j <= n; ++j) { p = 0; for(int k = i; k <= j; ++k) p = (p + a[k]) % mod; res = (res + (p*p%mod)) % mod; } } void up(int l, int r, int x) { for(int i = l; i <= r; ++i) a[i] ^= x; } void back(int k) { if(k == 0) sum(); if(k > 0) { up(s[k][1], s[k][2], s[k][3]); back(k - 1); up(s[k][1], s[k][2], s[k][3]); back(k - 1); } } int main() { read(); back(q); cout << res; return 0; }

Compilation message (stderr)

sortbooks.cpp: In function 'void back(int)':
sortbooks.cpp:41:5: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds]
   41 |   up(s[k][1], s[k][2], s[k][3]);
      |   ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
sortbooks.cpp:43:5: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds]
   43 |   up(s[k][1], s[k][2], s[k][3]);
      |   ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...