Submission #1140519

#TimeUsernameProblemLanguageResultExecution timeMemory
1140519anonymousboySprinklers (CEOI24_sprinklers)C++20
6 / 100
16 ms1096 KiB
// Author: Jiří Kalvoda
#include <bits/stdc++.h>

const int NMAX = 112345;

int s[NMAX];
int f[NMAX];

int N, M;

int main(int argc, char **argv) {
    scanf("%d%d", &N, &M);

    for (int i = 0; i < N; i++)
        scanf("%d", s + i);
    for (int i = 0; i < M; i++)
        scanf("%d", f + i);

    int r = 0;

    for (int i = 0, j = 0; j < M; j++) {
        while (i < N - 2 && s[i + 1] < f[j])
            i++;

        r = std::max(r, std::min(std::abs(f[j] - s[i]), std::abs(f[j] - s[i + 1])));
    }

    printf("%d\n", r);

    for (int i = 0; i < N; i += 3)
        printf("LLR");
    printf("\n");

    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main(int, char**)':
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d%d", &N, &M);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%d", s + i);
      |         ~~~~~^~~~~~~~~~~~~
Main.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%d", f + i);
      |         ~~~~~^~~~~~~~~~~~~
#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...