답안 #1111460

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1111460 2024-11-12T08:41:16 Z vjudge1 Teams (CEOI11_tea) C++17
0 / 100
207 ms 42812 KB
#include <bits/stdc++.h>
#define TASK "divteam"
#define IOSBASE true
#define INT_LIM (int) 2147483647
#define LL_LIM (long long) 9223372036854775807
#define ll long long
#define pii pair<int,int>
#define endl '\n'
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define BIT(i,x) (((i)>>(x))&1)
#define FOR(i,a,b) for(int i = (a); i<=(b); i++)
#define FORD(i,a,b) for(int i = (a); i>=(b); i--)
using namespace std;
///------------------------------------------///
int n;
pii a[1000005];
vector<int> ans[1000005];
int T = 0;

void inp()
{
    cin >> n;
    FOR(i, 1, n)
    {
        cin >> a[i].fi;
        a[i].se = i;
    }
    sort(a+1, a+1+n, greater<pii>());
}

void solve()
{
    int c = 0;
    FOR(i, 1, n)
    {
        if (c==0)
        {
            T++; c = a[i].fi;
        }
        ans[T].pb(a[i].se);
        c--;
    }
    if (c>0)
    {
        for (auto x:ans[T])
        {
            ans[T-1].pb(x);
        }
        T--;
    }
    cout << T << endl;
    FOR(i, 1, T)
    {
        cout << ans[i].size() << ' ';
        for (auto x:ans[i]) cout << x << ' ';
        cout << endl;
    }
}

signed main()
{
    ///--------------------------///
    if (IOSBASE)
    {
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    }
    if (fopen(TASK".INP","r")!=NULL)
    {
        freopen(TASK".INP","r",stdin);
        freopen(TASK".OUT","w",stdout);
    }
    ///--------------------------///

    int NTEST = 1;
    //cin >> NTEST;

    while (NTEST--)
    {
        inp();
        solve();
    }

    return 0;
}

///------------------------------------------///

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:72:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   72 |         freopen(TASK".INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
tea.cpp:73:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   73 |         freopen(TASK".OUT","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 25168 KB Output is correct
2 Correct 4 ms 25168 KB Output is correct
3 Incorrect 5 ms 25168 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 25168 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 25204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 25168 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 25168 KB Output is correct
2 Incorrect 5 ms 25208 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 26360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 26104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 154 ms 40008 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 207 ms 42724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 199 ms 42812 KB Output isn't correct
2 Halted 0 ms 0 KB -