Submission #1039602

# Submission time Handle Problem Language Result Execution time Memory
1039602 2024-07-31T05:16:35 Z 김은성(#10990) Sprinklers (CEOI24_sprinklers) C++17
6 / 100
157 ms 2584 KB
#include <bits/stdc++.h>
using namespace std;
int s[100009], f[100009];
bool ch[100009];
int main(){
    int n, m, i, j, k;
    scanf("%d %d", &n, &m);
    for(i=1; i<=n; i++)
        scanf("%d", &s[i]);
    for(i=1; i<=m; i++)
        scanf("%d", &f[i]);
    int lo = 0, hi = 1000000009, mid;
    while(lo < hi){
        k = mid = (lo+hi)/2;
        for(i=1; i<=m; i++){
            if(lower_bound(s+1, s+n+1, f[i]+k+1) == lower_bound(s+1, s+n+1, f[i]-k))
                break;
        }
        if(i==m+1)
            hi = mid;
        else
            lo=mid+1;
    }
    if(lo==1000000009)
        printf("-1\n");
    else{
        printf("%d\n", lo);
        for(i=0; i<n/3; i++)
            printf("LLR");
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:6:18: warning: unused variable 'j' [-Wunused-variable]
    6 |     int n, m, i, j, k;
      |                  ^
Main.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         scanf("%d", &s[i]);
      |         ~~~~~^~~~~~~~~~~~~
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &f[i]);
      |         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Incorrect 0 ms 348 KB Unexpected end of file - token expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Correct 85 ms 1364 KB Correct
3 Correct 9 ms 640 KB Correct
4 Correct 151 ms 2584 KB Correct
5 Correct 157 ms 2384 KB Correct
6 Correct 0 ms 344 KB Correct
7 Correct 0 ms 348 KB Correct
8 Correct 78 ms 2480 KB Correct
9 Correct 65 ms 2384 KB Correct
10 Correct 150 ms 2392 KB Correct
11 Correct 9 ms 1628 KB Correct
12 Correct 106 ms 1876 KB Correct
13 Correct 103 ms 1888 KB Correct
14 Correct 114 ms 2100 KB Correct
15 Correct 97 ms 2140 KB Correct
16 Correct 98 ms 1876 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Incorrect 0 ms 348 KB Unexpected end of file - token expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Incorrect 101 ms 1544 KB Incorrect string length
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Incorrect 0 ms 348 KB Unexpected end of file - token expected
3 Halted 0 ms 0 KB -