답안 #520601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
520601 2022-01-30T09:53:18 Z kartel Cigle (COI21_cigle) C++14
0 / 100
63 ms 320 KB
#include <bits/stdc++.h>
//#include<ext/rope>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC target("avx2")


#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define F first
#define S second
#define pb push_back
#define sz(x) int(x.size())
#define el '\n'
#define all(x) x.begin(), x.end()

using namespace std;
//using namespace __gnu_pbds;
//using  namespace __gnu_cxx;

typedef long long ll;
typedef long double ld;
typedef short int si;
typedef unsigned long long ull;
//typedef tree <ll, null_type, less <ll> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
//    cerr.precision(7);
//    cerr << fixed;
    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    in("23.in");
//    in("input.txt");
//    out("output.txt");
//    clock_t start = clock();

    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(all(a));
    reverse(all(a));
    int ans = 0;
    for (int len = a[0]; len <= 100000; len++) {
        int cur = 0;
        int level = 0;
        int d = 0, mx = len;
        for (int i = 0; i < n; i++) {
            if (d + a[i] > mx) {
                mx = d;
                d = a[i];
                level++;
            } else {
                if (d && level) {
                    cur++;
                }
                d += a[i];
            }
        }
        if (cur == 7) {
            cout << len << el;
        }
        ans = max(ans, cur);
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -