제출 #1123865

#제출 시각아이디문제언어결과실행 시간메모리
1123865fiips Martian DNA (BOI18_dna)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, ri; cin >> n >> k >> ri; int dna[n]; for(int i = 0; i < n; i++) cin >> dna[i]; int req[k]; for(int i = 0; i < k; i++) req[i] = LLONG_MAX / 20; for(int i = 0; i < ri; i++) { int a, b; cin >> a >> b; req[a] = b; } int cnt[k]; memset(cnt, 0, sizeof(cnt)); unordered_set<int> s; int ans = LLONG_MAX / 20, l = 0; for(int r = 0; r < n; r++) { cnt[dna[r]]++; if(cnt[dna[r]] >= req[dna[r]]) s.emplace(dna[r]); if(s.size() == ri){ while(1){ cnt[dna[l]]--; if(cnt[dna[l]] < req[dna[l]]) { s.erase(dna[l]); break; } } ans = min(r - l + 1, ans); l++; } } } if(ans == LLONG_MAX / 20) cout << "impossible"; else cout << ans;

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

dna.cpp:49:9: error: expected unqualified-id before 'if'
   49 |         if(ans == LLONG_MAX / 20) cout << "impossible";
      |         ^~
dna.cpp:50:9: error: expected unqualified-id before 'else'
   50 |         else cout << ans;
      |         ^~~~