Submission #150551

#TimeUsernameProblemLanguageResultExecution timeMemory
150551준표야 함수컵은 캐리해줄거지? (#200)King of Chairs (FXCUP4_chairs)C++17
Compilation error
0 ms0 KiB
#include "king.h" #include <algorithm> using namespace std; typedef long long ll; typedef pair<int, int> pii; long long SendInfo(std::vector<int> W, std::vector<int> C) { int N = W.size(); vector<pii> ws, cs; for(int i=0;i<N;i++) { cs.push_back({C[i], i}); } sort(cs.begin(), cs.end()); for(int i=0;i<N;i++) { ws.push_back({W[i], i}); } sort(ws.begin(), ws.end()); int *ans = new[N]; int wi=0; int ci=0; for(;wi<N && ci<N;) { while(ci<N && ws[wi].first>cs[ci].first) { ci++; } if(ci==N) break; ans[ws[wi].second] = cs[ci].second; wi++; ci++; } for(int i=wi;i<N;i++) ans[ws[i].second] = -1; ll ret = 0; for(int i = 0; i < N; i++) ret = ret * 11 + (ans[i] + 1); return ret; // return ((unsigned long long)ans % (1ll << 32)); }
#include "vassal.h" using namespace std; int last, ans[100000]; void Init(long long B, std::vector<int> C){ int N = C.size(); for(int i = N - 1; i >= 0; i--){ ans[i] = B % 11; B = (B - ans[i]) / 11; ans[i]--; } } int Maid(int W){ return ans[last]; }

Compilation message (stderr)

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:22:16: error: expected type-specifier before '[' token
  int *ans = new[N];
                ^