# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
216523 | 2020-03-27T12:52:33 Z | vonatlus | Trol (COCI19_trol) | C++14 | 1000 ms | 384 KB |
/// wa ^3^ #pragma GCC optimize("O3") #include<bits/stdc++.h> #define x first #define y second #define pb push_back #define sz(x) (int) x.size() using namespace std; using ll = long long; using pii = pair<int, int>; const int MOD = 1e9 + 7; const int INF32 = 1e9 + 1e2; template<typename T> istream &operator>>(istream &a, vector<T> &v) { for (auto& x : v) a >> x; return a; } void stndrtn() { #ifdef accepted freopen(".in", "r", stdin); #endif } const bool flag = 0; int f(ll x) { int sum = 0; for (; x; x /= 10ll) sum += x%10; if (sum > 9) sum = f(sum); return sum; } void maincode() { int q; cin >> q; for (ll l, r; q--;) { cin >> l >> r; int sum = 0; for (ll i = l; i <= r; ++i) sum += f(i); cout << sum << "\n"; } } int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr), stndrtn(); int ts = 1; if (flag) cin >> ts; while (ts--) maincode(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 7 ms | 384 KB | Output is correct |
4 | Execution timed out | 1080 ms | 384 KB | Time limit exceeded |
5 | Execution timed out | 1092 ms | 384 KB | Time limit exceeded |