제출 #138237

#제출 시각아이디문제언어결과실행 시간메모리
138237rajarshi_basu장난감 기차 (IOI17_train)C++14
0 / 100
8 ms888 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.size(); int n = a.size(); 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; }

컴파일 시 표준 에러 (stderr) 메시지

train.cpp: In function 'int* who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:27:6: warning: address of local variable 'arr' returned [-Wreturn-local-addr]
  int arr[n];
      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...