Submission #307767

#TimeUsernameProblemLanguageResultExecution timeMemory
307767juggernautGondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include"gondola.h"
#include<bits/stdc++.h>
//#include"grader.cpp"
using namespace std;
int valid(int n,int a[]){
    int i=0,need;
    while(i<n&&a[i]>n)i++;
    need=a[i];
    while(i<n){
        if(a[i]<=n&&a[i]!=need)return 0;
        if(need==n)need=1;
        else need++;
        i++;
    }
    sort(a,a+n);
    for(i=1;i<n;i++)if(a[i]==a[i-1])return 0;
    return 1;
}
int pos[250005];
int replacement(int n,int a[],int res[]){
    vector<pair<int,int>>b;
    int i=0,ind=n,need=1,len=0;
    while(i<n&&a[i]>n)i++;
    if(i!=n)need=a[i]-i;
    if(need<1)need+=n;
    for(i=0;i<n;i++)b.push_back({a[i],need++});
    sort(b.begin(),b.end());
    i=0;
    while(i+1<n){
        if(b[i].first<=n)continue;
        res[len++]=b[i].second;
        a[i].first=++ind;
        while(a[i].first+1<a[i+1].first){
            res[len++]=a[i].first;
            a[i].first=++ind;
        }
    }
    return len;
}
int countReplacement(int n,int inputSeq[]){
    return -3;
}

Compilation message (stderr)

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:32:14: error: request for member 'first' in '*(a + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'int'
   32 |         a[i].first=++ind;
      |              ^~~~~
gondola.cpp:33:20: error: request for member 'first' in '*(a + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'int'
   33 |         while(a[i].first+1<a[i+1].first){
      |                    ^~~~~
gondola.cpp:33:35: error: request for member 'first' in '*(a + ((((sizetype)i) + 1) * 4))', which is of non-class type 'int'
   33 |         while(a[i].first+1<a[i+1].first){
      |                                   ^~~~~
gondola.cpp:34:29: error: request for member 'first' in '*(a + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'int'
   34 |             res[len++]=a[i].first;
      |                             ^~~~~
gondola.cpp:35:18: error: request for member 'first' in '*(a + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'int'
   35 |             a[i].first=++ind;
      |                  ^~~~~