답안 #170289

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170289 2019-12-24T13:20:49 Z rzbt 케이크 (CEOI14_cake) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define MAXN 250005
using namespace std;

int n,a;
int niz[MAXN];

int seg[4*MAXN];
int lazy[4*MAXN];
set<pair<int,int> > svi[MAXN];


void dodaj(int l,int d,int p,int x,int k){
    if(l==d){
        seg[k]=p;
        return;
    }
    int mid=(l+d)/2;
    if(p<=mid)return dodaj(l,mid,p,x,k+k);
    else dodaj(mid+1,d,p,x,k+k+1);
    seg[k]=max(seg[k+k],seg[k+k+1]);
}
int dobij(int l,int d,int tl,int td,int k){
    if(l>td || d<tl)return 0;
    if(l>=tl && d<=td)return seg[k];
    int mid=(l+d)/2;
    return max(dobij(l,mid,tl,td,k+k),dobij(mid+1,d,tl,td,k+k+1));
}

void izgradi(int l,int d,int k){
    if(l==d){
        seg[k]=niz[l];
        return;
    }
    int mid=(l+d)/2;
    izgradi(l,mid,k+k);
    izgradi(l,mid,k+k);
    seg[k]=max(seg[k],seg[k+k+1]);
}


int main()///PROMENI U LONG LONG
{
    scanf("%d %d", &n, &a);
    for(int i=1;i<=n;i++){
        scanf("%d",niz+i);
        niz[i]*=500005;
        svi.insert(mp(niz[i],i));
    }
    int qq;
    scanf("%d", &qq);
    while(qq--){
        char qt[5];
        scanf("%s", qt);
        if(qt[0]=='E'){
            int koji,postaje;
            scanf("%d %d", &koji, &postaje);
            svi.erase(mp(niz[koji],koji));
            auto it=svi.back();

        }
    }

    return 0;
}

Compilation message

cake.cpp: In function 'int main()':
cake.cpp:51:13: error: request for member 'insert' in 'svi', which is of non-class type 'std::set<std::pair<int, int> > [250005]'
         svi.insert(mp(niz[i],i));
             ^~~~~~
cake.cpp:61:17: error: request for member 'erase' in 'svi', which is of non-class type 'std::set<std::pair<int, int> > [250005]'
             svi.erase(mp(niz[koji],koji));
                 ^~~~~
cake.cpp:62:25: error: request for member 'back' in 'svi', which is of non-class type 'std::set<std::pair<int, int> > [250005]'
             auto it=svi.back();
                         ^~~~
cake.cpp:47:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &a);
     ~~~~~^~~~~~~~~~~~~~~~~
cake.cpp:49:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",niz+i);
         ~~~~~^~~~~~~~~~~~
cake.cpp:54:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &qq);
     ~~~~~^~~~~~~~~~~
cake.cpp:57:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", qt);
         ~~~~~^~~~~~~~~~
cake.cpp:60:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d %d", &koji, &postaje);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~