Submission #555544

#TimeUsernameProblemLanguageResultExecution timeMemory
555544fuad27Aliens (IOI16_aliens)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 5010; const int MAXK = 50; long long k; vector<long long> pref[50]; bool check(int l, int r) { bool c = true; for(int i = 0;i<k;i++) { if(!(pref[i][r+1] - pref[i][l]))c = false; } return c; } int main () { long long n, m; cin >> n >> k >> m; for(int i = 0;i<50;i++) { pref[i].resize(MAXN); } long long arr[n]; for(int i = 0;i<n;i++){ cin >> arr[i]; arr[i]--; } for(int i = 0;i<50;i++) { pref[i][0] = 0; for(int j = 1;j<=n;j++) { if(arr[j-1] == i) { pref[i][j] = pref[i][j-1]+1; } else pref[i][j] = pref[i][j-1]; } } while(m--) { int type; cin >> type; if(type == 1) { int p, v; cin >> p >> v; v--;p--; arr[p] = v; for(int i = 0;i<50;i++) { pref[i][0] = 0; for(int j = 1;j<=n;j++) { if(arr[j-1] == i) { pref[i][j] = pref[i][j-1]+1; } else pref[i][j] = pref[i][j-1]; } } } else { int p1 = 0, p2 = 0; long long ans = 1e9; while(p2 < n) { if(check(p1, p2)) { ans = min(ans, (long long)p2-p1+1); p1++; } else { p2++; } } if(ans == 1e9)ans = -1; cout << ans << "\n"; } } }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccgN6ZvI.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccg4U31H.o:aliens.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccgN6ZvI.o: in function `main':
grader.cpp:(.text.startup+0xf0): undefined reference to `take_photos(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status