답안 #264033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
264033 2020-08-14T04:50:36 Z 문홍윤(#5092) Teams (CEOI11_tea) C++17
컴파일 오류
0 ms 0 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 update(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:41:30: error: 'struct FENWICK' has no member named 'upd'
   41 |         for(auto j:vc[i])fen.upd(j, mp(dp[j], j));
      |                              ^~~
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);
      |         ~~~~~^~~~~~~~~~~~~~~~~