Submission #1515203


Source Code Expand

#include <iostream>

using namespace std;
using LL =long long;

int main() {

    LL N, M;
    cin >> N >> M;

    int max_ = 0;

    for (int i = 1; i <= M / 2; i++) {
        max_ = max(max_, min(N + i, (M - i * 2) / 2));
    }

    cout << max_ << endl;
}

Submission Info

Submission Time
Task C - Scc Puzzle
User sawfish
Language C++14 (Clang 3.8.0)
Score 0
Code Size 275 Byte
Status CE

Compile Error

./Main.cpp:14:16: error: no matching function for call to 'max'
        max_ = max(max_, min(N + i, (M - i * 2) / 2));
               ^~~
/usr/local/include/c++/v1/algorithm:2635:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('int' vs. 'long long')
max(const _Tp& __a, const _Tp& __b)
^
/usr/local/include/c++/v1/algorithm:2645:1: note: candidate template ignored: could not match 'initializer_list<type-parameter-0-0>' against 'int'
max(initializer_list<_Tp> __t, _Compare __comp)
^
/usr/local/include/c++/v1/algorithm:2627:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/usr/local/include/c++/v1/algorithm:2653:1: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided
max(initializer_list<_Tp> __t)
^
1 error generated.