# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
753834 | 2023-06-06T07:09:42 Z | Luca7 | Boat (APIO16_boat) | C++17 | 2000 ms | 468 KB |
#include <iostream> #include<vector> #pragma GCC optimize("O3","unroll-loops") using namespace std; #define limit 1000000007 typedef long long ll; //ifstream cin("data.in"); //ofstream cout("data.out"); struct School { ll a, b; }; vector<School> schools; ll res = 0; void solve(ll n, ll i,ll minn) { if (i == n) { res++; if (res == limit) res = 0; return; } solve(n, i + 1, minn); for (int j = max(minn, schools[i].a); j <= schools[i].b; j++) { solve(n, i + 1, j + 1); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); /*cout << "500\n"; for (int i = 0; i < 500; i++) { cout << "5 5\n"; } return 0;*/ ll i, j, nr, n,a,b; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b; schools.push_back({a,b}); } solve(n, 0, 0); res--; if (res == -1) { res = limit; } cout << res; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2090 ms | 468 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2090 ms | 468 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2056 ms | 340 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2090 ms | 468 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |