답안 #229993

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
229993 2020-05-07T14:22:13 Z osaaateiasavtnl Zoltan (COCI16_zoltan) C++14
14 / 140
1000 ms 2808 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 2e5 + 7, MOD = 1000 * 1000 * 1000 + 7;
int len[N], cnt[N], a[N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    for (int i = 1; i <= n; ++i) {
        len[i] = 1;
        cnt[i] = 1;
        for (int j = 1; j < i; ++j) {
            if (a[j] < a[i]) {
                if (len[j] + 1 > len[i]) {
                    len[i] = len[j] + 1;
                    cnt[i] = cnt[j];
                }   
                else if (len[j] + 1 == len[i]) {
                    cnt[i] = (cnt[i] + cnt[j]) % MOD;
                }   
            }   
        }   
    }   
    cout << len[n] << ' ' << cnt[n] << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Incorrect 4 ms 384 KB Output isn't correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Incorrect 4 ms 384 KB Output isn't correct
7 Incorrect 6 ms 384 KB Output isn't correct
8 Incorrect 6 ms 384 KB Output isn't correct
9 Incorrect 6 ms 384 KB Output isn't correct
10 Incorrect 6 ms 256 KB Output isn't correct
11 Execution timed out 1093 ms 2552 KB Time limit exceeded
12 Execution timed out 1093 ms 2296 KB Time limit exceeded
13 Execution timed out 1083 ms 2424 KB Time limit exceeded
14 Execution timed out 1091 ms 2168 KB Time limit exceeded
15 Execution timed out 1095 ms 2296 KB Time limit exceeded
16 Execution timed out 1092 ms 2712 KB Time limit exceeded
17 Execution timed out 1082 ms 2808 KB Time limit exceeded
18 Execution timed out 1094 ms 2684 KB Time limit exceeded
19 Execution timed out 1099 ms 2660 KB Time limit exceeded
20 Execution timed out 1093 ms 2760 KB Time limit exceeded