Submission #138236

#TimeUsernameProblemLanguageResultExecution timeMemory
138236rajarshi_basuToy Train (IOI17_train)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define FOR(i,n) for(int i=0;i<n;i++) #define FORE(i,a,b) for(int i = a;i<=b;i++) #define ll long long int #define pb push_back #define vi vector<int> #define ff first #define ss second #define vv vector #define ii pair<int,int> using namespace std; const int MAXN = 5001; bool self[MAXN]; bool nxt[MAXN]; int* who_wins(vi a,vi r,vi u,vi v){ int m = u.length(); int n = a.length(); FOR(i,m){ if(u[i] == v[i])self[u[i]] = 1; else nxt[u[i]] = 1; } int arr[n]; for(int i = n-1;i >= 0;i--){ if(a[i] == 0 and r[i] == 0){ if(self[i])arr[i] = 0; else arr[i] = arr[i+1]; }else if(a[i] == 0 and r[i] == 1){ if(nxt[i])arr[i] = arr[i+1]; else arr[i] = 1; }else if(a[i] == 1 and r[i] == 0){ if(nxt[i])arr[i] = arr[i+1]; else arr[i] = 0; }else{ if(self[i])arr[i] = 1; else arr[i] = arr[i+1]; } } return arr; }

Compilation message (stderr)

train.cpp: In function 'int* who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:21:12: error: 'class std::vector<int>' has no member named 'length'
  int m = u.length();
            ^~~~~~
train.cpp:22:12: error: 'class std::vector<int>' has no member named 'length'
  int n = a.length();
            ^~~~~~
train.cpp:27:6: warning: address of local variable 'arr' returned [-Wreturn-local-addr]
  int arr[n];
      ^~~