(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.

Submission #868766

#TimeUsernameProblemLanguageResultExecution timeMemory
868766PringNivelle (COCI20_nivelle)C++14
110 / 110
56 ms1620 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define fs first #define sc second #define mp make_pair typedef pair<int, int> pii; typedef pair<pii, int> p3i; const int MXN = 100005, MXC = 26; int n; string s; deque<int> dq[MXC]; pii ans; double x = 3000000000000000000.0; void miku() { cin >> n >> s; for (int i = 0; i < n; i++) { dq[s[i] - 'a'].push_back(i); } for (int i = 0; i < MXC; i++) dq[i].push_back(-1); for (int i = 0; i < n; i++) { vector<int> v; for (int j = 0; j < MXC; j++) if (dq[j].front() != -1) v.push_back(dq[j].front()); v.push_back(n); sort(v.begin(), v.end()); // cout << i << endl; // for (auto &j : v) cout << j << ' '; // cout << endl; for (int j = 1; j < v.size(); j++) { double xx = (double) j / (v[j] - i); if (xx < x) { x = xx; ans = mp(i, v[j]); } } dq[s[i] - 'a'].pop_front(); } cout << ans.fs + 1 << ' ' << ans.sc << endl; } int32_t main() { cin.tie(0) -> sync_with_stdio(false); miku(); return 0; }

Compilation message (stderr)

nivelle.cpp: In function 'void miku()':
nivelle.cpp:32:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for (int j = 1; j < v.size(); j++) {
      |                         ~~^~~~~~~~~~
#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...