Submission #1037342

#TimeUsernameProblemLanguageResultExecution timeMemory
1037342AlfraganusIntergalactic ship (IZhO19_xorsum)C++17
0 / 100
2041 ms8220 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define str string #define fastio ios::sync_with_stdio(0), cin.tie(0); #define fs first #define ss second #define endl '\n' #define all(x) (x).begin(), (x).end() #define len(x) x.size() #define print(a) \ for (auto &x : a) \ cout << x << " "; \ cout << endl; #define printmp(a) \ for (auto &x : a) \ cout << x.fs << " " << x.ss << endl; const int mod = 1e9 + 7; vector<int> a; vector<array<int, 3>> S; int ans = 0; void dfs(int p){ for(int i = 0; i < a.size(); i ++){ int sum = 0; for(int j = i; j < a.size(); j ++){ sum += a[j]; sum %= mod; ans = (ans + sum * sum) % mod; } } for(int j = p; j < S.size(); j ++){ for(int x = S[p][0] - 1; x < S[p][1]; x ++) a[x] ^= S[p][2]; dfs(j + 1); for(int x = S[p][0] - 1; x < S[p][1]; x ++) a[x] ^= S[p][2]; } } void solve(){ int n; cin >> n; a.resize(n); for(int i = 0; i < n; i ++) cin >> a[i]; int q; cin >> q; S.resize(q); for(int i = 0; i < q; i ++) cin >> S[i][0] >> S[i][1] >> S[i][2]; dfs(0); cout << ans; } signed main() { fastio; #ifdef Javohir freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int t = 1; // cin >> t; while (t--) { solve(); cout << endl; } }

Compilation message (stderr)

xorsum.cpp: In function 'void dfs(long long int)':
xorsum.cpp:29:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i = 0; i < a.size(); i ++){
      |                    ~~^~~~~~~~~~
xorsum.cpp:31:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(int j = i; j < a.size(); j ++){
      |                        ~~^~~~~~~~~~
xorsum.cpp:37:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int j = p; j < S.size(); j ++){
      |                    ~~^~~~~~~~~~
#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...