(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #748264

#제출 시각아이디문제언어결과실행 시간메모리
748264TrunktyGrudanje (COCI19_grudanje)C++14
70 / 70
537 ms169248 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll string s; int n,q; vector<vector<int>> query; int arr[100005]; int pref[100005][205]; signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> s; n = s.length(); cin >> q; for(int i=1;i<=q;i++){ int a,b; cin >> a >> b; query.push_back({a,b}); } for(int i=1;i<=n;i++){ int a; cin >> a; arr[a] = i; } int low=0,high=n-1; while(low!=high){ int mid = (low+high)/2; for(int i=1;i<=n;i++){ for(int j='a';j<='z';j++){ pref[i][j] = pref[i-1][j]; } if(arr[i]>mid){ pref[i][s[i-1]]++; } } bool yes = true; for(vector<int> i:query){ for(int j='a';j<='z';j++){ if(pref[i[1]][j]-pref[i[0]-1][j]>=2){ yes = false; } } } if(yes){ high = mid; } else{ low = mid+1; } } cout << low << "\n"; return 0; }

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

grudanje.cpp: In function 'int main()':
grudanje.cpp:36:31: warning: array subscript has type 'char' [-Wchar-subscripts]
   36 |                 pref[i][s[i-1]]++;
      |                               ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...