Submission #264044

# Submission time Handle Problem Language Result Execution time Memory
264044 2020-08-14T04:52:34 Z 문홍윤(#5092) Teams (CEOI11_tea) C++17
0 / 100
500 ms 80632 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef pair<int, int> pii;
const int inf=1e9;

int n, dp[1000010], fr[1000010];
pii arr[1000010];
vector<int> vc[1000010];

struct FENWICK{
    pii tree[1000010];
    pii qu(int i){
        if(i<0)return mp(-inf, -inf);
        pii ans=mp(0, 0);
        while(i){
            ans=max(ans, tree[i]);
            i-=(i&-i);
        }
        return ans;
    }
    void upd(int i, pii num){
        while(i<=1000000){
            tree[i]=max(tree[i], num);
            i+=(i&-i);
        }
    }
}fen;

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        scanf("%d", &arr[i].F);
        arr[i].S=i;
    }
    sort(arr+1, arr+n+1);
    for(int i=1; i<=n; i++){
        for(auto j:vc[i])fen.upd(j, mp(dp[j], j));
        pii tmp=fen.qu(i-arr[i].F);
        fr[i]=tmp.S;
        dp[i]=tmp.F+1;
        if(2*i-fr[i]<=n)vc[2*i-fr[i]].eb(i);
    }
    vector<vector<int> > ans;
    int nw=n;
    while(nw){
        vector<int> tmp;
        for(int i=nw; i>fr[nw]; i--)tmp.eb(arr[i].S);
        ans.eb(tmp);
        nw=fr[nw];
    }
    for(auto i:ans){
        printf("%d ", i.size());
        for(auto j:i)printf("%d ", j);
        puts("");
    }
}

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:56:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   56 |         printf("%d ", i.size());
      |                 ~^    ~~~~~~~~
      |                  |          |
      |                  int        std::vector<int>::size_type {aka long unsigned int}
      |                 %ld
tea.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   34 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
tea.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   36 |         scanf("%d", &arr[i].F);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 23808 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 23840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 23936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 24064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 24064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 27500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 28536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 383 ms 72232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 500 ms 80632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 425 ms 56016 KB Output isn't correct
2 Halted 0 ms 0 KB -