This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ll, ll> pll;
const int sz = 1e6;
ll crsm = 0, ret = 0;
int n;
int u[sz], v[sz];
void foo(int i) {
if (i == n) {
ret += ((crsm * crsm * crsm * crsm + 2 * crsm * crsm) % 5 + 1);
return;
}
else {
for (int val = u[i]; val <= v[i]; val++) {
crsm += val;
foo(i + 1);
crsm -= val;
}
}
}
int main() {
fast;
cin >> n;
foru(i, 0, n)cin >> u[i] >> v[i];
foo(0);
cout << ret << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |