Submission #1075393

# Submission time Handle Problem Language Result Execution time Memory
1075393 2024-08-26T05:23:20 Z ProtonDecay314 Sprinklers (CEOI24_sprinklers) C++17
0 / 100
10 ms 1492 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef set<ll> sll;
#define IOS cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false)
#define INF(dtype) numeric_limits<dtype>::max()
#define NINF(dtype) numeric_limits<dtype>::min()

int solve(int n, int m, const vi& s, const vi& f) {
    if(n == 1) {
        // Case 1: n == 1

        bool less_exists = false;
        bool greater_exists = false;

        int spos = s[0];

        int ans = 0;

        for(int fv : f) {
            if(fv < spos) {
                less_exists = true;
                ans = max(ans, spos - fv);
            } else if(fv > spos) {
                greater_exists = true;
                ans = max(ans, fv - spos);
            }
        }

        if(less_exists && greater_exists) return -1;
        return ans;
    }
}

int main() {
    IOS;

    int n, m;
    cin >> n >> m;

    vi s(n, 0);
    vi f(m, 0);

    for(int& sv : s) cin >> sv;
    for(int& fv : f) cin >> fv;

    cout << solve(n, m, s, f) << endl;

    return 0;
}

Compilation message

Main.cpp: In function 'int solve(int, int, const vi&, const vi&)':
Main.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB User solution is worse than jury's solution
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 10 ms 1492 KB Unexpected end of file - token expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB User solution is worse than jury's solution
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB User solution is worse than jury's solution
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB User solution is worse than jury's solution
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB User solution is worse than jury's solution
2 Halted 0 ms 0 KB -