Submission #657439

#TimeUsernameProblemLanguageResultExecution timeMemory
657439PanTkdRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include <stdio.h>
#include <stdlib.h>
#include "robots.h"
#include <iostream>
using namespace std;
typedef long long ll;

#define fail(s, x...) do { \
		fprintf(stderr, s "\n", ## x); \
		exit(1); \
	} while(0)

#define MAX_A 50000
#define MAX_B 50000
#define MAX_T 500000

static int X[MAX_A];
static int Y[MAX_B];
static int W[MAX_T];
static int S[MAX_T];




int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
    ll ans=1;
    ll i = 0 , j = 0 ;
    sort(X.begin(),X.end());
    sort(W.begin(),W.end());
    reverse(X.begin(),X.end());
    reverse(W.begin(),W.end());
    if(X[0]<=W[0]) return -1;
    while(1){
        if(X[i]>W[j]){
            i++,j++;
        }
        else{
            i = 0;
            ans++;
        }
    }
    return ans;
}

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:28:12: error: request for member 'begin' in 'X', which is of non-class type 'int*'
   28 |     sort(X.begin(),X.end());
      |            ^~~~~
robots.cpp:28:22: error: request for member 'end' in 'X', which is of non-class type 'int*'
   28 |     sort(X.begin(),X.end());
      |                      ^~~
robots.cpp:28:5: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   28 |     sort(X.begin(),X.end());
      |     ^~~~
      |     qsort
robots.cpp:29:12: error: request for member 'begin' in 'W', which is of non-class type 'int*'
   29 |     sort(W.begin(),W.end());
      |            ^~~~~
robots.cpp:29:22: error: request for member 'end' in 'W', which is of non-class type 'int*'
   29 |     sort(W.begin(),W.end());
      |                      ^~~
robots.cpp:30:15: error: request for member 'begin' in 'X', which is of non-class type 'int*'
   30 |     reverse(X.begin(),X.end());
      |               ^~~~~
robots.cpp:30:25: error: request for member 'end' in 'X', which is of non-class type 'int*'
   30 |     reverse(X.begin(),X.end());
      |                         ^~~
robots.cpp:30:5: error: 'reverse' was not declared in this scope
   30 |     reverse(X.begin(),X.end());
      |     ^~~~~~~
robots.cpp:31:15: error: request for member 'begin' in 'W', which is of non-class type 'int*'
   31 |     reverse(W.begin(),W.end());
      |               ^~~~~
robots.cpp:31:25: error: request for member 'end' in 'W', which is of non-class type 'int*'
   31 |     reverse(W.begin(),W.end());
      |                         ^~~
robots.cpp: At global scope:
robots.cpp:20:12: warning: 'S' defined but not used [-Wunused-variable]
   20 | static int S[MAX_T];
      |            ^
robots.cpp:19:12: warning: 'W' defined but not used [-Wunused-variable]
   19 | static int W[MAX_T];
      |            ^
robots.cpp:18:12: warning: 'Y' defined but not used [-Wunused-variable]
   18 | static int Y[MAX_B];
      |            ^
robots.cpp:17:12: warning: 'X' defined but not used [-Wunused-variable]
   17 | static int X[MAX_A];
      |            ^