# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
660556 | 2022-11-22T09:41:27 Z | 600Mihnea | 사다리꼴 (balkan11_trapezoid) | C++17 | 1 ms | 212 KB |
bool home = 0; #include <bits/stdc++.h> using namespace std; const int MODULO = 30013; struct T { int a; int b; int c; int d; }; bool operator < (T first, T second) { return first.b < second.b; } int main() { if (home == 0) { freopen ("trapezoid.in", "r", stdin); freopen ("trapezoid.out", "w", stdout); } else { freopen ("input.txt", "r", stdin); } int n; cin >> n; vector<T> v(n); for (auto &it : v) { cin >> it.a >> it.b >> it.c >> it.d; } sort(v.begin(), v.end()); return 0; vector<int> dp(n, 0), ways(n, 0); for (int i = 0; i < n; i++) { dp[i] = 1; ways[i] = 1; for (int j = 0; j < i; j++) { if (v[j].b < v[i].a && v[j].d < v[i].c) { if (dp[j] + 1 > dp[i]) { dp[i] = dp[j] + 1; ways[i] = ways[j]; } else { if (dp[j] + 1 == dp[i]) { ways[i] = (ways[i] + ways[j]) % MODULO; } } } } } int mx = *max_element(dp.begin(), dp.end()), cnt = 0; for (int i = 0; i < n; i++) { if (dp[i] == mx) { cnt = (cnt + ways[i]) % MODULO; } } cout << mx << " " << cnt << "\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
15 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
16 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
17 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
18 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
19 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
20 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |