(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 #481405

#TimeUsernameProblemLanguageResultExecution timeMemory
481405rainboyNivelle (COCI20_nivelle)C11
110 / 110
13 ms476 KiB
#include <stdio.h> #define N 100000 #define A 26 int main() { static char cc[N + 1]; static int ii[A]; int n, h, j, cnt, p_, q_, i_, j_; scanf("%d%s", &n, cc); cnt = 0, p_ = 1, q_ = 0, i_ = j_ = -1; for (j = 0; j < n; j++) { for (h = 0; h < cnt; h++) if (cc[ii[h]] == cc[j]) { cnt--; while (h < cnt) ii[h] = ii[h + 1], h++; break; } ii[cnt++] = j; for (h = 0; h < cnt; h++) { int i = h == 0 ? 0 : ii[h - 1] + 1, p = cnt - h, q = j - i + 1; if (p_ * q > p * q_) p_ = p, q_ = q, i_ = i, j_ = j; } } printf("%d %d\n", i_ + 1, j_ + 1); return 0; }

Compilation message (stderr)

nivelle.c: In function 'main':
nivelle.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%s", &n, cc);
      |  ^~~~~~~~~~~~~~~~~~~~~
#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...