Submission #1184155

#TimeUsernameProblemLanguageResultExecution timeMemory
1184155InvMODStudentsko (COCI14_studentsko)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n,k; cin >> n >> k; vector<int> a(n + 1); for(int i = 1; i <= n; i++){ cin >> a[i]; } vector<int> id(n + 1); for(int i = 1; i <= n; i++) id[i] = i; sort(1 + id.begin(), id.end(), [&](int x, int y){return a[x] > a[y];}); vector<int> b(n + 1); for(int i = 1; i <= n; i++){ b[id[i]] = (i + k - 1) / k; } #define sz(v) (int)(v).size() vector<int> lis; for(int i = 1; i <= n; i++){ if(!sz(lis)) lis.push_back(b[i]); else{ int p = upper_bound(lis.begin(), lis.end(), b[i]) - lis.begin(); if(p == sz(lis)){ lis.push_back(b[i]); } else lis[[p]] = b[i]; } } cout << n - sz(lis) << "\n"; return 0; }

Compilation message (stderr)

studentsko.cpp: In function 'int main()':
studentsko.cpp:34:15: error: two consecutive '[' shall only introduce an attribute before '[' token
   34 |       else lis[[p]] = b[i];
      |               ^