submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s251675112
|
p04035
|
C++
|
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include "../../new_algorithm/pretty_printer.h"
using namespace std;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
struct Node {
int pre, nxt;
int w, c;
int x, y;
};
const int N = 1e5 + 10;
Node a[N];
ostream& operator <<(ostream& os, const Node& a) {
os << a.x << " " << a.y << " " << a.w << " " << a.c << " "
<< a.pre << " " << a.nxt;
return os;
}
struct cmp {
bool operator ()(int u, int v) {
return a[u].c < a[v].c;
}
};
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i].w);
a[i].x = i, a[i].y = i + 1;
a[i].pre = (i - 1 >= 0 ? i - 1 : -1);
a[i].nxt = (i + 1 < n ? i + 1 : -1);
}
set<int, cmp> A;
for (int i = 0; i < n - 1; ++i) {
a[i].c = a[i].w + a[i + 1].w;
A.insert(i);
}
vector<int> ret;
while (!A.empty()) {
// for (auto& it : A) {
// cout << a[it] << " | ";
// } cout << endl;
int cur = *prev(A.end());
int pre = a[cur].pre, nxt = a[cur].nxt, nnxt = a[nxt].nxt;
// cout << pre << " " << cur << " " << nxt << " " << nnxt << endl;
if (a[cur].c < m) break;
ret.push_back(a[cur].y);
A.erase(cur);
A.erase(nxt);
a[cur].w += a[nxt].w;
a[cur].y = a[nxt].y;
a[cur].nxt = nnxt;
if (nnxt >= 0) {
a[nnxt].pre = cur;
a[cur].c = a[cur].w + a[nxt].w;
A.insert(cur);
}
if (pre >= 0) {
A.erase(pre);
a[pre].c = a[pre].w + a[cur].w;
A.insert(pre);
}
}
if (ret.size() == n - 1) {
puts("Possible");
reverse(ret.begin(), ret.end());
for (auto& it : ret) {
printf("%d\n", it);
}
} else {
puts("Impossible");
}
return 0;
}
|
a.cc:21:10: fatal error: ../../new_algorithm/pretty_printer.h: No such file or directory
21 | #include "../../new_algorithm/pretty_printer.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s938145189
|
p04035
|
C++
|
import numpy as np
n, l = map(int, input().split())
knot = list(map(int, input().split()))
flg = 0
li = []
for i in range(0, int(n) - 1):
if(knot[i] + knot[i + 1] >= l):
flg = 1
print("Possible")
li.append(i + 1)
for j in range(i + 2, n):
li.append(j)
for j in reversed(range(1, i + 1)):
li.append(j)
break
if flg == 0:
print("Impossible")
for i in reversed(li):
print(i)
|
a.cc:1:1: error: 'import' does not name a type
1 | import numpy as np
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s644115469
|
p04035
|
C
|
/* Generated by Cython 0.21 */
#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
#error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_21"
#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyClass_Type
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
#define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
#else
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
#else
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#define PyNumber_Int PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_VERSION_HEX < 0x030200A4
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#define CYTHON_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_INLINE inline
#else
#define CYTHON_INLINE
#endif
#endif
#ifndef CYTHON_RESTRICT
#if defined(__GNUC__)
#define CYTHON_RESTRICT __restrict__
#elif defined(_MSC_VER) && _MSC_VER >= 1400
#define CYTHON_RESTRICT __restrict
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_RESTRICT restrict
#else
#define CYTHON_RESTRICT
#endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
/* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
a quiet NaN. */
float value;
memset(&value, 0xFF, sizeof(value));
return value;
}
#endif
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
x->~T();
}
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__AGC002_C
#define __PYX_HAVE_API__AGC002_C
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
(sizeof(type) < sizeof(Py_ssize_t)) || \
(sizeof(type) > sizeof(Py_ssize_t) && \
likely(v < (type)PY_SSIZE_T_MAX || \
v == (type)PY_SSIZE_T_MAX) && \
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
v == (type)PY_SSIZE_T_MIN))) || \
(sizeof(type) == sizeof(Py_ssize_t) && \
(is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
v == (type)PY_SSIZE_T_MAX))) )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
const Py_UNICODE *u_end = u;
while (*u_end++) ;
return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys;
PyObject* default_encoding = NULL;
PyObject* ascii_chars_u = NULL;
PyObject* ascii_chars_b = NULL;
const char* default_encoding_c;
sys = PyImport_ImportModule("sys");
if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
Py_DECREF(sys);
if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad;
if (strcmp(default_encoding_c, "ascii") == 0) {
__Pyx_sys_getdefaultencoding_not_ascii = 0;
} else {
char ascii_chars[128];
int c;
for (c = 0; c < 128; c++) {
ascii_chars[c] = c;
}
__Pyx_sys_getdefaultencoding_not_ascii = 1;
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
if (!ascii_chars_u) goto bad;
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
PyErr_Format(
PyExc_ValueError,
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
default_encoding_c);
goto bad;
}
Py_DECREF(ascii_chars_u);
Py_DECREF(ascii_chars_b);
}
Py_DECREF(default_encoding);
return 0;
bad:
Py_XDECREF(default_encoding);
Py_XDECREF(ascii_chars_u);
Py_XDECREF(ascii_chars_b);
return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys;
PyObject* default_encoding = NULL;
char* default_encoding_c;
sys = PyImport_ImportModule("sys");
if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
Py_DECREF(sys);
if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad;
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
Py_DECREF(default_encoding);
return 0;
bad:
Py_XDECREF(default_encoding);
return -1;
}
#endif
#endif
/* Test for GCC > 2.95 */
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char *__pyx_f[] = {
"AGC002_C.py",
};
/*--- Type declarations ---*/
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
if (acquire_gil) { \
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
PyGILState_Release(__pyx_gilstate_save); \
} else { \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
}
#else
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define __Pyx_RefNannyFinishContext() \
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define __Pyx_RefNannyDeclarations
#define __Pyx_RefNannySetupContext(name, acquire_gil)
#define __Pyx_RefNannyFinishContext()
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XINCREF(r) Py_XINCREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do { \
PyObject *tmp = (PyObject *) r; \
r = v; __Pyx_XDECREF(tmp); \
} while (0)
#define __Pyx_DECREF_SET(r, v) do { \
PyObject *tmp = (PyObject *) r; \
r = v; __Pyx_DECREF(tmp); \
} while (0)
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
PyTypeObject* tp = Py_TYPE(obj);
if (likely(tp->tp_getattro))
return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
if (likely(tp->tp_getattr))
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static CYTHON_INLINE int __Pyx_IterFinish(void);
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
typedef struct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename);
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
static int __Pyx_check_binary_version(void);
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
/* Module declarations from 'AGC002_C' */
#define __Pyx_MODULE_NAME "AGC002_C"
int __pyx_module_is_main_AGC002_C = 0;
/* Implementation of 'AGC002_C' */
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_input;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_print;
static char __pyx_k_L[] = "L";
static char __pyx_k_N[] = "N";
static char __pyx_k_a[] = "a";
static char __pyx_k_b[] = "b";
static char __pyx_k_c[] = "c";
static char __pyx_k_i[] = "i";
static char __pyx_k_map[] = "map";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_input[] = "input";
static char __pyx_k_print[] = "print";
static char __pyx_k_range[] = "range";
static char __pyx_k_split[] = "split";
static char __pyx_k_Possible[] = "Possible";
static char __pyx_k_Impossible[] = "Impossible";
static PyObject *__pyx_n_u_Impossible;
static PyObject *__pyx_n_s_L;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_n_u_Possible;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_input;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_map;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
#if PY_VERSION_HEX < 0x03020000
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
#else
PyModuleDef_HEAD_INIT,
#endif
"AGC002_C",
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_u_Impossible, __pyx_k_Impossible, sizeof(__pyx_k_Impossible), 0, 1, 0, 1},
{&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1},
{&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
{&__pyx_n_u_Possible, __pyx_k_Possible, sizeof(__pyx_k_Possible), 0, 1, 0, 1},
{&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
{&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
{&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
{&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
{&__pyx_n_s_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 0, 1, 1},
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
{&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1},
{&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
{&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s_map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_input = __Pyx_GetBuiltinName(__pyx_n_s_input); if (!__pyx_builtin_input) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
/* "AGC002_C.py":7
* for i in range(N-1):
* if a[i] + a[i+1] >= L:
* print("Possible") # <<<<<<<<<<<<<<
* b = 1
* c = i
*/
__pyx_tuple_ = PyTuple_Pack(1, __pyx_n_u_Possible); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple_);
__Pyx_GIVEREF(__pyx_tuple_);
/* "AGC002_C.py":12
* break
* else:
* print("Impossible") # <<<<<<<<<<<<<<
* if b == 1:
* for i in range(1,c+1):
*/
__pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_u_Impossible); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__2);
__Pyx_GIVEREF(__pyx_tuple__2);
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
}
static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initAGC002_C(void); /*proto*/
PyMODINIT_FUNC initAGC002_C(void)
#else
PyMODINIT_FUNC PyInit_AGC002_C(void); /*proto*/
PyMODINIT_FUNC PyInit_AGC002_C(void)
#endif
{
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *(*__pyx_t_5)(PyObject *);
Py_ssize_t __pyx_t_6;
PyObject *(*__pyx_t_7)(PyObject *);
PyObject *__pyx_t_8 = NULL;
int __pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
PyErr_Clear();
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
if (!__Pyx_RefNanny)
Py_FatalError("failed to import 'refnanny' module");
}
#endif
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_AGC002_C(void)", 0);
if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#ifdef __Pyx_CyFunction_USED
if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_FusedFunction_USED
if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_Generator_USED
if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/*--- Library function declarations ---*/
/*--- Threads initialization code ---*/
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
#ifdef WITH_THREAD /* Python build with threading support? */
PyEval_InitThreads();
#endif
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4("AGC002_C", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_d);
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
if (__pyx_module_is_main_AGC002_C) {
if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
#if PY_MAJOR_VERSION >= 3
{
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!PyDict_GetItemString(modules, "AGC002_C")) {
if (unlikely(PyDict_SetItemString(modules, "AGC002_C", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
#endif
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Global init code ---*/
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
/*--- Type import code ---*/
/*--- Variable import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "AGC002_C.py":1
* N, L = map(int, input().split()) # <<<<<<<<<<<<<<
* a = list(map(int, input().split()))
* b = 0
*/
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_2)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
if (__pyx_t_2) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else {
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
__Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_2 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L2_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L2_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_5 = NULL;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L3_unpacking_done;
__pyx_L2_unpacking_failed:;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L3_unpacking_done:;
}
if (PyDict_SetItem(__pyx_d, __pyx_n_s_N, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_L, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "AGC002_C.py":2
* N, L = map(int, input().split())
* a = list(map(int, input().split())) # <<<<<<<<<<<<<<
* b = 0
* c = 0
*/
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_2)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
if (__pyx_t_2) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else {
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
__Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_a, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "AGC002_C.py":3
* N, L = map(int, input().split())
* a = list(map(int, input().split()))
* b = 0 # <<<<<<<<<<<<<<
* c = 0
* for i in range(N-1):
*/
if (PyDict_SetItem(__pyx_d, __pyx_n_s_b, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "AGC002_C.py":4
* a = list(map(int, input().split()))
* b = 0
* c = 0 # <<<<<<<<<<<<<<
* for i in range(N-1):
* if a[i] + a[i+1] >= L:
*/
if (PyDict_SetItem(__pyx_d, __pyx_n_s_c, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "AGC002_C.py":5
* b = 0
* c = 0
* for i in range(N-1): # <<<<<<<<<<<<<<
* if a[i] + a[i+1] >= L:
* print("Possible")
*/
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
__pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
for (;;) {
if (likely(!__pyx_t_7)) {
if (likely(PyList_CheckExact(__pyx_t_1))) {
if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
}
} else {
__pyx_t_3 = __pyx_t_7(__pyx_t_1);
if (unlikely(!__pyx_t_3)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_3);
}
if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "AGC002_C.py":6
* c = 0
* for i in range(N-1):
* if a[i] + a[i+1] >= L: # <<<<<<<<<<<<<<
* print("Possible")
* b = 1
*/
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_a); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_t_2); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_a); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_t_8); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_8 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_L); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_9) {
/* "AGC002_C.py":7
* for i in range(N-1):
* if a[i] + a[i+1] >= L:
* print("Possible") # <<<<<<<<<<<<<<
* b = 1
* c = i
*/
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "AGC002_C.py":8
* if a[i] + a[i+1] >= L:
* print("Possible")
* b = 1 # <<<<<<<<<<<<<<
* c = i
* break
*/
if (PyDict_SetItem(__pyx_d, __pyx_n_s_b, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "AGC002_C.py":9
* print("Possible")
* b = 1
* c = i # <<<<<<<<<<<<<<
* break
* else:
*/
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_c, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "AGC002_C.py":10
* b = 1
* c = i
* break # <<<<<<<<<<<<<<
* else:
* print("Impossible")
*/
goto __pyx_L5_break;
}
/* "AGC002_C.py":5
* b = 0
* c = 0
* for i in range(N-1): # <<<<<<<<<<<<<<
* if a[i] + a[i+1] >= L:
* print("Possible")
*/
}
/*else*/ {
/* "AGC002_C.py":12
* break
* else:
* print("Impossible") # <<<<<<<<<<<<<<
* if b == 1:
* for i in range(1,c+1):
*/
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
/* "AGC002_C.py":5
* b = 0
* c = 0
* for i in range(N-1): # <<<<<<<<<<<<<<
* if a[i] + a[i+1] >= L:
* print("Possible")
*/
__pyx_L5_break:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "AGC002_C.py":13
* else:
* print("Impossible")
* if b == 1: # <<<<<<<<<<<<<<
* for i in range(1,c+1):
* print(i)
*/
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_9) {
/* "AGC002_C.py":14
* print("Impossible")
* if b == 1:
* for i in range(1,c+1): # <<<<<<<<<<<<<<
* print(i)
* for i in range(N-1, c, -1):
*/
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_c); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
if (likely(!__pyx_t_7)) {
if (likely(PyList_CheckExact(__pyx_t_4))) {
if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
}
} else {
__pyx_t_1 = __pyx_t_7(__pyx_t_4);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_1);
}
if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "AGC002_C.py":15
* if b == 1:
* for i in range(1,c+1):
* print(i) # <<<<<<<<<<<<<<
* for i in range(N-1, c, -1):
* print(i)
*/
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "AGC002_C.py":14
* print("Impossible")
* if b == 1:
* for i in range(1,c+1): # <<<<<<<<<<<<<<
* print(i)
* for i in range(N-1, c, -1):
*/
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "AGC002_C.py":16
* for i in range(1,c+1):
* print(i)
* for i in range(N-1, c, -1): # <<<<<<<<<<<<<<
* print(i)
*/
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_N); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_c); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_int_neg_1);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_neg_1);
__Pyx_GIVEREF(__pyx_int_neg_1);
__pyx_t_1 = 0;
__pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
__pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
for (;;) {
if (likely(!__pyx_t_7)) {
if (likely(PyList_CheckExact(__pyx_t_3))) {
if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
}
} else {
__pyx_t_4 = __pyx_t_7(__pyx_t_3);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_4);
}
if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "AGC002_C.py":17
* print(i)
* for i in range(N-1, c, -1):
* print(i) # <<<<<<<<<<<<<<
*/
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "AGC002_C.py":16
* for i in range(1,c+1):
* print(i)
* for i in range(N-1, c, -1): # <<<<<<<<<<<<<<
* print(i)
*/
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L8;
}
__pyx_L8:;
/* "AGC002_C.py":1
* N, L = map(int, input().split()) # <<<<<<<<<<<<<<
* a = list(map(int, input().split()))
* b = 0
*/
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/*--- Wrapped vars code ---*/
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_8);
if (__pyx_m) {
if (__pyx_d) {
__Pyx_AddTraceback("init AGC002_C", __pyx_clineno, __pyx_lineno, __pyx_filename);
Py_DECREF(__pyx_d); __pyx_d = 0;
}
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init AGC002_C");
}
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
}
/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule((char *)modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
Py_XDECREF(p);
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
#endif
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
if (unlikely(!result)) {
PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
"name '%U' is not defined", name);
#else
"name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
}
return result;
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
PyObject *result;
ternaryfunc call = func->ob_type->tp_call;
if (unlikely(!call))
return PyObject_Call(func, arg, kw);
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
return NULL;
result = (*call)(func, arg, kw);
Py_LeaveRecursiveCall();
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
}
return result;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
PyObject *self, *result;
PyCFunction cfunc;
cfunc = PyCFunction_GET_FUNCTION(func);
self = PyCFunction_GET_SELF(func);
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
return NULL;
result = cfunc(self, arg);
Py_LeaveRecursiveCall();
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
}
return result;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
if (likely(PyCFunction_Check(func))) {
#endif
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
return __Pyx_PyObject_CallMethO(func, NULL);
}
}
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
PyObject *result;
PyObject *args = PyTuple_New(1);
if (unlikely(!args)) return NULL;
Py_INCREF(arg);
PyTuple_SET_ITEM(args, 0, arg);
result = __Pyx_PyObject_Call(func, args, NULL);
Py_DECREF(args);
return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
if (likely(PyCFunction_Check(func))) {
#endif
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
return __Pyx_PyObject_CallMethO(func, arg);
}
}
return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
PyObject* args = PyTuple_Pack(1, arg);
return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
index, (index == 1) ? "" : "s");
}
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
PyObject* exc_type = tstate->curexc_type;
if (unlikely(exc_type)) {
if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
PyObject *exc_value, *exc_tb;
exc_value = tstate->curexc_value;
exc_tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
Py_DECREF(exc_type);
Py_XDECREF(exc_value);
Py_XDECREF(exc_tb);
return 0;
} else {
return -1;
}
}
return 0;
#else
if (unlikely(PyErr_Occurred())) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
PyErr_Clear();
return 0;
} else {
return -1;
}
}
return 0;
#endif
}
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
if (unlikely(retval)) {
Py_DECREF(retval);
__Pyx_RaiseTooManyValuesError(expected);
return -1;
} else {
return __Pyx_IterFinish();
}
return 0;
}
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
result = PyDict_GetItem(__pyx_d, name);
if (likely(result)) {
Py_INCREF(result);
} else {
#else
result = PyObject_GetItem(__pyx_d, name);
if (!result) {
PyErr_Clear();
#endif
result = __Pyx_GetBuiltinName(name);
}
return result;
}
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
int start = 0, mid = 0, end = count - 1;
if (end >= 0 && code_line > entries[end].code_line) {
return count;
}
while (start < end) {
mid = (start + end) / 2;
if (code_line < entries[mid].code_line) {
end = mid;
} else if (code_line > entries[mid].code_line) {
start = mid + 1;
} else {
return mid;
}
}
if (code_line <= entries[mid].code_line) {
return mid;
} else {
return mid + 1;
}
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
PyCodeObject* code_object;
int pos;
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
return NULL;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
return NULL;
}
code_object = __pyx_code_cache.entries[pos].code_object;
Py_INCREF(code_object);
return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
int pos, i;
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
if (unlikely(!code_line)) {
return;
}
if (unlikely(!entries)) {
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
if (likely(entries)) {
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = 64;
__pyx_code_cache.count = 1;
entries[0].code_line = code_line;
entries[0].code_object = code_object;
Py_INCREF(code_object);
}
return;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
PyCodeObject* tmp = entries[pos].code_object;
entries[pos].code_object = code_object;
Py_DECREF(tmp);
return;
}
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
int new_max = __pyx_code_cache.max_count + 64;
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
if (unlikely(!entries)) {
return;
}
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = new_max;
}
for (i=__pyx_code_cache.count; i>pos; i--) {
entries[i] = entries[i-1];
}
entries[pos].code_line = code_line;
entries[pos].code_object = code_object;
__pyx_code_cache.count++;
Py_INCREF(code_object);
}
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
#if PY_MAJOR_VERSION < 3
py_srcfile = PyString_FromString(filename);
#else
py_srcfile = PyUnicode_FromString(filename);
#endif
if (!py_srcfile) goto bad;
if (c_line) {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#else
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#endif
}
else {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromString(funcname);
#else
py_funcname = PyUnicode_FromString(funcname);
#endif
}
if (!py_funcname) goto bad;
py_code = __Pyx_PyCode_New(
0,
0,
0,
0,
0,
__pyx_empty_bytes, /*PyObject *code,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
py_line,
__pyx_empty_bytes /*PyObject *lnotab*/
);
Py_DECREF(py_srcfile);
Py_DECREF(py_funcname);
return py_code;
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyFrameObject *py_frame = 0;
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
if (!py_code) {
py_code = __Pyx_CreateCodeObjectForTraceback(
funcname, c_line, py_line, filename);
if (!py_code) goto bad;
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
py_frame = PyFrame_New(
PyThreadState_GET(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
__pyx_d, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = py_line;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
const long neg_one = (long) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(long) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(long) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof(long) <= sizeof(unsigned long long)) {
return PyLong_FromUnsignedLongLong((unsigned long long) value);
}
} else {
if (sizeof(long) <= sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(long) <= sizeof(long long)) {
return PyLong_FromLongLong((long long) value);
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(long),
little, !is_unsigned);
}
}
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
{ \
func_type value = func_value; \
if (sizeof(target_type) < sizeof(func_type)) { \
if (unlikely(value != (func_type) (target_type) value)) { \
func_type zero = 0; \
if (is_unsigned && unlikely(value < zero)) \
goto raise_neg_overflow; \
else \
goto raise_overflow; \
} \
} \
return (target_type) value; \
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
const long neg_one = (long) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(long) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (long) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
switch (Py_SIZE(x)) {
case 0: return 0;
case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
if (sizeof(long) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(long) <= sizeof(unsigned long long)) {
__PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
switch (Py_SIZE(x)) {
case 0: return 0;
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (sizeof(long) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
} else if (sizeof(long) <= sizeof(long long)) {
__PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
long val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (long) -1;
}
} else {
long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (long) -1;
val = __Pyx_PyInt_As_long(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to long");
return (long) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long) -1;
}
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
const int neg_one = (int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(int) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (int) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
switch (Py_SIZE(x)) {
case 0: return 0;
case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
if (sizeof(int) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(int) <= sizeof(unsigned long long)) {
__PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
switch (Py_SIZE(x)) {
case 0: return 0;
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (sizeof(int) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
} else if (sizeof(int) <= sizeof(long long)) {
__PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
int val;
PyObject *v = __Pyx_PyNumber_Int(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (int) -1;
}
} else {
int val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (int) -1;
val = __Pyx_PyInt_As_int(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to int");
return (int) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to int");
return (int) -1;
}
static int __Pyx_check_binary_version(void) {
char ctversion[4], rtversion[4];
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
char message[200];
PyOS_snprintf(message, sizeof(message),
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
return PyErr_WarnEx(NULL, message, 1);
}
return 0;
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else if (t->intern) {
*t->p = PyString_InternFromString(t->s);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
#else
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
} else if (t->encoding) {
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
} else {
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
}
} else {
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
}
#endif
if (!*t->p)
return -1;
++t;
}
return 0;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
Py_ssize_t ignore;
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
__Pyx_sys_getdefaultencoding_not_ascii &&
#endif
PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
char* defenc_c;
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
if (!defenc) return NULL;
defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
{
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
char* c;
for (c = defenc_c; c < end; c++) {
if ((unsigned char) (*c) >= 128) {
PyUnicode_AsASCIIString(o);
return NULL;
}
}
}
#endif
*length = PyBytes_GET_SIZE(defenc);
return defenc_c;
#else
if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
if (PyUnicode_IS_ASCII(o)) {
*length = PyUnicode_GET_LENGTH(o);
return PyUnicode_AsUTF8(o);
} else {
PyUnicode_AsASCIIString(o);
return NULL;
}
#else
return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
} else
#endif
#if !CYTHON_COMPILING_IN_PYPY
if (PyByteArray_Check(o)) {
*length = PyByteArray_GET_SIZE(o);
return PyByteArray_AS_STRING(o);
} else
#endif
{
char* result;
int r = PyBytes_AsStringAndSize(o, &result, length);
if (unlikely(r < 0)) {
return NULL;
} else {
return result;
}
}
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
int is_true = x == Py_True;
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
PyNumberMethods *m;
const char *name = NULL;
PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
if (PyInt_Check(x) || PyLong_Check(x))
#else
if (PyLong_Check(x))
#endif
return Py_INCREF(x), x;
m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
if (m && m->nb_int) {
name = "int";
res = PyNumber_Int(x);
}
else if (m && m->nb_long) {
name = "long";
res = PyNumber_Long(x);
}
#else
if (m && m->nb_int) {
name = "int";
res = PyNumber_Long(x);
}
#endif
if (res) {
#if PY_MAJOR_VERSION < 3
if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
"__%.4s__ returned non-%.4s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
}
}
else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"an integer is required");
}
return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject *x;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(b)))
return PyInt_AS_LONG(b);
#endif
if (likely(PyLong_CheckExact(b))) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
switch (Py_SIZE(b)) {
case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
case 0: return 0;
case 1: return ((PyLongObject*)b)->ob_digit[0];
}
#endif
#endif
return PyLong_AsSsize_t(b);
}
x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
return PyInt_FromSize_t(ival);
}
#endif /* Py_PYTHON_H */
|
main.c:8:10: fatal error: pyconfig.h: No such file or directory
8 | #include "pyconfig.h"
| ^~~~~~~~~~~~
compilation terminated.
|
s128861958
|
p04035
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int,int> p;
int dy[4]={-1,1,0,0};
int dx[4]={0,0,1,-1};
int N, L;
ll A[100000];
int main(){
ios::sync_with_stdio(false);
cin >> N >> L;
REP(i,N) {
cin >> A[i];
}
int flag = 1;
int knot = -1;
REP(i,N-1) {
if (A[i]+A[i+1] >= L) {
flag = 0;
knot = i;
break;
}
}
if (flag) {
cout << "Impossible" << endl;
return 0;
}
cout << "Possible" << endl;
REP(i, knot) {
cout << i+1 << endl;
}
for(int i = N-2; i > knot; i--) {
cout << i+1 << endl;
}
cout << knot+1 << endl;
return 0;
}
|
a.cc:46:16: error: extended character is not valid in an identifier
46 | cout << i+1 << endl;
| ^
a.cc: In function 'int main()':
a.cc:46:16: error: '\U00003000i' was not declared in this scope
46 | cout << i+1 << endl;
| ^~~
|
s388117284
|
p04035
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int,int> p;
int dy[4]={-1,1,0,0};
int dx[4]={0,0,1,-1};
int N, L;
ll A[100000];
int main(){
ios::sync_with_stdio(false);
cin >> N >> L;
REP(i,N) {
cin >> A[i];
}
int flag = 1;
int knot = -1;
REP(i,N-1) {
if (A[i]+A[i+1] >= L) {
flag = 0;
knot = i;
break;
}
}
if (flag) {
cout << "Impossible" << endl;
return 0;
}
cout << "Possible" << endl;
REP(i, knot) {
cout << i+1 << endl;
}
for(int i = N-2; i > knot; i--) {
cout << i+1 << endl;
}
cout << knot+1 << endl;
return 0;
}
|
a.cc:46:16: error: extended character is not valid in an identifier
46 | cout << i+1 << endl;
| ^
a.cc: In function 'int main()':
a.cc:46:16: error: '\U00003000i' was not declared in this scope
46 | cout << i+1 << endl;
| ^~~
|
s290809145
|
p04035
|
C++
|
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <bitset>
#include <climits>
#include <utility>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#define REP(i,n) for(int (i)=0;i<(int)(n);++(i))
#define REPIT(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define PB push_back
#define FT first
#define SD second
#define ZERO(x) memset(x,0,sizeof(x))
#define NEG(x) memset(x,-1,sizeof(x))
#define RI(x) scanf("%d",&(x))
#define RII(x,y) scanf("%d%d",&(x),&(y))
#define RIII(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
#define OIII(x,y,z) printf("%d %d %d\n",(x),(y),(z))
#define OII(x,y) printf("%d %d\n",(x),(y))
#define OI(x) printf("%d\n",(x))
#define OL(x) cout<<(x)<<endl
#define OLL(x,y) cout<<(x)<<" "<<(y)<<endl
#define OLLL(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define RS(s) scanf("%s",(s))
#define MP(x,y) make_pair((x),(y))
#define SZ(x) ((int)(x).size())
#define FIN(f) freopen(f,"r",stdin)
#define FOUT(f) freopen(f,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<int,int> PII;
const int MOD = 1e9+7;
const int maxn = 222222;
int a[maxn];
PII b[maxn];
LL L;
int n;
bool tie[maxn];
vector<int> ans;
LL sz[maxn];
int pa[maxn];
int findp(int x){return pa[x] == x ? x : pa[x] = findp(pa[x]);}
int main(int argc, char const *argv[])
{
RI(n);
cin>>L;
REP(i,n){
RI(a[i]);
b[i].SD = i;
b[i].FT = a[i];
}
sort(b,b+n);
REP(i,n) {
int x = b[i].SD;
if(x>0 && x < n && !tie[x]) {
ans.push_back(x);
tie[x] = 1;
}
x++;
if(x>0 && x < n && !tie[x]) {
ans.push_back(x);
tie[x] = 1;
}
}
for(int i=0;i<n;++i){
pa[i] = i;
sz[i] = a[i];
}
bool f = 1;
for(int i=SZ(ans)-1;i>=0;--i) {
int j = ans[i];
int a = findp(j), b = findp(j-1);
if(a!=b) {
pa[a] = b;
sz[b] += sz[a];
//OLL(sz[b],sz[a]);
if(sz[b] < L)f = 0;
}
}
if(f){
puts("Possible");
for(int i=0;i<SZ(ans);++i)
printf("%d\n", ans[i]);
} else puts("Impossible");
return 0;
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:63:29: error: reference to 'tie' is ambiguous
63 | if(x>0 && x < n && !tie[x]) {
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/vector:87,
from a.cc:2:
/usr/include/c++/14/tuple:2791:5: note: candidates are: 'template<class ... _Elements> constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...)'
2791 | tie(_Elements&... __args) noexcept
| ^~~
a.cc:46:6: note: 'bool tie [222222]'
46 | bool tie[maxn];
| ^~~
a.cc:65:13: error: reference to 'tie' is ambiguous
65 | tie[x] = 1;
| ^~~
/usr/include/c++/14/tuple:2791:5: note: candidates are: 'template<class ... _Elements> constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...)'
2791 | tie(_Elements&... __args) noexcept
| ^~~
a.cc:46:6: note: 'bool tie [222222]'
46 | bool tie[maxn];
| ^~~
a.cc:68:29: error: reference to 'tie' is ambiguous
68 | if(x>0 && x < n && !tie[x]) {
| ^~~
/usr/include/c++/14/tuple:2791:5: note: candidates are: 'template<class ... _Elements> constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...)'
2791 | tie(_Elements&... __args) noexcept
| ^~~
a.cc:46:6: note: 'bool tie [222222]'
46 | bool tie[maxn];
| ^~~
a.cc:70:13: error: reference to 'tie' is ambiguous
70 | tie[x] = 1;
| ^~~
/usr/include/c++/14/tuple:2791:5: note: candidates are: 'template<class ... _Elements> constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...)'
2791 | tie(_Elements&... __args) noexcept
| ^~~
a.cc:46:6: note: 'bool tie [222222]'
46 | bool tie[maxn];
| ^~~
|
s292325575
|
p04035
|
C++
|
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <random>
using namespace std;
#define min(a,b) ((a)<(b) ? (a):(b))
#define max(a,b) ((a)>(b) ? (a):(b))
int gcd(int a, int b){
while( b ){
int m = a % b;
a = b;
b = m;
}
return a;
}
int lcm(int a, int b){
return (a*b)/gcd(a,b);
}
int isPrim(int a){
if(a==1){
return 0;
}
for(int i=2;i<=(a+1)/2;i++){
if(a%i==0){
return 0;
}
}
return 1;
}
long long mod_pow(long long x, long long n, long long mod){
//xのn乗を計算するのにn乗を2進表記にして計算
//x^22 = x^16 + x^4 + x^2
long long ret=1;
while(n>0){
if(n%2==1){
ret=(ret*x)%mod;//答えに付加
}
x=(x*x)%mod;//2乗
n=n/2;
}
return ret;
}
struct VV{
int x;
int y;
int z;
};
class LessInt {
public:
bool operator()(const VV& riLeft, const VV& riRight) const {
if(riLeft.x == riRight.x){
return riLeft.y > riRight.y;
}
return riLeft.x > riRight.x;
}
};
class indInt {
public:
bool operator()(const VV& riLeft, const VV& riRight) const {
return riLeft.x < riRight.x;
}
};
struct XX{
long long a;
long long b;
};
class xxIntu {
public:
bool operator()(const XX& riLeft, const XX& riRight) const {
//第1条件
if(riLeft.a != riRight.a){
return riLeft.a > riRight.a;//<:昇順(小さい順)、>:降順(大きい順)
}
//第2条件
return riLeft.b > riRight.b;
}
};
bool operator< (const XX &riLeft, const XX &riRight){
return riLeft.a < riRight.a;
};
bool operator> (const XX &riLeft, const XX &riRight){
return riLeft.a > riRight.a;
};
int main(int argc, const char * argv[])
{
//std::ios::sync_with_stdio(false);
//scanf("%s",S);
//scanf("%d",&N);
//getline(cin, target);
//cin >> x >> y;
//ここから
long long N,L;
cin >> N >> L;
vector<XX> a;
a.clear();
for(long long i=0;i<N;i++){
long long tmp;
cin >> tmp;
XX v;
v.a=tmp;
v.b=i;
a.push_back(v);
}
int f=0;
vector<long long> ans;
ans.clear();
while(f==0){
f=1;
long long i;
for(i=0;i<N-1;i++){
for(long long j=i+1;j<N;j++){
if(a[i].a==0){
break;
}
if(a[i].a+a[j].a>=L && a[j].a!=0){
f=0;
a[i].a=a[i].a+a[j].a;
//a[j].a=0;
a.erase(a.begin()+j);
ans.push_back(j);
break;
}
if(a[j].a!=0){
break;
}
}
}
}
int tmp=0;
for(int i=0;i<N;i++){
if(a[i]!=0){
tmp++;
}
}
if(tmp==1){
cout << "Possible" << endl;
for(int i=0;i<ans.size();i++){
cout << ans[ans.size()-1-i] << endl;
}
}else{
cout << "Impossible" << endl;
}
//ここまで
//cout << "ans" << endl;改行含む
//printf("%.0f\n",ans);//小数点以下表示なし
//printf("%.7f\n",p);
//printf("%f\n",pow(2,ans.size()));
return 0;
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:160:16: error: no match for 'operator!=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} and 'int')
160 | if(a[i]!=0){
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::fpos<_StateT>'
160 | if(a[i]!=0){
| ^
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::allocator<_CharT>'
160 | if(a[i]!=0){
| ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::reverse_iterator<_Iterator>'
160 | if(a[i]!=0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::reverse_iterator<_Iterator>'
160 | if(a[i]!=0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::move_iterator<_IteratorL>'
160 | if(a[i]!=0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::move_iterator<_IteratorL>'
160 | if(a[i]!=0){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::pair<_T1, _T2>'
160 | if(a[i]!=0){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
651 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: 'XX' is not derived from 'std::basic_string_view<_CharT, _Traits>'
160 | if(a[i]!=0){
| ^
/usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
658 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: 'XX' is not derived from 'std::basic_string_view<_CharT, _Traits>'
160 | if(a[i]!=0){
| ^
/usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
160 | if(a[i]!=0){
| ^
/usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
160 | if(a[i]!=0){
| ^
/usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3847 | operator!=(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: mismatched types 'const _CharT*' and 'XX'
160 | if(a[i]!=0){
| ^
/usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
160 | if(a[i]!=0){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2613 | operator!=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::tuple<_UTypes ...>'
160 | if(a[i]!=0){
| ^
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: template argument deduction/substitution failed:
a.cc:160:18: note: '__gnu_cxx::__alloc_traits<std::allocator<XX>, XX>::value_type' {aka 'XX'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
160 | if(a[i]!=0){
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:8:
/usr/include/c++/14/bits/stl_map.h:1557:5: note: candidate: 'template<class _Key, cla
|
s014389162
|
p04035
|
C++
|
#include<iostream>
using namespace std;
int main()
{
int N ,L;
int last=0;
cin >> N >> L;
int a[N+3];
cin >> a[0];
for(int i=0; i<N-1 ; i++)
{
cin >> a[i+1];
if(abs(a[i+1]-a[i]) >= L )
{
last = i+1;
break;
}
}
if(last> 0)
{
cout << "Possible" << endl;
for(int i=1;i<last;i++)
{
cout << i << endl;
}
for(int i=N-1;i>N-1;i--)
{
cout << i << endl;
}
}else{
cout << "Impossible"; << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:35:39: error: expected primary-expression before '<<' token
35 | cout << "Impossible"; << endl;
| ^~
|
s673242229
|
p04035
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{
string imp = "Impossible";
string pos = "Possible";
int N, L;
cin >> N >> L;
vector<int> a(N + 1, 0);
for(int i = 1; i < N + 1; i++)
cin >> a[i];
vector<int> res(N - 1, 0);
if(N == 1){
cout << pos << endl;
return 0;
}
int c = 0;
for(int i = 1; i <= N - 1; i++){
if(a[i] + a[i + 1] >= L){
c = i;
break;
}
}
if(c == 0){
cout << imp << end;
return 0;
}
cout << pos << endl;
for(int i = 1; i < c; i++)
cout << i << endl;
for(int i = N - 1; i > c; i--)
cout << i << endl;
cout << c << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:33:17: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
33 | cout << imp << end;
| ~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
|
|
s853109314
|
p04035
|
C
|
ho
|
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
1 | ho
| ^~
|
s103799202
|
p04035
|
C
|
#include <stdio.h>
#define OPEN 0
#define CLOSE 1
#define NUM 100000
struct knot{
int state;
int from;
int to;
long long int a;
long long int sum;
};
int func();
struct knot knot[NUM];
int n;
long long int l;
int order[NUM];
int main(void){
int i;
scanf("%d %lld", &n, &l);
for(i = 1; i <= n; i++){
knot[i].state = CLOSE;
knot[i].from = 0;
knot[i].to = n;
scanf("%lld", &knot[i].a);
knot[i].sum = knot[i - 1].sum + knot[i].a;
}
knot[0].state = OPEN;
knot[0].from = 0;
knot[0].to = n;
knot[0].a = 0;
knot[0].sum = 0;
knot[n].state = OPEN;
if(func() == 1){
printf("Possible\n");
for(i = 0; i < n; i++){
printf("%d\n", order[i]);
}
} else {
printf("Impossible\n");
}
return 0;
}
int func(){
int isloop = 1;
int ptr = 0;
int i, j, k;
i = 1;
while(1){
printf("%d: %d\n", i, ptr);
if(knot[i].state == CLOSE){
for(j = i - 1; knot[j].state != OPEN; j--);
for(k = i + 1; knot[k].state != OPEN; k++);
if(knot[k].sum - knot[j].sum > l){
knot[i].state = OPEN;
order[ptr] = i;
ptr++;
isloop = 0;
if(ptr == n - 1){
return 1;
}
}
}
}
if(i == n){
if(isloop == 1){
if(ptr == 0){
return 0;
}
i = order[ptr];
ptr--;
knot[i].state = CLOSE;
}
isloop = 1;
i = 0;
}
i++;
}
}
|
main.c:88:1: error: expected identifier or '(' before '}' token
88 | }
| ^
|
s762540313
|
p04035
|
C++
|
#include <iostream>
#include <stdio.h>
#include <numeric>
#include <queue>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <iomanip>
#include <set>
#include <queue>
#include <bitset>
#include <iomanip>
#include <map>
#include <string.h>
#include <stack>
#include <algorithm>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;
int input[100010];
int index[100010]; // 第i个和哪个合并
int main()
{
int i , j , n , l;
while (scanf("%d%d" , &n , &l) != EOF)
{
vector<long long> ans;
bool ok = true;
long long sum = 0;
for (i = 1;i <= n;i ++)
{
scanf("%d" , &input[i]);
sum += input[i];
}
i = 1;
j = n;
while (i < j)
{
if (sum < (long long) l)
ok = false;
if (input[i] < input[j])
{
ans.push_back(i);
sum -= input[i];
i ++;
}
else
{
ans.push_back(j - 1);
sum -= input[j];
j --;
}
}
if (ok)
{
printf("Possible\n");
for (i = 0;i < ans.size();i ++)
printf("%lld\n" , ans[i]);
}
else
printf("Impossible\n");
}
return 0;
}
|
a.cc:25:17: error: 'int index [100010]' redeclared as different kind of entity
25 | int index[100010]; // 第i个和哪个合并
| ^
In file included from /usr/include/string.h:462,
from a.cc:15:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
|
s948709380
|
p04035
|
C++
|
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
long long int sum(int l,int r,vector<int> a){
long long int sum=0;
for(int i=l;i<=r;i++){
sum += a[i];
}
return sum;
}
int main(){
int n,l;
cin >> n >> l;
vector<int> a(n);
for(int i=0;i<n;i++){
// cin >> a[i];
scanf("%d",&a[i]);
}
int left = 0;
int right = n-1;
int knot = n-1;
vector<int> ans;
while(knot > 0){
if(sum(left,right,a) < l){
cout << "Impossible" << endl;
return 0;
}
if( a[left] < a[right] ){
// cout << a[left] << endl;
ans.push_back(left+1);
left++;
}else{
// cout << a[right] << endl;
ans.push_back(right);
right--;
}
knot--;
// if(left==right) cout<< "end" << endl;
}
cout << "Possible" << endl;
for(int i=0;i<ans.size();i++){
printf("%d\n",ans[i]);
}
return 0;
}#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
long long int sum(int l,int r,vector<int> a){
long long int sum=0;
for(int i=l;i<=r;i++){
sum += a[i];
}
return sum;
}
int main(){
int n,l;
cin >> n >> l;
vector<int> a(n);
for(int i=0;i<n;i++){
// cin >> a[i];
scanf("%d",&a[i]);
}
int left = 0;
int right = n-1;
int knot = n-1;
vector<int> ans;
while(knot > 0){
if(sum(left,right,a) < l){
cout << "Impossible" << endl;
return 0;
}
if( a[left] < a[right] ){
// cout << a[left] << endl;
ans.push_back(left+1);
left++;
}else{
// cout << a[right] << endl;
ans.push_back(right);
right--;
}
knot--;
// if(left==right) cout<< "end" << endl;
}
cout << "Possible" << endl;
for(int i=0;i<ans.size();i++){
printf("%d\n",ans[i]);
}
return 0;
}
|
a.cc:61:2: error: stray '#' in program
61 | }#include <iostream>
| ^
a.cc:61:3: error: 'include' does not name a type
61 | }#include <iostream>
| ^~~~~~~
a.cc:68:15: error: redefinition of 'long long int sum(int, int, std::vector<int>)'
68 | long long int sum(int l,int r,vector<int> a){
| ^~~
a.cc:8:15: note: 'long long int sum(int, int, std::vector<int>)' previously defined here
8 | long long int sum(int l,int r,vector<int> a){
| ^~~
a.cc:76:5: error: redefinition of 'int main()'
76 | int main(){
| ^~~~
a.cc:16:5: note: 'int main()' previously defined here
16 | int main(){
| ^~~~
|
s584141684
|
p04035
|
C++
|
#include <iostream>
#include <queue>
using namespace std;
int a[1000000005];
queue<int> q;
int main(void) {
int N, L;
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> L;
for (int i = 0; i < N; i++) cin >> a[i];
int l = 0, r = N-1, ans = 0, k = 0;
long long int sum = 0;
for (int i = 0; i < N - 1; i++) {
sum = 0;
for (int j = l; j <= r; j++) {
sum += a[j];
if (sum >= L) {
if (a[l] <= a[r]) {
a[l] = 0;
q.push(l+1);
l++;
} else if (a[l] > a[r]) {
a[r] = 0;
q.push(r);
r--;
}
break;
}
}
if (l == r) {
ans = 1;
break;
}
}
if (ans) {
cout << "Possible\n";
for (int i = 0; i < N - 1; i++) {
cout << q.front() << endl;
q.pop();
}
} else {
cout << "Impossible\n";
}
return 0;
}
|
/tmp/ccIe6EWW.o: in function `main':
a.cc:(.text+0x15d): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccIe6EWW.o
a.cc:(.text+0x1c9): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccIe6EWW.o
a.cc:(.text+0x242): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccIe6EWW.o
a.cc:(.text+0x276): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccIe6EWW.o
/tmp/ccIe6EWW.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x2ba): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccIe6EWW.o
a.cc:(.text+0x2d3): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccIe6EWW.o
collect2: error: ld returned 1 exit status
|
s689835357
|
p04035
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
int main(){
long long n, len; cin >> n >> len;
vector<long long> a(n + 1);
vector<pair<long long, long long> > sum;
for(int i = 1; i <= n; i++) {
cin >> a[i];
if(i >= 2) {
sum.push_back(make_pair(a[i - 1] + a[i], i - 1));
}
}
if(n >= 3) {
long long sum3 = a[1] + a[2] + a[3];
if(sum3 < len) {
cout << "Impossible" << endl;
return 0;
}
for(int i = 4; i <= n; i++) {
sum3 -= a[i - 3];
sum3 += a[i];
if(sum3 < len) {
cout << "Impossible" << endl;
return 0;
}
}
} else {
if(a[0] + a[1] < len) {
cout << "Impossible" << endl;
return 0;
}
}
cout << "Possible" << endl;
sort(sum.begin(), sum.end());
for(int i = 0; i < sum.size(); i++) {
cout << sum[i].second << endl;
}
// long long l = 1, r = n;
// vector<long long > ans(n);
// long long count = 0;
// while(r - l >= 1) {
// if(r - l == 1) {
// if(a[l] + a[r] < len) {
// cout << "Impossible" << endl;
// return 0;
// }
// }
// if(a[l] <= a[r]) {
// ans[count] = l;
// l++;
// } else {
// ans[count] = r - 1;
// r--;
// }
// count++;
// }
// for(int i = 0; i < ans.size() - 1; i++) {
// cout << ans[i] << endl;
// }
}
|
a.cc: In function 'int main()':
a.cc:36:5: error: 'sort' was not declared in this scope; did you mean 'short'?
36 | sort(sum.begin(), sum.end());
| ^~~~
| short
|
s888244123
|
p04035
|
C++
|
// AtCoder agc002
#include <bits/stdc++.h>
#define ld long double
#define ll long long int
#define mod 1000000007
#define ll_inf 1000000000000000
#define int_inf 1000000000
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define eps 1e-9
#define PI acos(-1.0)
#define ii pair<int,int>
#define iii pair<int,ii>
#define se second
#define fi first
using namespace std;
ll a[100010];
ll s1[100010], s2[100010];
int main(){
//cout.precision(12);
//ifstream fin("in");
int n; ll len;
cin>>n>>len;
ll sum=0;
for(int i=1;i<=n;i++){
cin>>a[i];
sum+=a[i];
s1[i]=a[i]+s1[i-1];
}
for(int i=n;i>=1;i--)s2[i]=a[i]+s2[i+1];
vector<ll>ans;
for(ll l=1,r=n;r!=l;){
//cout<<ans.size()<<" ";
//cout<<l<<" "<<r<<" "<<sum<<endl;
if(a[l]==a[r]){
if(s1[l+1]<=s2[r-1]){
if(sum-a[l]>=len || (l+1==r && sum>=len) ){ans.pb(l); sum-=a[l]; l++;}
else{
cout<<"Impossible"<<endl; return 0;
}
continue;
}
if(sum-a[r]>=len || (l+1==r && sum>=len)){ans.pb(r-1); sum-=a[r]; r--;}
else{
cout<<"Impossible"<<endl; return 0;
}
continue;
}
if(a[l]>a[r]){
if(sum-a[r]>=len || (l+1==r && sum>=len)){ans.pb(r-1); sum-=a[r]; r--;}
else{
cout<<"Impossible"<<endl; return 0;
}
continue;
}
if(sum-a[l]>=len || (l+1==r && sum>=len) ){ans.pb(l); sum-=a[l]; l++;}
else{
cout<<"Impossible"<<endl; return 0;
}
}
cout<<"Possible"<<endl;
int sz=ans.size();
for(int i=0;i<sz;i++){
if(i==sz-1)cout<<ans[i]<<endl;;
else cout<<ans[i]<<endl;
}
}
|
a.cc: In function 'int main()':
a.cc:68:9: error: 'else' without a previous 'if'
68 | else cout<<ans[i]<<endl;
| ^~~~
|
s101645041
|
p04035
|
C++
|
// AtCoder agc002
#include <bits/stdc++.h>
#define ld long double
#define ll long long int
#define mod 1000000007
#define ll_inf 1000000000000000
#define int_inf 1000000000
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define eps 1e-9
#define PI acos(-1.0)
#define ii pair<int,int>
#define iii pair<int,ii>
#define se second
#define fi first
using namespace std;
ll a[100010];
ll s1[100010], s2[100010];
int main(){
//cout.precision(12);
//ifstream fin("in");
int n; ll len;
cin>>n>>len;
ll sum=0;
for(int i=1;i<=n;i++){
cin>>a[i];
sum+=a[i];
s1[i]=a[i]+s1[i-1];
}
for(int i=n;i>=1;i--)s2[i]=a[i]+s2[i+1];
vector<ll>ans;
for(ll l=1,r=n;r!=l;){
//cout<<ans.size()<<" ";
//cout<<l<<" "<<r<<" "<<sum<<endl;
if(a[l]==a[r]){
if(s1[l+1]<=s2[r-1]){
if(sum-a[l]>=len || (l+1==r && sum>=len) ){ans.pb(l); sum-=a[l]; l++;}
else{
cout<<"Impossible"<<endl; return 0;
}
continue;
}
if(sum-a[r]>=len || (l+1==r && sum>=len)){ans.pb(r-1); sum-=a[r]; r--;}
else{
cout<<"Impossible"<<endl; return 0;
}
continue;
}
if(a[l]>a[r]){
if(sum-a[r]>=len || (l+1==r && sum>=len)){ans.pb(r-1); sum-=a[r]; r--;}
else{
cout<<"Impossible"<<endl; return 0;
}
continue;
}
if(sum-a[l]>=len || (l+1==r && sum>=len) ){ans.pb(l); sum-=a[l]; l++;}
else{
cout<<"Impossible"<<endl; return 0;
}
}
cout<<"Possible"<<endl;
int sz=ans.size();
for(int i=0;i<sz;i++){
if(i==sz-1)cout<<ans[i]<<endl;;
else cout<<ans[i]<<endl;
}
}
|
a.cc: In function 'int main()':
a.cc:68:9: error: 'else' without a previous 'if'
68 | else cout<<ans[i]<<endl;
| ^~~~
|
s987182544
|
p04035
|
C++
|
[yas] Loading for `fundamental-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/zhenyok/.emacs.d/elpa/yasnippet-20150811.1222/snippets/fundamental-mode) (quote fundamental-mode)))!
File Edit Options Buffers Tools C++ YASnippet Help
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
vector<int> a(n);
for (int& x : a) {
cin >> x;
}
int idx = -1;
for (int i = 0; i < a.size() - 1; i++) {
if (a[i] + a[i+1] >= m) {
idx = i;
}
}
if (idx == -1) {
cout << "Impossible\n";
} else {
cout << "Possible\n";
for (int i = 0; i < idx; i++) {
cout << (i + 1) << "\n";
}
for (int i = a.size() - 2; i >= idx; i--) {
cout << (i + 1) << "\n";
}
}
return 0;
}
|
a.cc:1:19: error: stray '`' in program
1 | [yas] Loading for `fundamental-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/zhenyok/.emacs.d/elpa/yasnippet-20150811.1222/snippets/fundamental-mode) (quote fundamental-mode)))!
| ^
a.cc:1:36: warning: missing terminating ' character
1 | [yas] Loading for `fundamental-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/zhenyok/.emacs.d/elpa/yasnippet-20150811.1222/snippets/fundamental-mode) (quote fundamental-mode)))!
| ^
a.cc:1:36: error: missing terminating ' character
1 | [yas] Loading for `fundamental-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/zhenyok/.emacs.d/elpa/yasnippet-20150811.1222/snippets/fundamental-mode) (quote fundamental-mode)))!
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before '[' token
1 | [yas] Loading for `fundamental-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/zhenyok/.emacs.d/elpa/yasnippet-20150811.1222/snippets/fundamental-mode) (quote fundamental-mode)))!
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:3:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
|
|
s269424401
|
p04035
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const int MAX = 210000;
int N, L;
int a[MAX];
bool dp[MAX];
int prev[MAX];
int main() {
while (cin >> N >> L) {
memset(dp, 0, sizeof(dp));
memset(prev, -1, sizeof(prev));
dp[0] = true;
for (int i = 0; i < N; ++i) cin >> a[i];
for (int i = 0; i <= N; ++i) {
//cout << i << ": " << dp[i] << endl;
if (!dp[i]) continue;
if (i+1 < N && a[i] + a[i+1] >= L) {
dp[i+2] = true;
prev[i+1] = i;
}
if (i+2 < N && a[i] + a[i+1] >= L) {
dp[i+3] = true;
prev[i+3] = i+2;
prev[i+2] = i;
}
if (i+2 < N && a[i+1] + a[i+2] >= L) {
dp[i+3] = true;
prev[i+3] = i+1;
prev[i+1] = i;
}
}
if (dp[N]) {
puts("Possible");
int st = N;
bool used[MAX];
for (int i = 0; i < N; ++i) used[i] = false;
while (st != 0) {
st = prev[st];
if (st > 0) {
cout << st << endl;
used[st] = true;
}
}
for (int i = 1; i < N; ++i) {
if (!used[i]) cout << i << endl;
}
}
else {
puts("Impossible");
}
}
}
|
a.cc: In function 'int main()':
a.cc:24:16: error: reference to 'prev' is ambiguous
24 | memset(prev, -1, sizeof(prev));
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
244 | prev(_BidirectionalIterator __x, typename
| ^~~~
a.cc:19:5: note: 'int prev [210000]'
19 | int prev[MAX];
| ^~~~
a.cc:24:33: error: reference to 'prev' is ambiguous
24 | memset(prev, -1, sizeof(prev));
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
244 | prev(_BidirectionalIterator __x, typename
| ^~~~
a.cc:19:5: note: 'int prev [210000]'
19 | int prev[MAX];
| ^~~~
a.cc:32:17: error: reference to 'prev' is ambiguous
32 | prev[i+1] = i;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
244 | prev(_BidirectionalIterator __x, typename
| ^~~~
a.cc:19:5: note: 'int prev [210000]'
19 | int prev[MAX];
| ^~~~
a.cc:36:17: error: reference to 'prev' is ambiguous
36 | prev[i+3] = i+2;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
244 | prev(_BidirectionalIterator __x, typename
| ^~~~
a.cc:19:5: note: 'int prev [210000]'
19 | int prev[MAX];
| ^~~~
a.cc:37:17: error: reference to 'prev' is ambiguous
37 | prev[i+2] = i;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
244 | prev(_BidirectionalIterator __x, typename
| ^~~~
a.cc:19:5: note: 'int prev [210000]'
19 | int prev[MAX];
| ^~~~
a.cc:41:17: error: reference to 'prev' is ambiguous
41 | prev[i+3] = i+1;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
244 | prev(_BidirectionalIterator __x, typename
| ^~~~
a.cc:19:5: note: 'int prev [210000]'
19 | int prev[MAX];
| ^~~~
a.cc:42:17: error: reference to 'prev' is ambiguous
42 | prev[i+1] = i;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
244 | prev(_BidirectionalIterator __x, typename
| ^~~~
a.cc:19:5: note: 'int prev [210000]'
19 | int prev[MAX];
| ^~~~
a.cc:51:22: error: reference to 'prev' is ambiguous
51 | st = prev[st];
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
244 | prev(_BidirectionalIterator __x, typename
| ^~~~
a.cc:19:5: note: 'int prev [210000]'
19 | int prev[MAX];
| ^~~~
|
s467227943
|
p04035
|
C++
|
//両端からほどいていくのが最善。左端と右端のひものうち、長さの短いものを取り除くのが最善。O(N)
#include <iostream>
#include <cassert>
#define int long long
using namespace std;
int n, length;
int a[100000];
int ans[100000];
signed main() {
int i;
int rem = 0;
cin >> n >> length;
for (i = 0; i < n; i++) { cin >> a[i]; rem += a[i]; }
int l = 0, r = n - 1; //[l, r]
for (i = 0; i < n - 1; i++) {
if (rem < length) { asssert(0); cout << "Impossible" << endl; return 0; }
if (a[l] < a[r]) {
ans[i] = l + 1;
l++;
}
else {
ans[i] = r;
r--;
}
}
cout << "Possible" << endl;
for (i = 0; i < n - 1; i++) {
cout << ans[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:20:37: error: 'asssert' was not declared in this scope; did you mean 'assert'?
20 | if (rem < length) { asssert(0); cout << "Impossible" << endl; return 0; }
| ^~~~~~~
| assert
|
s625889200
|
p04035
|
Java
|
/**
* Created by abhishek on 7/31/2016.
*/
import java.util.*;
import java.io.*;
public class A {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
long l = Integer.parseInt(st.nextToken());
long array[] = new long[n + 1];
int node = -1;
st = new StringTokenizer(br.readLine());
for (int i = 1; i <= n; i++) {
array[i] = Integer.parseInt(st.nextToken());
if (i == 1) continue;
if (array[i] + array[i - 1] >= l) {
node = i;
}
}
if (node == -1) {
System.out.println("Impossible");
return;
}
System.out.println("Possible");
StringBuilder sb = new StringBuilder();
for (int i = 1; i < node - 1; i++) {
sb.append(i);
sb.append('\n');
}
for(int i = n - 1;i >= node;i++){
sb.append(i);
sb.append('\n');
}
sb.append(node - 1);
System.out.println(sb);
}
}
|
Main.java:6: error: class A is public, should be declared in a file named A.java
public class A {
^
1 error
|
s338175667
|
p04035
|
C++
|
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
using namespace std;
typedef long long LL;
int n;
int len,a[100005]
LL s[100005];
int l,r;
bool flag;
int ans[100005];
int main()
{
scanf("%d%d",&n,&len);
for (int i=1;i<=n;++i) scanf("%d",&a[i]);
s[0]=0;
for (int i=1;i<=n;++i) s[i]=s[i-1]+a[i];
flag=true;
l=1;r=n;
for (int z=1;z<n;++z)
{
if (s[r]-s[l-1]>=len)
{
if (a[l]<a[r])
{
ans[z]=l;
l++;
}
else
{
ans[z]=r-1;
r--;
}
}
else
{
flag=false;
}
}
if (flag)
{
printf("Possible\n");
for (int i=1;i<n;++i) printf("%d\n",ans[i]);
}
else
{
printf("Impossible\n");
}
return 0;
}
|
a.cc:28:1: error: expected initializer before 'LL'
28 | LL s[100005];
| ^~
a.cc: In function 'int main()':
a.cc:37:44: error: 'a' was not declared in this scope
37 | for (int i=1;i<=n;++i) scanf("%d",&a[i]);
| ^
a.cc:38:9: error: 's' was not declared in this scope
38 | s[0]=0;
| ^
a.cc:39:44: error: 'a' was not declared in this scope
39 | for (int i=1;i<=n;++i) s[i]=s[i-1]+a[i];
| ^
a.cc:46:29: error: 'a' was not declared in this scope
46 | if (a[l]<a[r])
| ^
|
s440924369
|
p04035
|
C++
|
#include <stdio.h>
#include <algorithm>
using namespace std;
int x[200200];
int main()
{
int n,l;
scanf("%d %d",&n,&l);
for(i=1;i<=n;i++)
{
scanf("%d",&x[i]);
}
for(i=1;i<n;i++)
{
if(x[i]+x[i+1] >= l)
break;
}
if(i == n)
{
printf("Impossible\n");
}
else
{
printf("Possible\n");
for(j=1;j<i;j++)
printf("%d\n",j);
for(j=n-1;j>=i;j--)
printf("%d\n",j);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:13: error: 'i' was not declared in this scope
12 | for(i=1;i<=n;i++)
| ^
a.cc:16:13: error: 'i' was not declared in this scope
16 | for(i=1;i<n;i++)
| ^
a.cc:21:12: error: 'i' was not declared in this scope
21 | if(i == n)
| ^
a.cc:28:21: error: 'j' was not declared in this scope
28 | for(j=1;j<i;j++)
| ^
a.cc:30:21: error: 'j' was not declared in this scope
30 | for(j=n-1;j>=i;j--)
| ^
|
s769127599
|
p04035
|
C++
|
// VSCF.cpp : Defines the entry point for the console application.
//
#include <conio.h>
#include <iomanip>
#include <string>
#include <ctime>
#include <random>
#include <functional>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <set>
#include <deque>
#include <map>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) decltype(i) v=(i)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define PB push_back
#define ST first
#define ND second
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define int long long
#undef int
int main() {
#define int long long
int n, l;
cin >> n >> l;
vector<int> inp(n);
REP(i, n) {
cin >> inp[i];
}
int seeked = -1;
REP(i, n - 1) {
if (inp[i] + inp[i + 1] >= l) {
seeked = i;
}
}
if (seeked == -1) {
cout << "Impossible";
} else {
cout << "Possible\n";
REP(i, seeked) {
cout << i + 1 << "\n";
}
FORD(i, n - 1, seeked + 1) {
cout << i + 1 << "\n";
}
}
return 0;
}
|
a.cc:3:10: fatal error: conio.h: No such file or directory
3 | #include <conio.h>
| ^~~~~~~~~
compilation terminated.
|
s935855797
|
p04035
|
C++
|
5 50
10 20 30 40 50
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 5 50
| ^
|
s405853909
|
p04036
|
C++
|
.
|
a.cc:1:1: error: expected unqualified-id before '.' token
1 | .
| ^
|
s406803865
|
p04037
|
C
|
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[100005];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;++i)
scanf("%d",&a[i]);
sort(a+1,a+n+1);
for(int i=1;i<=n;++i)
if((n-i+a[i])%2==0)
return (n-i<=a[i])?(!printf("First")):(!printf("Second"));
printf("Second");
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s357291350
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 1e5 + 30;
int a[maxn], maxx, Sum;
signed main() {
int n;
n = read();
for (int i = 1; i <= n; i++) {
a[i] = read(); maxx = max(maxx, a[i]);
Sum += a[i];
}
if ((n + Sum - maxx) % 2 == 1){
puts("First");
return 0;
}
else puts("Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:13: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
8 | n = read();
| ~~~~^~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
from /usr/include/signal.h:328,
from /usr/include/c++/14/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
a.cc:10:20: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
10 | a[i] = read(); maxx = max(maxx, a[i]);
| ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
|
s374649619
|
p04037
|
C++
|
http://lahlahhaha.github.io/
|
a.cc:1:1: error: 'http' does not name a type
1 | http://lahlahhaha.github.io/
| ^~~~
|
s096712484
|
p04037
|
C++
|
#include <cstdio>
#include <algorithm>
using namespace std;
int n , a[100005];
int main() {
scanf("%d" , &n);
for(int i = 1 ; i <= n ; ++i) scanf("%d" , a + i);
sort(a + 1 , a + 1 + n , greater<int>());
for(int i = 1 ; i <= n ; ++i) if(a[i + 1] < i + 1) {
int j = i;
while(a[j + 1] == i) ++j;
if((a[i] - i)&1 || (j - i)&1) return puts("First") & 0;
else return puts("Second") & 0;
}
}
|
a.cc: In function 'int main()':
a.cc:8:30: error: 'greater' was not declared in this scope
8 | sort(a + 1 , a + 1 + n , greater<int>());
| ^~~~~~~
a.cc:8:38: error: expected primary-expression before 'int'
8 | sort(a + 1 , a + 1 + n , greater<int>());
| ^~~
|
s515475683
|
p04037
|
C++
|
#pragma GCC optimize ("O3")
#pragma GCC target (sse, sse1, sse2, tune=native, popcnt)
#include <bits/stdc++.h>
/*
const int MAX_MEM = 25e7;
int mpos = 0;
char mem[MAX_MEM];
inline void* operator new(size_t n) {
char *res = mem + mpos;
mpos += n;
assert(mpos <= MAX_MEM);
return (void *) res;
}
inline void operator delete(void *) {}
*/
using namespace std;
#define loop(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, n) for(int i = a; i < n; ++i)
#define vec vector
#define paii pair<int, int>
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define SZ(x) (int)x.size()
#define Unique(x) x.erase(unique(all(x)), x.end())
#define ll long long
#define mp make_pair
#define int long long
const int inf = 1e9 + 47, MAXN = 2e 5 + 47, mod = 1e9 + 7, N = 20;
mt19937 rnd(time(0));
int n;
vec<int> val;
void solve() {
cin >> n;
val.resize(n);
loop(i, n) cin >> val[i];
sort(all(val));
reverse(all(val));
for(int i = n - 1; i >= 0; --i) {
int t = i + 1;
if(t <= val[i]) {
if(t % 2 == 1) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return ;
}
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie();
#ifdef COFFEE_MACHINE
freopen("input.cpp", "r", stdin);
freopen("output.cpp", "w", stdout);
#endif // COFFEE_MACHINE
int t = 1;
//cin >> t;
while(t--) {
solve();
}
}
|
a.cc:2:21: warning: '#pragma GCC option' is not a string [-Wpragmas]
2 | #pragma GCC target (sse, sse1, sse2, tune=native, popcnt)
| ^~~
a.cc:35:34: error: exponent has no digits
35 | const int inf = 1e9 + 47, MAXN = 2e 5 + 47, mod = 1e9 + 7, N = 20;
| ^~
a.cc:2:21: warning: '#pragma GCC option' is not a string [-Wpragmas]
2 | #pragma GCC target (sse, sse1, sse2, tune=native, popcnt)
| ^~~
|
s742449201
|
p04037
|
C++
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int n,a[100010];
int main(){
scanf("%d",&n);
for (int i=1;i<=n;i++) scanf("%d",&a[i]);
sort(a+1,a+n+1,greater<int>());
a[0]=a[1];
for (int i=0;i<=n;i++)
if (a[i+1]<=i){
int j=i+1;
while (j<=n&&a[j]==i) j++;
if ((j-i+1)&1||(a[i]-i)&1) puts("First");
else puts("Second");
break;
}
return 0;
}
//atcoder 1999
|
a.cc: In function 'int main()':
a.cc:15:20: error: 'greater' was not declared in this scope
15 | sort(a+1,a+n+1,greater<int>());
| ^~~~~~~
a.cc:15:28: error: expected primary-expression before 'int'
15 | sort(a+1,a+n+1,greater<int>());
| ^~~
|
s604267230
|
p04037
|
C++
|
inline int read()
{
int f=1,x=0; char c=getchar();
while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
return x*f;
}
int a[MAXN];
int main()
{
int n=read();
for (int i=1;i<=n;i++) a[i]=read();
sort(a+1,a+n+1,greater<int>());
for (int i=0;i<=n;i++)
if (i+1>a[i+1])
{
int r=i;
while (a[r+1]==i) r++;
puts((((a[i]-i)&1)||((r-i)&1))?"First":"Second");
break;
}
return 0;
}
|
a.cc: In function 'int read()':
a.cc:3:29: error: 'getchar' was not declared in this scope
3 | int f=1,x=0; char c=getchar();
| ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | inline int read()
a.cc: At global scope:
a.cc:8:7: error: 'MAXN' was not declared in this scope
8 | int a[MAXN];
| ^~~~
a.cc: In function 'int main()':
a.cc:12:32: error: 'a' was not declared in this scope
12 | for (int i=1;i<=n;i++) a[i]=read();
| ^
a.cc:13:14: error: 'a' was not declared in this scope
13 | sort(a+1,a+n+1,greater<int>());
| ^
a.cc:13:24: error: 'greater' was not declared in this scope
13 | sort(a+1,a+n+1,greater<int>());
| ^~~~~~~
a.cc:13:32: error: expected primary-expression before 'int'
13 | sort(a+1,a+n+1,greater<int>());
| ^~~
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort(a+1,a+n+1,greater<int>());
| ^~~~
| short
a.cc:19:25: error: 'puts' was not declared in this scope
19 | puts((((a[i]-i)&1)||((r-i)&1))?"First":"Second");
| ^~~~
|
s569021757
|
p04037
|
C++
|
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <set>
#include <random>
#define FOR(i, n, m) for(ll i = n; i < (int)m; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = std::int_fast64_t;
using P = pair<ll, ll>;
constexpr ll inf = 1000000000;
constexpr ll mod = 1000000007;
constexpr long double eps = 1e-15;
template<typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> p) {
os << to_string(p.first) << " " << to_string(p.second);
return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
REP(i, v.size()) {
if(i) os << " ";
os << to_string(v[i]);
}
return os;
}
struct modint {
ll n;
public:
modint(const ll n = 0) : n((n % mod + mod) % mod) {}
static modint pow(modint a, int m) {
modint r = 1;
while(m > 0) {
if(m & 1) { r *= a; }
a = (a * a); m /= 2;
}
return r;
}
modint &operator++() { *this += 1; return *this; }
modint &operator--() { *this -= 1; return *this; }
modint operator++(int) { modint ret = *this; *this += 1; return ret; }
modint operator--(int) { modint ret = *this; *this -= 1; return ret; }
modint operator~() const { return (this -> pow(n, mod - 2)); } // inverse
friend bool operator==(const modint& lhs, const modint& rhs) {
return lhs.n == rhs.n;
}
friend bool operator<(const modint& lhs, const modint& rhs) {
return lhs.n < rhs.n;
}
friend bool operator>(const modint& lhs, const modint& rhs) {
return lhs.n > rhs.n;
}
friend modint &operator+=(modint& lhs, const modint& rhs) {
lhs.n += rhs.n;
if (lhs.n >= mod) lhs.n -= mod;
return lhs;
}
friend modint &operator-=(modint& lhs, const modint& rhs) {
lhs.n -= rhs.n;
if (lhs.n < 0) lhs.n += mod;
return lhs;
}
friend modint &operator*=(modint& lhs, const modint& rhs) {
lhs.n = (lhs.n * rhs.n) % mod;
return lhs;
}
friend modint &operator/=(modint& lhs, const modint& rhs) {
lhs.n = (lhs.n * (~rhs).n) % mod;
return lhs;
}
friend modint operator+(const modint& lhs, const modint& rhs) {
return modint(lhs.n + rhs.n);
}
friend modint operator-(const modint& lhs, const modint& rhs) {
return modint(lhs.n - rhs.n);
}
friend modint operator*(const modint& lhs, const modint& rhs) {
return modint(lhs.n * rhs.n);
}
friend modint operator/(const modint& lhs, const modint& rhs) {
return modint(lhs.n * (~rhs).n);
}
};
istream& operator>>(istream& is, modint m) { is >> m.n; return is; }
ostream& operator<<(ostream& os, modint m) { os << m.n; return os; }
#define MAX_N 3030303
long long extgcd(long long a, long long b, long long& x, long long& y) {
long long d = a;
if (b != 0) {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
} else {
x = 1; y = 0;
}
return d;
}
long long mod_inverse(long long a, long long m) {
long long x, y;
if(extgcd(a, m, x, y) == 1) return (m + x % m) % m;
else return -1;
}
vector<long long> fact(MAX_N+1, inf);
long long mod_fact(long long n, long long& e) {
if(fact[0] == inf) {
fact[0]=1;
if(MAX_N != 0) fact[1]=1;
for(ll i = 2; i <= MAX_N; ++i) {
fact[i] = (fact[i-1] * i) % mod;
}
}
e = 0;
if(n == 0) return 1;
long long res = mod_fact(n / mod, e);
e += n / mod;
if((n / mod) % 2 != 0) return (res * (mod - fact[n % mod])) % mod;
return (res * fact[n % mod]) % mod;
}
// return nCk
long long mod_comb(long long n, long long k) {
if(n < 0 || k < 0 || n < k) return 0;
long long e1, e2, e3;
long long a1 = mod_fact(n, e1), a2 = mod_fact(k, e2), a3 = mod_fact(n - k, e3);
if(e1 > e2 + e3) return 0;
return (a1 * mod_inverse((a2 * a3) % mod, mod)) % mod;
}
using mi = modint;
mi mod_pow(ll a, ll n) {
mi ret = 1;
mi tmp = a;
while(n > 0) {
if(n % 2) ret *= tmp;
tmp = tmp * tmp;
n /= 2;
}
return ret;
}
int n;
void proc(queue<int>& q, int t) {
REP(i, n - t - 1) q.pop();
if(q.front()) cout << "First" << endl;
else cout << "Second" << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
vector<int> a(n);
REP(i, n) cin >> a[i];
sort(ALL(a));
queue<int> q;
REP(i, a[0]) {
if((a[0] - i) % 2) q.push(0);
else q.push(1);
if((int)q.size() >= n) {
proc(q, 0);
return 0;
}
}
FOR(i, 1, n) {
int back = q.back();
q.pop();
if(a[i] == a[i - 1]) q.push(!back);
else if((a[i] - a[i - 1]) % 2 || back == 0) q.push(1);
else q.push(0);
for(int j = a[i - 1] + 1; j <= a[i]; j++) {
if((a[i] - j) % 2 == 0) q.push(0);
else q.push(1);
if((int)q.size() >= n - i) {
proc(q, i);
return 0;
}
}
}
if(q.front()) cout << "First" << endl;
else cout << "Second" << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:159:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
159 | sort(ALL(a));
| ^~~~
| sqrt
|
s236370027
|
p04037
|
C++
|
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <set>
#include <random>
#define FOR(i, n, m) for(ll i = n; i < (int)m; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = std::int_fast64_t;
using P = pair<ll, ll>;
constexpr ll inf = 1000000000;
constexpr ll mod = 1000000007;
constexpr long double eps = 1e-15;
template<typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> p) {
os << to_string(p.first) << " " << to_string(p.second);
return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
REP(i, v.size()) {
if(i) os << " ";
os << to_string(v[i]);
}
return os;
}
struct modint {
ll n;
public:
modint(const ll n = 0) : n((n % mod + mod) % mod) {}
static modint pow(modint a, int m) {
modint r = 1;
while(m > 0) {
if(m & 1) { r *= a; }
a = (a * a); m /= 2;
}
return r;
}
modint &operator++() { *this += 1; return *this; }
modint &operator--() { *this -= 1; return *this; }
modint operator++(int) { modint ret = *this; *this += 1; return ret; }
modint operator--(int) { modint ret = *this; *this -= 1; return ret; }
modint operator~() const { return (this -> pow(n, mod - 2)); } // inverse
friend bool operator==(const modint& lhs, const modint& rhs) {
return lhs.n == rhs.n;
}
friend bool operator<(const modint& lhs, const modint& rhs) {
return lhs.n < rhs.n;
}
friend bool operator>(const modint& lhs, const modint& rhs) {
return lhs.n > rhs.n;
}
friend modint &operator+=(modint& lhs, const modint& rhs) {
lhs.n += rhs.n;
if (lhs.n >= mod) lhs.n -= mod;
return lhs;
}
friend modint &operator-=(modint& lhs, const modint& rhs) {
lhs.n -= rhs.n;
if (lhs.n < 0) lhs.n += mod;
return lhs;
}
friend modint &operator*=(modint& lhs, const modint& rhs) {
lhs.n = (lhs.n * rhs.n) % mod;
return lhs;
}
friend modint &operator/=(modint& lhs, const modint& rhs) {
lhs.n = (lhs.n * (~rhs).n) % mod;
return lhs;
}
friend modint operator+(const modint& lhs, const modint& rhs) {
return modint(lhs.n + rhs.n);
}
friend modint operator-(const modint& lhs, const modint& rhs) {
return modint(lhs.n - rhs.n);
}
friend modint operator*(const modint& lhs, const modint& rhs) {
return modint(lhs.n * rhs.n);
}
friend modint operator/(const modint& lhs, const modint& rhs) {
return modint(lhs.n * (~rhs).n);
}
};
istream& operator>>(istream& is, modint m) { is >> m.n; return is; }
ostream& operator<<(ostream& os, modint m) { os << m.n; return os; }
#define MAX_N 3030303
long long extgcd(long long a, long long b, long long& x, long long& y) {
long long d = a;
if (b != 0) {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
} else {
x = 1; y = 0;
}
return d;
}
long long mod_inverse(long long a, long long m) {
long long x, y;
if(extgcd(a, m, x, y) == 1) return (m + x % m) % m;
else return -1;
}
vector<long long> fact(MAX_N+1, inf);
long long mod_fact(long long n, long long& e) {
if(fact[0] == inf) {
fact[0]=1;
if(MAX_N != 0) fact[1]=1;
for(ll i = 2; i <= MAX_N; ++i) {
fact[i] = (fact[i-1] * i) % mod;
}
}
e = 0;
if(n == 0) return 1;
long long res = mod_fact(n / mod, e);
e += n / mod;
if((n / mod) % 2 != 0) return (res * (mod - fact[n % mod])) % mod;
return (res * fact[n % mod]) % mod;
}
// return nCk
long long mod_comb(long long n, long long k) {
if(n < 0 || k < 0 || n < k) return 0;
long long e1, e2, e3;
long long a1 = mod_fact(n, e1), a2 = mod_fact(k, e2), a3 = mod_fact(n - k, e3);
if(e1 > e2 + e3) return 0;
return (a1 * mod_inverse((a2 * a3) % mod, mod)) % mod;
}
using mi = modint;
mi mod_pow(ll a, ll n) {
mi ret = 1;
mi tmp = a;
while(n > 0) {
if(n % 2) ret *= tmp;
tmp = tmp * tmp;
n /= 2;
}
return ret;
}
int n;
void proc(queue<int>& q, int t) {
REP(i, n - t - 1) q.pop();
if(q.front()) cout << "First" << endl;
else cout << "Second" << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
vector<int> a(n);
REP(i, n) cin >> a[i];
sort(ALL(a));
queue<int> q;
REP(i, a[0]) {
if((a[0] - i) % 2) q.push(0);
else q.push(1);
if((int)q.size() == n) {
proc(q, 0);
return 0;
}
}
FOR(i, 1, n) {
int back = q.back();
q.pop();
if(a[i] == a[i - 1]) q.push(!back);
else if((a[i] - a[i - 1]) % 2 || back == 0) q.push(1);
else q.push(0);
for(int j = a[i - 1] + 1; j <= a[i]; j++) {
if((a[i] - j) % 2 == 0) q.push(0);
else q.push(1);
if((int)q.size() == n - i) {
proc(q, i);
return 0;
}
}
}
if(q.front()) cout << "First" << endl;
else cout << "Second" << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:159:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
159 | sort(ALL(a));
| ^~~~
| sqrt
|
s818434734
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
#define int long long
//template
template <typename T>
void fin(T a){
cout<<a<<endl;
exit(0);
}
/*
全体一個ずつだと小さい方から消えて行く
大きいの一山だと大きい方から消えて行く
残り一つにして相手に渡したら勝ち
i番目が最後の時かかるターンは?
v[i]+N-iターンで全部が消える
v[i]+N-iが奇数なら後手が、偶数なら先手が勝つ
v[i]-1==N-iみたいな状況に出来ると逆のことをすれば勝てる
v[i]-1とN-iを並べてみる
お互い出来るのは-1と+1と考えると?
v[i]-1とN-iの関係は?iが上がるとv[i]-1は上がってN-iは下がる
単純に常に相手と逆のことをしたらどうなる?
お互いk回ずつ行動した時、大きいのがk個消えて、全員k個減ってる
これで残り1つの山になるのはどんな時かと言うと
大きいのから数えてk+1個目がもともとk+1個以上あって、k+2個目がk個以内の時
この時k+1個目のやつ-kが奇数なら後手が勝って偶数なら先手が勝つ
これで後手が勝てるなら後手はこれをして勝つ
勝てないときは?
先手の最初の動きと同じ動きをすることでなんか変えられそう
例えばこれでたどり着き得る場所で両方さっきの状況が成り立てば勝ちなんだよね
いやもっと単純に、その3つの場所のうち
真ん中が後手勝ち->後手勝ち
真ん中が先手勝ち∩+か-が先手勝ち->先手勝ち
真ん中が先手勝ち∩+も-も後手勝ち->逃げ出せてないな
もっとこう、真ん中から見ていって、連続っぽいのがあった方の勝ちかな
つまり?
その時点での後手が勝ちに持っていけるようになったら勝ちなんだけど
大きいのを全部食べる操作をA、各一つずつをBとしたとき、山が最後の1個になる状態に対して
Aの方が一つ多くて山が偶数なら先手勝ち
いややっぱり連続してるところが先にあった方の勝ちな気がする
先手に対応していれば先手が勝っちゃいますよ、困ったをお互い繰り返し続けてる
両側に後手勝ちゾーンがあれば後手の勝ち
片側だけなら先手の勝ち
二分探索を使って各それに対しての勝敗を調べてあげればいい?
二分探索を書いてみるか
*/
int N;
std::vector<int> v(223456);
bool Fwin(int k){//最初のk回Aをした後に(その時点での)後手が相手に対応したら(もともとの)先手が勝ちますか
/*
大きいのがk個消えている
その後a回ずつやるので、大きいのがk+a消えてる∩全体がa減ってる
つまり、大きい方からk+a+1個目==v[k+a]がaより大きくk+a+2個目==v[k+a+1]がa以下であるようなaを探したい
そんなaがなかったら?
その後手の負け、先手は大きいの一つとって渡せるから
んでこのaをどうやって探すかと言うと
適当にaを設定して見たときに両方aより大きかったらaが小さすぎる
両方a以下だったらaが大きすぎる
んでこのaが見つかったら?
kが偶数、v[k+a]-aが奇数なら 後手の勝ち
見つからなかったら?
kが偶数なら先手の勝ち
*/
int l=0,r=N+1,a;
for(int i=0;i<25;i++){
a=(l+r)>>1;//cout<<k<<" "<<a<<endl;
if(v[k+a+1]>a)l=a;
if(v[k+a]<=a)r=a;
if(v[k+a]>a&&v[k+a+1]<=a)break;
}
if(v[k+a]>a&&v[k+a+1]<=a){
if((k&1)^((v[k+a]-a)&1))return false;
return true;
}
if(k&1)return false;
return true;
}
bool Fwin2(int k){
/*
考え方は概ねさっきと一緒
大きい方からa+1個目==v[a]がk+aより大きくてa+2個目==v[a+1]がk+a以下であるようなaを探したい
*/
int l=0,r=N+1,a;
for(int i=0;i<25;i++){
a=(l+r)>>1;
if(v[a]<=k+a)r=a;
if(v[a+1]>k+a)l=a;
if(v[a]>k+a&&v[a+1]<=k+a)break;
}
if(v[a]>k+a&&v[a+1]<=k+a){
if((k&1)^((v[a]-k+a)&1))return false;
return true;
}
if(k&1)return false;
return true;
}
//main
signed main(){
cin>>N;int o=0,s=0;
for(int i=0;i<N;i++)cin>>v[i];
sort(v.rbegin(),v.rend());
for(int k=0;k<=N;k++){
if(((k&1)+Fwin(k))==2)fin("First");
if(((k&1)+Fwin(k))==0)o++,break;
}
for(int k=0;k<=min(30000000LL,v[0]);k++){
if(((k&1)+Fwin2(k))==2)fin("First");
if(((k&1)+Fwin2(k))==0)o++,break;
}
if(o==2)fin("Second");
o/=s;
}
|
a.cc: In function 'int main()':
a.cc:108:31: error: expected primary-expression before 'break'
108 | if(((k&1)+Fwin(k))==0)o++,break;
| ^~~~~
a.cc:112:32: error: expected primary-expression before 'break'
112 | if(((k&1)+Fwin2(k))==0)o++,break;
| ^~~~~
|
s726033492
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
#define int long long
//template
template <typename T>
void fin(T a){
cout<<a<<endl;
exit(0);
}
/*
全体一個ずつだと小さい方から消えて行く
大きいの一山だと大きい方から消えて行く
残り一つにして相手に渡したら勝ち
i番目が最後の時かかるターンは?
v[i]+N-iターンで全部が消える
v[i]+N-iが奇数なら後手が、偶数なら先手が勝つ
v[i]-1==N-iみたいな状況に出来ると逆のことをすれば勝てる
v[i]-1とN-iを並べてみる
お互い出来るのは-1と+1と考えると?
v[i]-1とN-iの関係は?iが上がるとv[i]-1は上がってN-iは下がる
単純に常に相手と逆のことをしたらどうなる?
お互いk回ずつ行動した時、大きいのがk個消えて、全員k個減ってる
これで残り1つの山になるのはどんな時かと言うと
大きいのから数えてk+1個目がもともとk+1個以上あって、k+2個目がk個以内の時
この時k+1個目のやつ-kが奇数なら後手が勝って偶数なら先手が勝つ
これで後手が勝てるなら後手はこれをして勝つ
勝てないときは?
先手の最初の動きと同じ動きをすることでなんか変えられそう
例えばこれでたどり着き得る場所で両方さっきの状況が成り立てば勝ちなんだよね
いやもっと単純に、その3つの場所のうち
真ん中が後手勝ち->後手勝ち
真ん中が先手勝ち∩+か-が先手勝ち->先手勝ち
真ん中が先手勝ち∩+も-も後手勝ち->逃げ出せてないな
もっとこう、真ん中から見ていって、連続っぽいのがあった方の勝ちかな
つまり?
その時点での後手が勝ちに持っていけるようになったら勝ちなんだけど
大きいのを全部食べる操作をA、各一つずつをBとしたとき、山が最後の1個になる状態に対して
Aの方が一つ多くて山が偶数なら先手勝ち
いややっぱり連続してるところが先にあった方の勝ちな気がする
先手に対応していれば先手が勝っちゃいますよ、困ったをお互い繰り返し続けてる
両側に後手勝ちゾーンがあれば後手の勝ち
片側だけなら先手の勝ち
二分探索を使って各それに対しての勝敗を調べてあげればいい?
二分探索を書いてみるか
*/
int N;
std::vector<int> v(123456);
bool Fwin(int k){//最初のk回Aをした後に(その時点での)後手が相手に対応したら(もともとの)先手が勝ちますか
/*
大きいのがk個消えている
その後a回ずつやるので、大きいのがk+a消えてる∩全体がa減ってる
つまり、大きい方からk+a+1個目==v[k+a]がaより大きくk+a+2個目==v[k+a+1]がa以下であるようなaを探したい
そんなaがなかったら?
その後手の負け、先手は大きいの一つとって渡せるから
んでこのaをどうやって探すかと言うと
適当にaを設定して見たときに両方aより大きかったらaが小さすぎる
両方a以下だったらaが大きすぎる
んでこのaが見つかったら?
kが偶数、v[k+a]-aが奇数なら 後手の勝ち
見つからなかったら?
kが偶数なら先手の勝ち
*/
int l=0,r=N-k,a;
for(int i=0;i<25;i++){
a=(l+r)>>1;//cout<<k<<" "<<a<<endl;
if(v[k+a+1]>a)l=a;
if(v[k+a]<=a)r=a;
if(v[k+a]>a&&v[k+a+1]<=a)break;
}
if(v[k+a]>a&&v[k+a+1]<=a){
if((k&1)^((v[k+a]-a)&1))return false;
else return true;
}
if(k&1)return false;
return true;
}
bool Fwin2(int k){
/*
考え方は概ねさっきと一緒
大きい方からa+1個目==v[a]がk+aより大きくてa+2個目==v[a+1]がk+a以下であるようなaを探したい
*/
int l=0,r=N,a;
for(int i=0;i<25;i++){
a=(l+r)>>1;
if(v[a]<=k+a)r=a;
if(v[a+1]>k+a)l=a;
if(v[a]>k+a&&v[a+1]<=k+a)break;
}
if(v[a]>k+a&&v[a+1]<=k+a){
if((k&1)^((v[a]-k+a)&1))return false;
else return true;
}
if(k&1)return false;
return true;
}
//main
signed main(){
cin>>N;
for(int i=0;i<N;i++)cin>>v[i];
sort(v.rbegin(),v.rend());
for(int k=0;k<=N;k++){
if(((k&1)+Fwin(k))==2)fin("First");
if(((k&1)+Fwin(k))==0)break;
}
for(int k=0;k<=min(3e7,v[0]);k++){
if(((k&1)+Fwin2(k))==2)fin("First");
if(((k&1)+Fwin2(k))==0)break;
}
fin("Second");
}
|
a.cc: In function 'int main()':
a.cc:110:21: error: no matching function for call to 'min(double, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
110 | for(int k=0;k<=min(3e7,v[0]);k++){
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:110:21: note: deduced conflicting types for parameter 'const _Tp' ('double' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
110 | for(int k=0;k<=min(3e7,v[0]);k++){
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:110:21: note: mismatched types 'std::initializer_list<_Tp>' and 'double'
110 | for(int k=0;k<=min(3e7,v[0]);k++){
| ~~~^~~~~~~~~~
|
s802623777
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
#define int long long
//template
template <typename T>
void fin(T a){
cout<<a<<endl;
exit(0);
}
/*
全体一個ずつだと小さい方から消えて行く
大きいの一山だと大きい方から消えて行く
残り一つにして相手に渡したら勝ち
i番目が最後の時かかるターンは?
v[i]+N-iターンで全部が消える
v[i]+N-iが奇数なら後手が、偶数なら先手が勝つ
v[i]-1==N-iみたいな状況に出来ると逆のことをすれば勝てる
v[i]-1とN-iを並べてみる
お互い出来るのは-1と+1と考えると?
v[i]-1とN-iの関係は?iが上がるとv[i]-1は上がってN-iは下がる
単純に常に相手と逆のことをしたらどうなる?
お互いk回ずつ行動した時、大きいのがk個消えて、全員k個減ってる
これで残り1つの山になるのはどんな時かと言うと
大きいのから数えてk+1個目がもともとk+1個以上あって、k+2個目がk個以内の時
この時k+1個目のやつ-kが奇数なら後手が勝って偶数なら先手が勝つ
これで後手が勝てるなら後手はこれをして勝つ
勝てないときは?
先手の最初の動きと同じ動きをすることでなんか変えられそう
例えばこれでたどり着き得る場所で両方さっきの状況が成り立てば勝ちなんだよね
いやもっと単純に、その3つの場所のうち
真ん中が後手勝ち->後手勝ち
真ん中が先手勝ち∩+か-が先手勝ち->先手勝ち
真ん中が先手勝ち∩+も-も後手勝ち->逃げ出せてないな
もっとこう、真ん中から見ていって、連続っぽいのがあった方の勝ちかな
つまり?
その時点での後手が勝ちに持っていけるようになったら勝ちなんだけど
大きいのを全部食べる操作をA、各一つずつをBとしたとき、山が最後の1個になる状態に対して
Aの方が一つ多くて山が偶数なら先手勝ち
いややっぱり連続してるところが先にあった方の勝ちな気がする
先手に対応していれば先手が勝っちゃいますよ、困ったをお互い繰り返し続けてる
両側に後手勝ちゾーンがあれば後手の勝ち
片側だけなら先手の勝ち
二分探索を使って各それに対しての勝敗を調べてあげればいい?
二分探索を書いてみるか
*/
int N;
std::vector<int> v(123456);
bool Fwin(int k){//最初のk回Aをした後に(その時点での)後手が相手に対応したら(もともとの)先手が勝ちますか
/*
大きいのがk個消えている
その後a回ずつやるので、大きいのがk+a消えてる∩全体がa減ってる
つまり、大きい方からk+a+1個目==v[k+a]がaより大きくk+a+2個目==v[k+a+1]がa以下であるようなaを探したい
そんなaがなかったら?
その後手の負け、先手は大きいの一つとって渡せるから
んでこのaをどうやって探すかと言うと
適当にaを設定して見たときに両方aより大きかったらaが小さすぎる
両方a以下だったらaが大きすぎる
んでこのaが見つかったら?
kが偶数、v[k+a]-aが奇数なら 後手の勝ち
見つからなかったら?
kが偶数なら先手の勝ち
*/
int l=0,r=N-k,a;
for(int i=0;i<25;i++){
a=(l+r)>>1;//cout<<k<<" "<<a<<endl;
if(v[k+a+1]>a)l=a;
if(v[k+a]<=a)r=a;
if(v[k+a]>a&&v[k+a+1]<=a)break;
}
if(v[k+a]>a&&v[k+a+1]<=a){
if((k&1)^((v[k+a]-a)&1))return false;
else return true;
}
if(k&1)return false;
return true;
}
bool Fwin2(int k){
/*
考え方は概ねさっきと一緒
大きい方からa+1個目==v[a]がk+aより大きくてa+2個目==v[a+1]がk+a以下であるようなaを探したい
*/
int l=0,r=N,a;
for(int i=0;i<25;i++){
a=(l+r)>>1;
if(v[a]<=k+a)r=a;
if(v[a+1]>k+a)l=a;
if(v[a]>k+a&&v[a+1]<=k+a)break;
}
if(v[a]>k+a&&v[a+1]<=k+a){
if((k&1)^((v[a]-k+a)&1))return false;
else return true;
}
if(k&1)return false;
return true;
}
//main
signed main(){
cin>>N;
for(int i=0;i<N;i++)cin>>v[i];
sort(v.rbegin(),v.rend());
for(int k=0;k<=N;k++){
if(((k&1)+Fwin(k))==2)fin("First");
if(((k&1)+Fwin(k))==0)break;
}
for(int k=0;k<=1e6;k++){
if((k&1)+Fwin2(k))==2)fin("First");
if(((k&1)+Fwin2(k))==0)break;
}
fin("Second");
}
|
a.cc: In function 'int main()':
a.cc:111:23: error: expected primary-expression before '==' token
111 | if((k&1)+Fwin2(k))==2)fin("First");
| ^~
|
s742369518
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
const int mxN=1e5;
int n, a[mxN];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i=0; i<n; ++i)
cin >> a[i];
sort(a, a+n, greater<int>());
int i=0;
for(; i<n&&i<a[i]; ++i);
cout << (a[i-1]-i+1&1&&find(a, a+n, i-1, greater<int>())-a-i+1&1?"Second":"First");
}
|
a.cc: In function 'int main()':
a.cc:17:36: error: no matching function for call to 'find(int [100000], int*, int, std::greater<int>)'
17 | cout << (a[i-1]-i+1&1&&find(a, a+n, i-1, greater<int>())-a-i+1&1?"Second":"First");
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:3842:5: note: candidate: 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
3842 | find(_InputIterator __first, _InputIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842:5: note: candidate expects 3 arguments, 4 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: template argument deduction/substitution failed:
a.cc:17:36: note: deduced conflicting types for parameter '_ForwardIterator' ('int*' and 'int')
17 | cout << (a[i-1]-i+1&1&&find(a, a+n, i-1, greater<int>())-a-i+1&1?"Second":"First");
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate expects 3 arguments, 4 provided
|
s800803451
|
p04037
|
C++
|
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+7; int n,ans,a[N];
int main(){
scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]);
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++)
if(i+1>a[i+1]){
for(int j=i+1;a[j]==i;j++) ans^=1; ans|=(a[i]-i)&1;
if(ans) puts("First"); else puts("Second"); break;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:6:20: error: 'cmp' was not declared in this scope; did you mean 'bcmp'?
6 | sort(a+1,a+n+1,cmp);
| ^~~
| bcmp
|
s209969097
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int n, ans, ans2= 1000000900;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
ans = max(a, ans);
ans2 = min(a, ans2);
}
if((ans + n - ans2) % 2 == )
return cout << "First",0;
cout << "Second";
}
|
a.cc: In function 'int main()':
a.cc:13:36: error: expected primary-expression before ')' token
13 | if((ans + n - ans2) % 2 == )
| ^
|
s082723506
|
p04037
|
C++
|
using namespace std;
void read(int &x) {
x=0;int f=1;char ch=getchar();
for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}
void print(int x) {
if(x<0) putchar('-'),x=-x;
if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}
#define lf double
#define ll long long
#define pii pair<int,int >
#define vec vector<int >
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
const int maxn = 1e5+10;
const int inf = 1e9;
const lf eps = 1e-8;
int n,a[maxn],ans;
int main() {
read(n);for(int i=1;i<=n;i++) read(a[i]);
sort(a+1,a+n+1),reverse(a+1,a+n+1);a[0]=a[1];
for(int i=0;i<=n;i++)
if(a[i+1]<=i) {
ans=(a[i]-i)&1;
int j=i;while(a[j]==i&&j<=n) j++;
ans|=(j-i+1)&1;break;
}puts(ans?"First":"Second");
return 0;
}
|
a.cc: In function 'void read(int&)':
a.cc:5:25: error: 'getchar' was not declared in this scope
5 | x=0;int f=1;char ch=getchar();
| ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 |
a.cc:6:11: error: 'isdigit' was not declared in this scope
6 | for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
| ^~~~~~~
a.cc:7:10: error: 'isdigit' was not declared in this scope
7 | for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
| ^~~~~~~
a.cc: In function 'void print(int)':
a.cc:11:13: error: 'putchar' was not declared in this scope; did you mean 'char'?
11 | if(x<0) putchar('-'),x=-x;
| ^~~~~~~
| char
a.cc:12:32: error: 'putchar' was not declared in this scope; did you mean 'char'?
12 | if(!x) return ;print(x/10),putchar(x%10+48);
| ^~~~~~~
| char
a.cc: In function 'void write(int)':
a.cc:14:27: error: 'putchar' was not declared in this scope; did you mean 'char'?
14 | void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}
| ^~~~~~~
| char
a.cc:14:54: error: 'putchar' was not declared in this scope; did you mean 'char'?
14 | void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}
| ^~~~~~~
| char
a.cc: In function 'int main()':
a.cc:35:5: error: 'sort' was not declared in this scope; did you mean 'short'?
35 | sort(a+1,a+n+1),reverse(a+1,a+n+1);a[0]=a[1];
| ^~~~
| short
a.cc:35:21: error: 'reverse' was not declared in this scope
35 | sort(a+1,a+n+1),reverse(a+1,a+n+1);a[0]=a[1];
| ^~~~~~~
a.cc:41:10: error: 'puts' was not declared in this scope
41 | }puts(ans?"First":"Second");
| ^~~~
|
s826612111
|
p04037
|
C++
|
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using pint = pair<int,int>;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
bool isodd(const pint &p) { return (p.first + p.second) & 1; }
bool solve(vector<int> &a) {
int N = (int)a.size();
sort(a.begin(), a.end(), greater<int>());
int x = 0, y = a[0];
vector<pint> ps;
for (int i = 0; i < N; ++i) {
if (a[i] != y) ps.push_back(pint(i-1, y)), y = a[i];
}
ps.push_back(pint(N-1, a[N-1]));
//COUT(ps);
if (ps.size() == 1) return isodd(ps[0]);
for (auto p : ps) if (p.first == p.second) return false;
for (int i = 0; i + 1 < ps.size(); ++i) {
if (ps[i].first < ps[i].second && ps[i+1].first > ps[i+1].second) {
if (ps[i].first < ps[i+1].second) return isodd(ps[i]);
else if (ps[i].first > ps[i+1].second) return isodd(ps[i+1]);
else return isodd(ps[i]) || isodd(ps[i+1);
}
}
if (ps[0].first > ps[0].second) return isodd(ps[0]);
else return isodd(ps.back());
}
int main() {
int N;
while (cin >> N) {
vector<int> a(N);
for (int i = 0; i < N; ++i) cin >> a[i], --a[i];
if (solve(a)) cout << "First" << endl;
else cout << "Second" << endl;
}
}
|
a.cc: In function 'bool solve(std::vector<int>&)':
a.cc:34:53: error: expected ']' before ')' token
34 | else return isodd(ps[i]) || isodd(ps[i+1);
| ^
| ]
|
s709425696
|
p04037
|
C
|
//Zory-2019
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<bitset>
#include<vector>
#include<algorithm>
#include<iostream>
#include<deque>
// #include<unordered_map>
using namespace std;
int bin[40],lg[1<<21];
namespace mine
{
typedef long long ll;
#define double long double
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3fll;
ll qread()
{
ll ans=0;char c=getchar();int f=1;
while(c<'0' or c>'9') {if(c=='-') f=-1;c=getchar();}
while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
return ans*f;
}
void write(ll num)
{
if(num<0) {num=-num;putchar('-');}
if(num>9) write(num/10);
putchar('0'+num%10);
}
void writeln(int num){write(num);puts("");}
#define FR first
#define SE second
#define MP make_pair
#define pr pair<int,int>
#define PB push_back
#define vc vector
void chmax(int &x,const int y) {x=x>y?x:y;}
void chmin(int &x,const int y) {x=x<y?x:y;}
const int MAX_N=1e5+10;
const int MOD=1e9+7;
void add(int &x,int y) {x+=y;if(x>=MOD) x-=MOD;if(x<0) x+=MOD;}
int a[MAX_N];
void main()
{
int n=qread();for(int i=1;i<=n;i++) a[i]=qread();
sort(a+1,a+n+1);reverse(a+1,a+n+1);
for(int x=1;x<=n;x++)
if(x+1>a[x+1])
{
int up=(a[x]-x),right=0;
while(x+right+1<=n and x<=a[x+right+1]) right++;
int now;
if(up==0 and right==0) now=0;
else if(up==0) now=right&1;
else if(right==0) now=up&1;
else now=(up!=0 and right!=0);
puts(now?"First":"Second");
break;
}
}
};
int main()
{
srand(time(0));
bin[0]=1;for(int i=1;i<=30;i++) bin[i]=bin[i-1]<<1;
lg[1]=0;for(int i=2;i<(1<<21);i++) lg[i]=lg[i>>1]+1;
mine::main();
}
|
main.c:2:9: fatal error: cmath: No such file or directory
2 | #include<cmath>
| ^~~~~~~
compilation terminated.
|
s313457624
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void Max(T &m, const T q) { if (m < q) m = q; }
template<typename T> void Min(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
int N;
vector<int> A;
void First()
{
puts("First");
exit(0);
}
void Second()
{
puts("Second");
exit(0);
}
int main()
{
cin >> N;
A.resize(N);
cin >> A;
A.push_back(0);
A.push_back(1E9 + 1);
sort(A.rbegin(), A.rend());
set<int> bad_ymx;
int x = 1, y = A[1];
while (x <= N)
{
if (A[x] == y and A[x + 1] < A[x])
{
// 下がる
int bad = 1;
if (y > 3E5)
{
y -= (y - max<int>(A[i + 1] + 10, 2E5)) / 2 * 2;
}
while (y > A[x + 1])
{
if (bad) bad_ymx.insert(y - x);
bad = !bad;
y--;
}
}
else
{
int xt = x;
while (A[xt + 1] == A[x]) xt++;
bool bad = true;
while (xt > x)
{
if (bad) bad_ymx.insert(y - xt);
bad = !bad;
xt--;
}
if (!bad_ymx.count(y - x - 1) and !bad_ymx.count(y - x + 1)) bad_ymx.insert(y - x);
while (A[x + 1] == A[x]) x++;
}
}
if (bad_ymx.count(0)) Second();
else First();
}
|
a.cc: In function 'int main()':
a.cc:65:38: error: 'i' was not declared in this scope
65 | y -= (y - max<int>(A[i + 1] + 10, 2E5)) / 2 * 2;
| ^
|
s968455954
|
p04037
|
C++
|
#include<cstdio>
2 #include<cstring>
3 #include<algorithm>
4 using namespace std;
5 int n,ans,a[100100];
6 int main(){
7 scanf("%d",&n);
8 for(int i=1;i<=n;i++) scanf("%d",&a[i]);
9 sort(a+1,a+n+1);
10 reverse(a+1,a+n+1);
11 for(int i=1;i<=n;i++){
12 if(i+1>a[i+1]){
13 for(int j=i+1;a[j]==i;j++) ans^=1;
14 ans|=(a[i]-i)&1;
15 puts(ans? "First":"Second");
16 return 0;
17 }
18 }
19 }
|
a.cc:2:4: error: stray '#' in program
2 | 2 #include<cstring>
| ^
a.cc:3:4: error: stray '#' in program
3 | 3 #include<algorithm>
| ^
a.cc:2:2: error: expected unqualified-id before numeric constant
2 | 2 #include<cstring>
| ^
a.cc:5:2: error: expected unqualified-id before numeric constant
5 | 5 int n,ans,a[100100];
| ^
a.cc:6:2: error: expected unqualified-id before numeric constant
6 | 6 int main(){
| ^
|
s069910591
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vl;
typedef vector<string> vst; typedef vector<bool> vb; typedef vector<ld> vld; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<vector<int> > vvi;
const int INF = (0x7FFFFFFFL); const ll INFF = (0x7FFFFFFFFFFFFFFFL); const string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int MOD = 1e9 + 7; const int MODD = 998244353; const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1.0); const double EPS = 1e-9; const string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int dx[9] = { 1, 0, -1, 0, 1, -1, -1, 1, 0 };
int dy[9] = { 0, 1, 0, -1, -1, -1, 1, 1, 0 };
#define ln '\n'
#define scnaf scanf
#define sacnf scanf
#define sancf scanf
#define SS(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t){cin >> t;}template<typename First, typename...Rest> void MACRO_VAR_Scan(First& first, Rest&...rest){cin >> first;MACRO_VAR_Scan(rest...);}
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
#define SVV(type,c,n,m) vector<vector<type>> c(n,vector<type>(m));for(auto& r:c)for(auto& i:r)cin >> i;
template<class T>ostream &operator<<(ostream &o,const vector<T>&j){o<<"{";for(int i=0;i<(int)j.size();++i)o<<(i>0?", ":"")<<j[i];o<<"}";return o;}
template<class T,class U>ostream &operator<<(ostream &o,const pair<T,U>&j){o<<"{"<<j.first<<", "<<j.second<<"}";return o;}
template<class T,class U>ostream &operator<<(ostream &o,const map<T,U>&j){o<<"{";for(auto t=j.begin();t!=j.end();++t)o<<(t!=j.begin()?", ":"")<<*t;o<<"}";return o;}
template<class T>ostream &operator<<(ostream &o,const set<T>&j){o<<"{";for(auto t=j.begin();t!=j.end();++t)o<<(t!=j.begin()?", ":"")<<*t;o<<"}";return o;}
inline void print(void){cout << endl;}
template<class Head> void print(Head&& head){cout << head;print();} template<class Head,class... Tail> void print(Head&& head,Tail&&... tail){cout<<head<<" ";print(forward<Tail>(tail)...);}
inline void debug(void){cerr << endl;}
template<class Head> void debug(Head&& head){cerr << head;debug();} template<class Head,class... Tail> void debug(Head&& head,Tail&&... tail){cerr<<head<<" ";debug(forward<Tail>(tail)...);}
template<typename T> void PA(T &a){int ASIZE=sizeof(a)/sizeof(a[0]);for(int ii=0;ii<ASIZE;++ii){cout<<a[ii]<<" \n"[ii==ASIZE-1];}}
template<typename T> void PV(T &v){int VSIZE=v.size();for(int ii=0;ii<VSIZE;++ii){cout<<v[ii]<<" \n"[ii==VSIZE-1];}}
#define ER(x) cerr << #x << " = " << (x) << endl;
#define ERV(v) {cerr << #v << " : ";for(const auto& xxx : v){cerr << xxx << " ";}cerr << "\n";}
inline void YES(bool x){cout<<((x)?"YES":"NO")<<endl;} inline void Yes(bool x){cout<<((x)?"Yes":"No")<<endl;} inline void yes(bool x){cout<<((x)?"yes":"no")<<endl;}
inline void yES(bool x){cout<<((x)?"yES":"nO")<<endl;} inline void Yay(bool x){cout<<((x)?"Yay!":":(")<<endl;}
template<typename A,typename B> void sankou(bool x,A a,B b){cout<<((x)?(a):(b))<<endl;}
#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REPI,_REP,)(__VA_ARGS__)
#define _RREP(i,n) RREPI(i,n,0)
#define RREPI(i,a,b) for(ll i=ll(a);i>=ll(b);--i)
#define RREP(...) _overload3(__VA_ARGS__,RREPI,_RREP,)(__VA_ARGS__)
#define EACH(e,v) for(auto& e : v)
#define PERM(v) sort((v).begin(),(v).end());for(bool c##p=1;c##p;c##p=next_permutation((v).begin(),(v).end()))
#define ADD(a,b) a=(a+ll(b))%MOD
#define MUL(a,b) a=(a*ll(b))%MOD
inline ll MOP(ll x,ll n,ll m=MOD){ll r=1;while(n>0){if(n&1)(r*=x)%=m;(x*=x)%=m;n>>=1;}return r;}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}inline ll lcm(ll a,ll b){return a*b/gcd(a,b);}inline ll POW(ll a,ll b){ll c=1ll;do{if(b&1)c*=1ll*a;a*=1ll*a;}while(b>>=1);return c;}
template<typename T> inline bool between(T x,T a,T b) {return ((a<=x)&&(x<b));}template<class T> inline T sqr(T x){return x*x;}
template<typename A,typename B> inline bool chmax(A &a,const B &b){if(a<b){a=b;return 1;}return 0;}
template<typename A,typename B> inline bool chmin(A &a,const B &b){if(a>b){a=b;return 1;}return 0;}
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
#define PB push_back
#define MP make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort((v).begin(),(v).end())
#define RSORT(v) sort((v).rbegin(),(v).rend())
#define EXIST(s,e) (find((s).begin(),(s).end(),(e))!=(s).end())
#define EXISTST(s,c) (((s).find(c))!=string::npos)
#define POSL(x,val) (lower_bound(x.begin(),x.end(),val)-x.begin())
#define POSU(x,val) (upper_bound(x.begin(),x.end(),val)-x.begin())
#define SZV(a) int((a).size())
#define SZA(a) sizeof(a)/sizeof(a[0])
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMINF(a) memset(a,0x3f,sizeof(a))
#define FILL(a,b) memset(a,b,sizeof(a))
#define UNIQUE(v) sort((v).begin(),(v).end());(v).erase(unique((v).begin(),(v).end()),(v).end())
struct abracadabra{
abracadabra(){
cin.tie(0); ios::sync_with_stdio(0);
cout << fixed << setprecision(20);
};
} ABRACADABRA;
//#define int long long
//---------------8<---------------8<---------------8<---------------8<---------------//
signed main() {
SS(int,N);
SV(int,A,N);
RSORT(A);
vi B;
B.PB(A[0]+1);
EACH(e,A) B.PB(e+1);
ll bef;
REP(i,N+1) {
if (B[i] < i+1) {
bef = i - 2;
break;
}
}
ll dis1, dis2 = 0;
dis1 = B[bef+1] - bef - 1;
ll pivot = bef;
while (B[min(++pivot,N)] > bef+1) dis2++;
sankou((dis1%2==1)&&(dis2%2==1), "Second", "First");
}
|
a.cc: In function 'int main()':
a.cc:99:21: error: no matching function for call to 'min(ll&, int&)'
99 | while (B[min(++pivot,N)] > bef+1) dis2++;
| ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:99:21: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
99 | while (B[min(++pivot,N)] > bef+1) dis2++;
| ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:99:21: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
99 | while (B[min(++pivot,N)] > bef+1) dis2++;
| ~~~^~~~~~~~~~~
|
s008196793
|
p04037
|
C++
|
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<climits>
using namespace std;
void File(){
freopen("AGC02E.in","r",stdin);
freopen("AGC02E.out","w",stdout);
}
template<typename T>bool chkmax(T &_,T __){return _<__ ? (_=__,1) : 0;}
template<typename T>bool chkmin(T &_,T __){return _>__ ? (_=__,1) : 0;}
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
#define MREP(i,x) for(register int i=beg[x];i;i=E[i].last)
#define mem(a) memset(a,0,sizeof(a))
#define inf INT_MAX
const int maxn=1e5+10;
int n,a[maxn],SG[1010][1010];
bool in[maxn];
bool cmp(int _,int __){return _>__;}
bool judge(int x,int y){return x>n || y>a[x];}
int get_SG(int x,int y){
if(judge(x,y))return 1;
if(judge(x+1,y+1)){
if(get_SG(x+1,y) && get_SG(x,y+1))
return 0;
else return 1;
}
return get_SG(x+1,y+1);
}
int main(){
//File();
int size = 256 << 20; // 256MB
char *p = (char*)malloc(size) + size;
__asm__("movl %0, %%esp\n" :: "r"(p));
scanf("%d",&n);
REP(i,1,n)scanf("%d",&a[i]);
sort(a+1,a+n+1,cmp);
/*REP(i,1,n+1)REP(j,1,a[1]+1)
SG[i][j]=1;
REP(i,1,n)REP(j,1,a[i])
SG[i][j]=0;
DREP(i,n,1)DREP(j,a[i],1){
mem(in);
in[SG[i+1][j]]=1;
in[SG[i][j+1]]=1;
REP(k,0,5)if(!in[k]){
SG[i][j]=k!=0;
break;
}
}
REP(i,1,n){
REP(j,1,a[i])cout<<(SG[i][j])<<" ";
cout<<endl;
}
cout<<endl<<endl;
REP(i,1,n){
REP(j,1,a[i])cout<<get_SG(i,j)<<" ";
cout<<endl;
}*/
if(get_SG(1,1))puts("First");
else puts("Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:39:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
39 | REP(i,1,n)scanf("%d",&a[i]);
| ^
a.cc:14:37: note: in definition of macro 'REP'
14 | #define REP(i,a,b) for(register int i=a;i<=b;++i)
| ^
a.cc: Assembler messages:
a.cc:37: Error: operand type mismatch for `mov'
|
s992214429
|
p04037
|
C++
|
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<climits>
using namespace std;
void File(){
freopen("AGC02E.in","r",stdin);
freopen("AGC02E.out","w",stdout);
}
template<typename T>bool chkmax(T &_,T __){return _<__ ? (_=__,1) : 0;}
template<typename T>bool chkmin(T &_,T __){return _>__ ? (_=__,1) : 0;}
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
#define MREP(i,x) for(register int i=beg[x];i;i=E[i].last)
#define mem(a) memset(a,0,sizeof(a))
#define inf INT_MAX
const int maxn=1e5+10;
int n,a[maxn],SG[1010][1010];
bool in[maxn];
bool cmp(int _,int __){return _>__;}
bool judge(int x,int y){return x>n || y>a[x];}
int get_SG(int x,int y){
//cerr<<x<<" "<<y<<endl;
if(judge(x,y))return 1;
if(judge(x+1,y+1)){
if(get_SG(x+1,y) && get_SG(x,y+1))
return 0;
else return 1;
}
return get_SG(x+1,y+1);
}
int main(){
int size = 256 << 20; // 256MB
char *p = (char*)malloc(size) + size;
__asm__("movl %0, %%esp\n" :: "r"(p));
//File();
scanf("%d",&n);
REP(i,1,n)scanf("%d",&a[i]);
sort(a+1,a+n+1,cmp);
/*REP(i,1,n+1)REP(j,1,a[1]+1)
SG[i][j]=1;
REP(i,1,n)REP(j,1,a[i])
SG[i][j]=0;
DREP(i,n,1)DREP(j,a[i],1){
mem(in);
in[SG[i+1][j]]=1;
in[SG[i][j+1]]=1;
REP(k,0,5)if(!in[k]){
SG[i][j]=k!=0;
break;
}
}
REP(i,1,n){
REP(j,1,a[i])cout<<(SG[i][j])<<" ";
cout<<endl;
}
cout<<endl<<endl;
REP(i,1,n){
REP(j,1,a[i])cout<<get_SG(i,j)<<" ";
cout<<endl;
}*/
if(get_SG(1,1))puts("First");
else puts("Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:40:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
40 | REP(i,1,n)scanf("%d",&a[i]);
| ^
a.cc:14:37: note: in definition of macro 'REP'
14 | #define REP(i,a,b) for(register int i=a;i<=b;++i)
| ^
a.cc: Assembler messages:
a.cc:37: Error: operand type mismatch for `mov'
|
s451208556
|
p04037
|
C++
|
#include <iostream>
#include <algorithm>
using namespace std;
long long n, a[(1<<20)];
pair < long long, long long > proj ( long long y, long long x ) {
long long c = min( x, y );
return make_pair( y-c, x-c );
}
void printS( long long c ) {
if ( c%2 ) { cout << "First\n"; }
else { cout << "Second\n"; }
}
int main () {
cin >> n;
for ( long long i = 0 ; i < n ; i ++ ) {
cin >> a[i];
}
sort( a, a+n );
reverse( a, a+n );
for ( long long i = 0 ; i < n ; i ++ ) {
if ( i == n-1 || a[i+1] < a[i] ) {
pair < long long , long long > c = proj( a[i]-1, i );
if ( c.first == 0 && c.second == 0 ) { cout << "Second\n"; return 0; }
if ( c.first == 1 && c.second == 0 ) { cout << "First\n"; return 0; }
if ( c.first == 0 && c.second == 1 ) { cout << "First\n"; return 0; }
}
}
long long t = -1, r = -1;
for ( long long i = 0 ; i < n ; i ++ ) {
if ( i == n-1 || a[i+1] < a[i] ) {
if ( proj( a[i]-1, i ).first == 0 ) { r = proj( a[i]-1, i ).second; break; }
}
}
for ( long long i = n-1 ; i >= 0 ; i -- ) {
if ( i == n-1 || a[i+1] < a[i] ) {
if ( proj( a[i]-1, i ).second == 0 ) { t = proj( a[i]-1, i ).first; break; }
}
}
if ( r == -1 ) {
printS( t );
return 0;
}
if ( t == -1 ) {
printS( r );
return 0;
}
if ( r%2 == t%2 ) {
printS( r );
}else {
pair < int, int > tx, rx;
if ( r%2 ) {
tx.first = t;
tx.second = r-1;
rx.first = t-2;
rx.second = r;
}else {
tx.first = t;
tx.second = r-2;
rx.first = t-1;
rx.second = r;
}
pair < int, int > tx = proj( tx.first, tx.second );
pair < int, int > rx = proj( rx.first, rx.second );
if ( tx.first == 0 && tx.second == 0 ) { cout << "Second\n"; return 0; }
if ( rx.first == 0 && rx.second == 0 ) { cout << "Second\n"; return 0; }
//if ( tx.first == 1 && tx.second == 0 ) { cout << "Second\n"; return 0; }
cout << 12/0 << "\n";
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:75:27: error: redeclaration of 'std::pair<int, int> tx'
75 | pair < int, int > tx = proj( tx.first, tx.second );
| ^~
a.cc:59:27: note: 'std::pair<int, int> tx' previously declared here
59 | pair < int, int > tx, rx;
| ^~
a.cc:76:27: error: redeclaration of 'std::pair<int, int> rx'
76 | pair < int, int > rx = proj( rx.first, rx.second );
| ^~
a.cc:59:31: note: 'std::pair<int, int> rx' previously declared here
59 | pair < int, int > tx, rx;
| ^~
a.cc:82:19: warning: division by zero [-Wdiv-by-zero]
82 | cout << 12/0 << "\n";
| ~~^~
|
s831678616
|
p04037
|
C++
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int a[100010];
int main()
{
#ifdef DEBUG
freopen("b.in","r",stdin);
freopen("b.out","w",stdout);
#endif
int n;
int i;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
sort(a+1,a+n+1,greater<int>());
int ans;
a[0]=a[1];
for(i=0;i<=n;i++)
if(a[i+1]<=i)
{
ans=(a[i]-i)&1;
int j=i+1;
while(j<=n&&a[j]==i)
j++;
if((j-i+1)&1)
ans=1;
break;
}
if(ans)
printf("First\n");
else
printf("Second\n");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:23:24: error: 'greater' was not declared in this scope
23 | sort(a+1,a+n+1,greater<int>());
| ^~~~~~~
a.cc:23:32: error: expected primary-expression before 'int'
23 | sort(a+1,a+n+1,greater<int>());
| ^~~
|
s952553441
|
p04037
|
C++
|
#include <cstdio>
#include <functional>
const int N = 100000;
int n, a[N];
bool win(int x, int y)
{
while (x + 1 < n && y + 1 < a[x + 1]) {
x ++, y ++;
}
int up = a[x] - y & 1;
int rt = true;
while (x + 1 < n && y < a[x + 1]) {
x ++, rt ^= 1;
}
return !(up && rt);
}
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; ++ i) {
scanf("%d", a + i);
}
std::sort(a, a + n, std::greater<int>());
puts(win(0, 0) ? "First" : "Second");
}
|
a.cc: In function 'int main()':
a.cc:27:10: error: 'sort' is not a member of 'std'
27 | std::sort(a, a + n, std::greater<int>());
| ^~~~
|
s365611748
|
p04037
|
C++
|
#include <cstdio>
#include <iostream>
using namespace std;
const int N = 1e5 + 5;
int a[N], n;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i ++) scanf("%d", &a[i]);
sort(a + 1, a + n + 1, greater <int> ());
int i, j;
for (i = 1; i < n && a[i + 1] >= i + 1; i ++);
if ((a[i] - i) & 1) return !puts("First");
if (a[i + 1] == i) {
for (j = i + 1; j < n && a[j + 1] == i; j ++);
if ((j - i) & 1) return !puts("First");
}
puts("Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(a + 1, a + n + 1, greater <int> ());
| ^~~~
| short
|
s792615659
|
p04037
|
C++
|
#include<bits/stdc++.h>
using namespace std;
inline char nchar() {
static const int bufl=1<<20;
static char buf[bufl],*a,*b;
return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
inline int read() {
int x=0,f=1;
char c=nchar();
for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
for (;isdigit(c);c=nchar()) x=x*10+c-'0';
return x*f;
}
const int maxn=1e5+1;
int n,a[maxn],d;
bool get(int x,int y) {
if (x>n || y>a[x]) return true;
int p;
for (int i=1;i<=n;++i) if (a[i]>=y) p=i; else break;
return (p+a[p]-x-y)&1;
}
int main() {
generate(a+1,a+(n=read())+1,read);
sort(a+1,a+n+1,greater<int>());
for (int i=1;i<=n;++i) if (a[i]>=i) d=i; else break;
puts(!get(d,d+1) || !get(d+1,d)?"First":"Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:17: error: no matching function for call to 'generate(int*, int*, <unresolved overloaded function type>)'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: candidate: 'template<class _FIter, class _Generator> void std::generate(_FIter, _FIter, _Generator)'
4345 | generate(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: template argument deduction/substitution failed:
a.cc:24:17: note: couldn't deduce template parameter '_Generator'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Generator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator)'
200 | generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g);
| ^~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate expects 4 arguments, 3 provided
|
s847784235
|
p04037
|
C++
|
#include<bits/stdc++.h>
using namespace std;
inline char nchar() {
static const int bufl=1<<20;
static char buf[bufl],*a,*b;
return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
inline int read() {
int x=0,f=1;
char c=nchar();
for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
for (;isdigit(c);c=nchar()) x=x*10+c-'0';
return x*f;
}
const int maxn=1e5+1;
int n,a[maxn],d;
bool get(int x,int y) {
if (x>n || y>a[x]) return true;
int p;
for (int i=1;i<=n;++i) if (a[i]>=y) p=i; else break;
return (p+a[p]-x-y)&1;
}
int main() {
generate(a+1,a+(n=read())+1,read);
sort(a+1,a+n+1,greater<int>());
for (int i=1;i<=n;++i) if (a[i]>=i) d=i; else break;
puts(!get(d,d+1) || !get(d+1,d)?"First":"Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:17: error: no matching function for call to 'generate(int*, int*, <unresolved overloaded function type>)'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: candidate: 'template<class _FIter, class _Generator> void std::generate(_FIter, _FIter, _Generator)'
4345 | generate(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: template argument deduction/substitution failed:
a.cc:24:17: note: couldn't deduce template parameter '_Generator'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Generator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator)'
200 | generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g);
| ^~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate expects 4 arguments, 3 provided
|
s366443291
|
p04037
|
C++
|
#include<bits/stdc++.h>
using namespace std;
inline char nchar() {
static const int bufl=1<<20;
static char buf[bufl],*a,*b;
return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
inline int read() {
int x=0,f=1;
char c=nchar();
for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
for (;isdigit(c);c=nchar()) x=x*10+c-'0';
return x*f;
}
const int maxn=1e5+1;
int n,a[maxn],d;
bool get(int x,int y) {
if (x>n || y>a[x]) return true;
int p;
for (int i=1;i<=n;++i) if (a[i]>=y) p=i; else break;
return (p+a[p]-x-y)&1;
}
int main() {
generate(a+1,a+(n=read())+1,read);
sort(a+1,a+n+1,greater<int>());
for (int i=1;i<=n;++i) if (a[i]>=i) d=i; else break;
puts(!get(d,d+1) || !get(d+1,d)?"First":"Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:17: error: no matching function for call to 'generate(int*, int*, <unresolved overloaded function type>)'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: candidate: 'template<class _FIter, class _Generator> void std::generate(_FIter, _FIter, _Generator)'
4345 | generate(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: template argument deduction/substitution failed:
a.cc:24:17: note: couldn't deduce template parameter '_Generator'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Generator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator)'
200 | generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g);
| ^~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate expects 4 arguments, 3 provided
|
s406321124
|
p04037
|
C++
|
#include<bits/stdc++.h>
using namespace std;
inline char nchar() {
static const int bufl=1<<20;
static char buf[bufl],*a,*b;
return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
inline int read() {
int x=0,f=1;
char c=nchar();
for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
for (;isdigit(c);c=nchar()) x=x*10+c-'0';
return x*f;
}
const int maxn=1e5+1;
int n,a[maxn],d;
bool get(int x,int y) {
if (x>n || y>a[x]) return true;
int p;
for (int i=1;i<=n;++i) if (a[i]>=y) p=i; else break;
return (p+a[p]-x-y)&1;
}
int main() {
generate(a+1,a+(n=read())+1,read);
sort(a+1,a+n+1,greater<int>());
for (int i=1;i<=n;++i) if (a[i]>=i) d=i; else break;
puts(!get(d,d+1) || !get(d+1,d)?"First":"Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:17: error: no matching function for call to 'generate(int*, int*, <unresolved overloaded function type>)'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: candidate: 'template<class _FIter, class _Generator> void std::generate(_FIter, _FIter, _Generator)'
4345 | generate(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: template argument deduction/substitution failed:
a.cc:24:17: note: couldn't deduce template parameter '_Generator'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Generator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator)'
200 | generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g);
| ^~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate expects 4 arguments, 3 provided
|
s836967014
|
p04037
|
C++
|
#include<bits/stdc++.h>
using namespace std;
inline char nchar() {
static const int bufl=1<<20;
static char buf[bufl],*a,*b;
return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
inline int read() {
int x=0,f=1;
char c=nchar();
for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
for (;isdigit(c);c=nchar()) x=x*10+c-'0';
return x*f;
}
const int maxn=1e5+1;
int n,a[maxn],d;
bool get(int x,int y) {
if (x>n || y>a[x]) return true;
int p;
for (int i=1;i<=n;++i) if (a[i]>=y) p=i; else break;
return (p+a[p]-x-y)&1;
}
int main() {
generate(a+1,a+(n=read())+1,read);
sort(a+1,a+n+1,greater<int>());
for (int i=1;i<=n;++i) if (a[i]>=i) d=i; else break;
puts(!get(d,d+1) || !get(d+1,d)?"First":"Second");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:17: error: no matching function for call to 'generate(int*, int*, <unresolved overloaded function type>)'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: candidate: 'template<class _FIter, class _Generator> void std::generate(_FIter, _FIter, _Generator)'
4345 | generate(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4345:5: note: template argument deduction/substitution failed:
a.cc:24:17: note: couldn't deduce template parameter '_Generator'
24 | generate(a+1,a+(n=read())+1,read);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Generator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator)'
200 | generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g);
| ^~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:200:1: note: candidate expects 4 arguments, 3 provided
|
s401371807
|
p04037
|
C++
|
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int a[100005];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
sort (a + 1, a + 1 + n);
int ans = 0;
bool b = 0;
for (int i = n; i >= 1; i--) {
if (a[i] == (n - i + 1) {
ans = i;
break;
}
if (a[i] > (n - i + 1) && a[i - 1] < (n - i)) {
ans = i;
b = 1;
}
}
bool sum = 0;
if (!b) {
for (int i = ans; ; i--) {
if (a[i] != (n - ans + 1)) break;
sum = !sum;
}
}
if (b) {
for (int i = ans - 1; ; i--) {
if (a[i] != (n - ans + 1)) break;
sum = !sum;
}
if (sum == 0) {
sum = (a[ans] - (n - ans + 1) % 2;
}
}
cout << sum ? "First" : "Second";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:40: error: expected ')' before '{' token
16 | if (a[i] == (n - i + 1) {
| ~ ^~
| )
a.cc:24:9: error: expected primary-expression before '}' token
24 | }
| ^
a.cc:38:58: error: expected ')' before ';' token
38 | sum = (a[ans] - (n - ans + 1) % 2;
| ~ ^
| )
|
s023788724
|
p04037
|
C++
|
inline bool find(int x,int y)
{
if(a[x]<=y || a[x-1]<y)
return 0;
else if(!find(x-1,y) && !find(x,y+1))
return 1;
return 0;
}
int main()
{
n=read();
for(int i=1;i<=n;i++)
a[i]=read();
sort(a+1,a+n+1);
int medge=1;
while(a[n-medge+1]>medge+1)
medge++;
if(medge>1)
medge--;
printf("%s\n",find(n-medge+1,medge)?"First":"Second");
return 0;
}
|
a.cc: In function 'bool find(int, int)':
a.cc:3:12: error: 'a' was not declared in this scope
3 | if(a[x]<=y || a[x-1]<y)
| ^
a.cc: In function 'int main()':
a.cc:12:9: error: 'n' was not declared in this scope
12 | n=read();
| ^
a.cc:12:11: error: 'read' was not declared in this scope
12 | n=read();
| ^~~~
a.cc:14:17: error: 'a' was not declared in this scope
14 | a[i]=read();
| ^
a.cc:15:14: error: 'a' was not declared in this scope
15 | sort(a+1,a+n+1);
| ^
a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'short'?
15 | sort(a+1,a+n+1);
| ^~~~
| short
a.cc:22:9: error: 'printf' was not declared in this scope
22 | printf("%s\n",find(n-medge+1,medge)?"First":"Second");
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | inline bool find(int x,int y)
|
s374073819
|
p04037
|
C++
|
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll n,a[100005];
ll w[100005];
int main(){
cin >> n;
for(int i=0;i<n;i++) cin >> a[i];
sort(a,a+n);
int x = n-1;
for(int i=0;i<n-1;i++){
if(a[n-1-i]-1-i >= 0 && a[n-2-i]-1-(i+1) < 0){
x = i;
break;
}
}
for(int i=n-1;i>=0;i--){
if(i==n-1 || (a[i]!=a[i+1])){
w[i] = (a[n-1-i]-1+i)%2;
}
else{
w[i] = w[i+1];
}
}
if(x != 0 && abs(a[n-1-(x-1)]-1-(x-1)) == 1 && w[x-1]==1){
puts("First"); return 0;
}
if(a[n-1-x]-1-x == 0){
puts(w[x]==0?"Second":"First"); return 0;
}
if(x != n-1 && abs(a[n-1-(x+1)]-1-(x+1)) == 1 && w[x+1]==1){
puts("First"); return 0;
}
puts(w[x]==0?"Second":"First")
}
|
a.cc: In function 'int main()':
a.cc:66:39: error: expected ';' before '}' token
66 | puts(w[x]==0?"Second":"First")
| ^
| ;
67 | }
| ~
|
s236452184
|
p04037
|
C++
|
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <cassert>
#define pb push_back
#define x first
#define y second
#define files(FileName) read(FileName); write(FileName)
#define read(FileName) freopen((FileName + ".in").c_str(), "r", stdin)
#define write(FileName) freopen((FileName + ".out").c_str(), "w", stdout)
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
const string FILENAME = "input";
const int MAXN = 1e5 + 5;
typedef pair <int, int> point;
int n;
vector <int> a;
bool border(int X, int Y) {
//cout << X << ' ' << Y << endl;
if (X > size()) return true;
if (a[X] + 1 == Y) return true;
if (X && Y > a[X])
return true;
return false;
}
int main() {
ios::sync_with_stdio(false);
srand(time(0));
//read(FILENAME);
cin >> n;
a.resize(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
sort(a.rbegin(), a.rend());
point s = {0, 0};
while (!border(s.x + 1, s.y + 1)) {
++s.x, ++s.y;
}
//cout << s.x << ' ' << s.y << endl;
int d1 = 0, d2 = 0;
d1 = (a[s.x] - s.y) & 1;
d2 = 0;
while (!border(s.x + 1, s.y)) {
++d2;
++s.x;
}
d2 &= 1;
if (d1 && d2) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
}
|
a.cc: In function 'bool border(int, int)':
a.cc:41:21: error: no matching function for call to 'size()'
41 | if (X > size()) return true;
| ~~~~^~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate expects 1 argument, 0 provided
|
s172866084
|
p04037
|
C++
|
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
x=0;int f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
x*=f;
}inline void read(i64 &x){
x=0;i64 f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
x*=f;
}
inline void judge(){
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
}const int maxn=100005;
int a[maxn],n;
int main(){
read(n);rep(i,0,n-1)read(a[i]);
sort(a,a+n,greater<int>);
int i=0;
while(i+1<n&&i+1<a[i+1])i++;
int j=0;
while(j<n&&i<a[j])j++;
if((a[i]-i%2==0)||(j-i%2==0)){
puts("First");
}else{
puts("Second");
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:38:32: error: expected primary-expression before ')' token
38 | sort(a,a+n,greater<int>);
| ^
|
s731952456
|
p04037
|
C++
|
include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <vector>
using namespace std;
#define TRACE(x) cerr << #x << " = " << x << endl
typedef long long ll;
typedef pair<int, int> P;
#define X first
#define Y second
const int MAX = 1<<17;
int p[MAX];
int jelnul[MAX];
int main()
{
int n;
scanf("%d", &n);
for (int i=0; i<n; i++)
scanf("%d", &p[i]);
sort(p, p + n, greater<int>());
for (int i=n-1; i>=0; i--)
if (i == n-1 || p[i] != p[i+1] || !jelnul[i+1])
jelnul[i] = 1;
int izg = 0;
for (int i=0; i<n; i++) {
if (i != n - 1 && p[i] == p[i+1])
continue;
if (jelnul[i] && p[i] == i + 1)
izg = 1;
int poc = (i == n - 1) ? 1 : p[i+1] + 1;
int kraj = p[i];
if (i != n - 1 && !jelnul[i+1] && p[i] != p[i+1])
poc--;
if (i + 1 >= poc && i + 1 <= kraj)
if (jelnul[i] ^ ((kraj - (i + 1)) % 2))
izg = 1;
}
printf("%s\n", izg ? "Second" : "First");
return 0;
}
|
a.cc:1:1: error: 'include' does not name a type
1 | include <cstdio>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
|
|
s229772834
|
p04037
|
C++
|
#include <iostream>
using namespace std;
const int N = 100005;
int a[N], b[N];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
sort(a, a+n); reverse(a, a+n);
for (int i = 0; i < n; i++) b[min(a[i], n)-1]++;
for (int i = n-1; i >= 0; i--) b[i] += b[i+1];
int m = 0;
while (a[m] > m) ++m;
// case 1: even & even
if ((a[m-1]-m)%2 == 0 && (b[m-1]-m)%2 == 0) {
puts("Second");
return 0;
}
// case 2: else
puts("First");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(a, a+n); reverse(a, a+n);
| ^~~~
| short
a.cc:11:17: error: 'reverse' was not declared in this scope
11 | sort(a, a+n); reverse(a, a+n);
| ^~~~~~~
|
s588615117
|
p04037
|
C++
|
w#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
typedef long long llint;
const int MAX = 100100;
int a[MAX];
int main(void) {
int N;
scanf("%d", &N);
REP(i, N) scanf("%d", &a[i]);
sort(a, a + N);
vector<pair<int, int>> v;
int i = 0;
while (i < N) {
int j = i;
while (j < N && a[j] == a[i]) j++;
v.push_back({a[i], j-i});
i = j;
}
int n = v.size();
int pos = N;
int last_double = N+1;
FOR(i, 1, n) {
pos -= v[i-1].second;
int last_left = (v[i-1].second % 2) ^ 1;
int last_up = ((v[i].first - v[i-1].first + 1) % 2);
if (last_left == 0 && last_up == 1) {
int doubl = pos - 1 - (v[i-1].first - 1);
if (doubl > 0) last_double = min(last_double, doubl);
}
if (last_left == 1 && last_up == 0) {
int doubl = pos - (v[i-1].first - 1);
if (doubl > 0) last_double = min(last_double, doubl);
}
}
if (last_double == N+1) {
if (v[0].first % 2) {
last_double = N+1;
} else {
last_double = N;
}
}
if (last_double % 2) {
puts("First");
} else {
puts("Second");
}
return 0;
}
|
a.cc:1:2: error: stray '#' in program
1 | w#include <algorithm>
| ^
a.cc:1:1: error: 'w' does not name a type
1 | w#include <algorithm>
| ^
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:4:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/string.h:33,
from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std';
|
s513404886
|
p04037
|
Java
|
import java.io.*;
import java.util.*;
public class E {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
void solve() throws IOException {
int n = nextInt();
int[] a = new int[n];
Random rng = new Random();
for (int i = 0; i < n; i++) {
int j = rng.nextInt(i + 1);
a[j] = a[i];
a[i] = nextInt();
}
Arrays.sort(a);
for (int i = 0, j = n - 1; i < j; i++, j--) {
int tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
int bad = n;
for (int i = 0; i < n; i++) {
if (a[i] <= i) {
bad = i;
break;
}
}
bad--;
int right = a[bad] - bad - 1;
int up = 0;
for (int i = bad + 1; i < n; i++) {
if (a[i] > bad) {
up++;
} else {
break;
}
}
out.println((right | up) % 2 == 0 ? "Second" : "First");
}
E() throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
solve();
out.close();
}
public static void main(String[] args) throws IOException {
new E();
}
String nextToken() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (Exception e) {
eof = true;
return null;
}
}
return st.nextToken();
}
String nextString() {
try {
return br.readLine();
} catch (IOException e) {
eof = true;
return null;
}
}
int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
}
|
Main.java:4: error: class E is public, should be declared in a file named E.java
public class E {
^
1 error
|
s860349000
|
p04037
|
C++
|
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;
#define all(A) (A).begin(), (A).end()
#define II(A) int (A); scanf("%d",&(A));
#define DBG if(1)
#define NDBG if(0)
typedef long long ll;
typedef pair<int,int> pii;
const int MN = 100000 + 1;
int N;
int A[MN];
int end[MN];
int val(int x,int y){
if(x>=N) return true;
if(y>=A[x]) return true;
return end[x]^((A[x]-1-y)&1);
}
int main(){
scanf("%d",&N);
for(int i=0;i<N;i++) scanf("%d",&A[i]);
sort(A, A+N, greater<int>());
end[N-1] = 0;
for(int i=N-2;i>=0;i--){
if(A[i] == A[i+1]) end[i] = end[i+1]^1;
else end[i] = 0;
}
int x=0,y=0;
while(x<N-1 && y+1 < A[x+1]) x++, y++;
if(!val(x,y+1) || !val(x+1,y)){
puts("First");
}
else puts("Second");
return 0;
}
|
a.cc: In function 'int val(int, int)':
a.cc:24:16: error: reference to 'end' is ambiguous
24 | return end[x]^((A[x]-1-y)&1);
| ^~~
In file included from /usr/include/c++/14/vector:69,
from a.cc:3:
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
from /usr/include/c++/14/bits/stl_algo.h:59,
from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN];
| ^~~
a.cc: In function 'int main()':
a.cc:31:9: error: reference to 'end' is ambiguous
31 | end[N-1] = 0;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN];
| ^~~
a.cc:33:36: error: reference to 'end' is ambiguous
33 | if(A[i] == A[i+1]) end[i] = end[i+1]^1;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN];
| ^~~
a.cc:33:45: error: reference to 'end' is ambiguous
33 | if(A[i] == A[i+1]) end[i] = end[i+1]^1;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN];
| ^~~
a.cc:34:22: error: reference to 'end' is ambiguous
34 | else end[i] = 0;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN];
| ^~~
|
s115480600
|
p04037
|
C++
|
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;
#define all(A) (A).begin(), (A).end()
#define II(A) int (A); scanf("%d",&(A));
#define DBG if(1)
#define NDBG if(0)
typedef long long ll;
typedef pair<int,int> pii;
const int MN = 100000 + 1;
int N;
int A[MN];
int end[MN] = {1, };
int val(int x,int y){
if(x>=N) return true;
if(y>=A[x]) return true;
return end[x]^((A[x]-1-y)&1);
}
int main(){
scanf("%d",&N);
for(int i=0;i<N;i++) scanf("%d",&A[i]);
sort(A, A+N, greater<int>());
end[N-1] = 0;
for(int i=N-2;i>=0;i--){
if(A[i] == A[i+1]) end[i] = end[i+1]^1;
else end[i] = 0;
}
int x=0,y=0;
while(x<N-1 && y+1 < A[x+1]) x++, y++;
if(!val(x,y+1) || !val(x+1,y)){
puts("First");
}
else puts("Second");
return 0;
}
|
a.cc: In function 'int val(int, int)':
a.cc:24:16: error: reference to 'end' is ambiguous
24 | return end[x]^((A[x]-1-y)&1);
| ^~~
In file included from /usr/include/c++/14/vector:69,
from a.cc:3:
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
from /usr/include/c++/14/bits/stl_algo.h:59,
from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN] = {1, };
| ^~~
a.cc: In function 'int main()':
a.cc:31:9: error: reference to 'end' is ambiguous
31 | end[N-1] = 0;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN] = {1, };
| ^~~
a.cc:33:36: error: reference to 'end' is ambiguous
33 | if(A[i] == A[i+1]) end[i] = end[i+1]^1;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN] = {1, };
| ^~~
a.cc:33:45: error: reference to 'end' is ambiguous
33 | if(A[i] == A[i+1]) end[i] = end[i+1]^1;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN] = {1, };
| ^~~
a.cc:34:22: error: reference to 'end' is ambiguous
34 | else end[i] = 0;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:19:5: note: 'int end [100001]'
19 | int end[MN] = {1, };
| ^~~
|
s211497124
|
p04037
|
C++
|
#include <cstdint>
#include <iostream>
#include <algorithm>
typedef int64_t i64;
static const auto NMAX = 100001;
static int N;
static int L;
static int A[NMAX];
int main() {
std::ios_base::sync_with_stdio(false);
std::cin >> N;
for(auto i = 1; i <= N; i++) std::cin >> A[i];
std::sort(A + 1, A + N + 1);
std::reverse(A + 1, A + N + 1);
auto v = 2000000000;
auto v2 = 0;
auto lt = 0;
for(auto i = 1; i <= N; i++) {
if(i < N && A[i] == A[i + 1]) continue;
v = std::min(v, std::abs(A[i] - i));
if(lt == A[i] && ( v % 2 == 1 || v2 % 2 == 1) {
std::cout << "First" << std::endl;
return 0;
}
v2 = v;
lt = i;
}
if(v % 2 == 0)
std::cout << "Second" << std::endl;
else
std::cout << "First" << std::endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:25:62: error: expected ';' before '{' token
25 | if(lt == A[i] && ( v % 2 == 1 || v2 % 2 == 1) {
| ^~
| ;
a.cc:29:22: error: expected ')' before ';' token
29 | v2 = v;
| ^
| )
a.cc:25:19: note: to match this '('
25 | if(lt == A[i] && ( v % 2 == 1 || v2 % 2 == 1) {
| ^
|
s290904165
|
p04037
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
int N;
int A[101010];
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N;
FOR(i,N) cin>>A[i];
sort(A,A+N);
reverse(A,A+N);
FOR(i,N) if((A[i]<=i+1 || A[i+1]<=i+1) {
y=i;
while(A[y]>i) y++;
if((A[i]-i)%2 && (y-i)%2) return _P("Second\n");
return _P("First\n");
}
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n';
FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
solve(); return 0;
}
|
a.cc: In function 'void solve()':
a.cc:26:47: error: expected ')' before '{' token
26 | FOR(i,N) if((A[i]<=i+1 || A[i+1]<=i+1) {
| ~ ^~
| )
a.cc:34:1: error: expected primary-expression before '}' token
34 | }
| ^
|
s517354599
|
p04038
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long f[2005][2005],ny[4000005],s[4000005],t[4000005];
long long f(long long n,long long m)
{
return s[n]*t[m]%mod*t[n-m]%mod;
}
int main()
{
long long n,k,i,j;
cin>>n>>k;
if(k==1)
{
puts("1");
return 0;
}
ny[1]=1;
for(i=2;i<=4000000;i++)
{
ny[i]=(mod-mod/i)*ny[mod%i]%mod;
}
s[0]=1,t[0]=1;
for(i=1;i<=4000000;i++)
{
s[i]=s[i-1]*i%mod;
t[i]=t[i-1]*ny[i]%mod;
}
for(i=0;i<=n;i++)
f[i][0]=1;
for(i=1;i<=n;i++)
{
for(j=0;j<=i;j++)
{
f[i][j]=f[i-1][j]+f[i][j-1]*(n-j+1)%mod*f(n*k-i-1-(j-1)*(k-1),k-2)%mod;
f[i][j]%=mod;
}
}
cout<<f[n][n]%mod<<endl;
return 0;
}
|
a.cc:5:36: error: 'long long int f(long long int, long long int)' redeclared as different kind of entity
5 | long long f(long long n,long long m)
| ^
a.cc:4:11: note: previous declaration 'long long int f [2005][2005]'
4 | long long f[2005][2005],ny[4000005],s[4000005],t[4000005];
| ^
a.cc: In function 'int main()':
a.cc:35:66: error: 'f' cannot be used as a function
35 | f[i][j]=f[i-1][j]+f[i][j-1]*(n-j+1)%mod*f(n*k-i-1-(j-1)*(k-1),k-2)%mod;
| ~^~~~~~~~~~~~~~~~~~~~~~~~~
|
s808613562
|
p04038
|
C
|
#include<cstdio>
#define C(x,y) (fct[x]*ifct[y]%TT*ifct[(x)-(y)]%TT)
using namespace std;
const int maxn=2005,TT=1e9+7;
int n,K,m,F[maxn][maxn];
long long fct[maxn*maxn],ifct[maxn*maxn];
inline int read(){
int ret=0;bool f=0;char ch=getchar();
while(ch>'9'||ch<'0') f^=ch=='-',ch=getchar();
while(ch<='9'&&ch>='0') ret=ret*10+ch-'0',ch=getchar();
return f?-ret:ret;
}
inline long long pow(int x,int y){
long long ret=1,w=x;
while(1){
if(y&1) ret=ret*w%TT;
if(!(y>>=1)) return ret;
w=w*w%TT;
}
}
inline void add(int&x,int y){if((x+=y)>=TT) x-=TT;}
int main(){
n=read(),K=read();m=n*K;
if(K==1) return puts("1")&0;
for (int i=fct[0]=1;i<=m;i++) fct[i]=fct[i-1]*i%TT;
ifct[m]=pow(fct[m],TT-2);
for (int i=m;i;i--) ifct[i-1]=ifct[i]*i%TT;
F[0][0]=1;
for (int i=1;i<=n;i++)
for (int j=0;j<=i;j++){
if(j<i) add(F[i][j],F[i-1][j]);
if(j) add(F[i][j],C(m-i-(j-1)*(K-1)-1,K-2)*F[i][j-1]%TT);
}
printf("%lld\n",fct[n]*F[n][n]%TT);
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s666498792
|
p04038
|
C++
|
/*
设f[i][j]表示当前有i个白球,一共放完了j种球
显然有j <= i
* 放白球 从f[i-1][j]转移
* 放没有出现过的球 (n - j + 1) * f[i][j - 1] * C(k - 2, n * k - i - (j - 1) * (k - 1) - 1)
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int;
const int N = 2020;
const int mod = 1e9 + 7;
int inv[N * N], fac[N * N];
int f[N][N];
int n, k;
int power(int a, int b) {
a %= mod; int ans = 1;
while(b) {
if(b & 1) ans = 1ll * ans * a % mod;
a = 1ll * a * a % mod; b >>= 1;
}
return ans;
}
int C(int n, int m) {
return 1ll * fac[m] * inv[n] % mod * inv[m - n] % mod;
}
signed main() {
scanf("%d%d", &n, &k);
fac[0] = 1;
for(int i = 1; i < N * N; ++i)
fac[i] = 1ll * fac[i - 1] * i % mod;
for(int i = 0; i < N * N; ++i)
inv[i] = power(fac[i], mod - 2);
for(int i = 0; i <= n; ++i) f[i][0] = 1;
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= i; ++j) {
f[i][j] = f[i - 1][j];
(f[i][j] += 1ll * (n - j + 1) * f[i][j - 1] % mod * C(k - 2, n * k - i - (j - 1) * (k - 1) - 1) % mod) %= mod;
(f[i][j] += mod) %= mod;
}
}
printf("%lld\n", (f[n][n] % mod + mod) % mod);
return 0;
}
|
a.cc:10:19: error: declaration does not declare anything [-fpermissive]
10 | typedef long long int;
| ^~~
|
s540061707
|
p04038
|
C
|
#include <iostream>
using namespace std;
#define LL long long
const int maxN = 2e3 + 2;
const int MOD = 1e9 + 7;
int N, K;
int F[maxN][maxN], fac[maxN * maxN];
LL qpow(LL a, LL b) {
LL ans = 1;
while (b) {
if (b & 1) {
ans = ans * a % MOD;
}
a = a * a % MOD;
b >>= 1;
}
return ans;
}
void init() {
fac[0] = 1;
for (int i = 1; i <= N * K; ++i)
fac[i] = 1ll * fac[i - 1] * i % MOD;
}
int Combine(int n, int m) {
if (n < m) return 0;
return 1ll * fac[n] * qpow(fac[m], MOD - 2) % MOD * qpow(fac[n - m], MOD - 2) % MOD;
}
signed main() {
cin >> N >> K;
if (K == 1) return puts("1"), 0;
init();
F[0][0] = 1;
for (int i = 1; i <= N; ++i) {
for (int j = 0; j <= i; ++j) {
F[i][j] = (1ll * F[i - 1][j] + 1ll * (i > 0) * F[i][j - 1] *
Combine(N * K - (j - 1) * (K - 1) - i - 1, K - 2) % MOD) % MOD;
}
}
cout << 1ll * F[N][N] * fac[N] % MOD << endl;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s775721675
|
p04038
|
C
|
#include <iostream>
using namespace std;
#define LL long long
const int maxN = 2e3 + 2;
const int MOD = 1e9 + 7;
int N, K;
int F[maxN][maxN], fac[maxN * maxN];
LL qpow(LL a, LL b) {
LL ans = 1;
while (b) {
if (b & 1) {
ans = ans * a % MOD;
}
a = a * a % MOD;
b >>= 1;
}
return ans;
}
void init() {
fac[0] = 1;
for (int i = 1; i <= N * K; ++i)
fac[i] = 1ll * fac[i - 1] * i % MOD;
}
int Combine(int n, int m) {
if (n < m) return 0;
return 1ll * fac[n] * qpow(fac[m], MOD - 2) % MOD * qpow(fac[n - m], MOD - 2) % MOD;
}
signed main() {
cin >> N >> K;
if (K == 1) return puts("1"), 0;
init();
F[0][0] = 1;
for (int i = 1; i <= N; ++i) {
for (int j = 0; j <= i; ++j) {
F[i][j] = (1ll * F[i - 1][j] + 1ll * (i > 0) * F[i][j - 1] *
Combine(N * K - (j - 1) * (K - 1) - i - 1, K - 2) % MOD) % MOD;
}
}
cout << 1ll * F[N][N] * fac[N] % MOD << endl;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s784507477
|
p04038
|
C++
|
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<cmath>
using namespace std;
#define int long long
void read(int &x) {
char ch; bool ok;
for(ok=0,ch=getchar(); !isdigit(ch); ch=getchar()) if(ch=='-') ok=1;
for(x=0; isdigit(ch); x=x*10+ch-'0',ch=getchar()); if(ok) x=-x;
}
#define rg register
const int maxn=5e5+10;map<int,int>mp;
int sum,n,k,now,tot,ans,a[maxn],mx,d,g,w[maxn],q[100],f[maxn];
signed main(){
read(n);
for(rg int i=1;i<=n;i++)read(a[i]),w[++tot]=a[i];
sort(w+1,w+tot+1);
for(rg int i=1;i<=tot;i++)if(!mp[w[i]])mp[w[i]]=++now;
for(rg int i=1;i<=tot;i++)a[i]=mp[a[i]],f[a[i]]++;
sort(f+1,f+now+1);q[0]=1;
for(rg int i=1;i<=63;i++)q[i]=q[i-1]*2;
for(rg int j=1;j<=n;j++){
int v=j,sum=0,k=1;
while(v<=f[now]){
int s=lower_bound(f+k,f+now+1,v)-f;
if(s<=now)sum+=v,v<<=1,k=s+1;
else break;
}
if(sum>ans)ans=sum;
}
printf("%lld\n",ans);
}
close
|
a.cc: In function 'int main()':
a.cc:19:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
19 | for(rg int i=1;i<=n;i++)read(a[i]),w[++tot]=a[i];
| ^
a.cc:21:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
21 | for(rg int i=1;i<=tot;i++)if(!mp[w[i]])mp[w[i]]=++now;
| ^
a.cc:22:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
22 | for(rg int i=1;i<=tot;i++)a[i]=mp[a[i]],f[a[i]]++;
| ^
a.cc:24:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
24 | for(rg int i=1;i<=63;i++)q[i]=q[i-1]*2;
| ^
a.cc:25:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
25 | for(rg int j=1;j<=n;j++){
| ^
a.cc: At global scope:
a.cc:37:1: error: 'close' does not name a type
37 | close
| ^~~~~
|
s368092657
|
p04038
|
C++
|
#include <iostream>
#include <algorithm>
using namespace std;
const long long MOD = (long long)(1e9 + 7);
const int kK = (int)(2049 * 2049);
long long fac[kK + 5], inv[kK + 5];
long long qpow(long long base,int power)
{
long long ret = 1;
for(; power; power >>= 1)
{
if(power & 1) ret = ret * base % MOD;
base = base * base % MOD;
}
return ret;
}
inline long long C(int x, int y)
{
return(((fac[y] * inv[x]) % MOD) * inv[y - x]) % MOD;
}
int n, k;
long long f[2049][2049];
int main()
{
ios::sync_with_stdio(false);
cin >> n >> k;
if(k == 1)
{
cout << 1 <<endl;
return 0;
}
fac[0] = 1;
for(int i = 1; i <= kK; ++i) fac[i] = fac[i-1] * i % MOD;
inv[kK] = qpow(fac[kK], MOD - 2);
for(int i = kK; i >= 1; --i) inv[i - 1] = inv[i] * i % MOD;
f[0][0] = 1;
for(int i = 1;i <= n; ++i)
{
f[i][0] = f[i - 1][0];
for(int j = 1; j <= i; ++j)
{
f[i][j] = f[i - 1][j];
f[i][j] = f[i][j] + f[i][j - 1] * C(k - 2, n * k - i - (j - 1)*(k - 1) - 1);
f[i][j] % =MOD;
}
}
cout << fac[n] * f[n][n] % MOD<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:50:35: error: expected primary-expression before '=' token
50 | f[i][j] % =MOD;
| ^
|
s531880453
|
p04038
|
C++
|
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define orz 1000000007ll
using namespace std;
int n,k,;
ll jc[4000005],njc[4000005],dp[2005][2005];
ll fp(ll x,int k=1000000005){
ll ans=1;
while(k){
if(k&1)ans=ans*x%orz;
k>>=1,x=x*x%orz;
}
return ans;
}
int main(){
scanf("%d%d",&n,&k);
if(n==1||k==1){
puts("1");
return 0;
}
jc[0]=1;
for(int i=1;i<=n*k;++i)jc[i]=jc[i-1]*i%orz;
njc[n*k]=fp(jc[n*k]);
for(int i=n*k;i;--i)njc[i-1]=njc[i]*i%orz;
dp[0][1]=1;
for(int i=2;i<=n;++i)dp[0][i]=dp[0][i-1]*jc[i*k-i-1]%orz*njc[k-2]%orz*njc[i*k-i-k+1]%orz;
for(int i=1;i<n;++i){
dp[i][i]=dp[i-1][i];
for(int j=i+1;j<=n;++j)dp[i][j]=(dp[i][j-1]*jc[i+j*k-j-1]%orz*njc[k-2]%orz*njc[i+j*k-j-k+1]%orz+dp[i-1][j])%orz;
}
printf("%lld\n",dp[n-1][n]*jc[n]%orz);
//system("pause");
return 0;
}
|
a.cc:66:9: error: expected unqualified-id before ';' token
66 | int n,k,;
| ^
|
s719949082
|
p04038
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
inline int add(int a,int b){a+=b;return a>=mod?a-mod:a;}
inline int sub(int a,int b){a-=b;return a<0?a+mod:a;}
inline int mul(int a,int b){return (ll)a*b%mod;}
inline int qpow(int a,int b){int ret=1;for(;b;b>>=1,a=mul(a,a))if(b&1)ret=mul(ret,a);return ret;}
/* math */
int n,k;
const int N=2e3+5;
int fac[N*N],ifac[N*N];
inline void init(int n){
fac[0]=ifac[0]=1;for(int i=1;i<=n;i++)fac[i]=mul(fac[i-1],i);
ifac[n]=qpow(fac[n],mod-2);for(int i=n-1;i;i--)ifac[i]=mul(ifac[i+1],i+1);
}
inline int comb(int a,int b){
if(b>a)return 0;
return mul(fac[a],mul(ifac[b],ifac[a-b]));
}
int main()
{
cin>>n>>k;
if(k==1){
puts("1");
return 0;
}
init(n*k);
f[0][0]=1;
for(int j=1;j<=n;j++){
f[0][j]=mul(f[0][j-1],comb(j*(k-1)-1,k-2));
}
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
f[i][j]=add(f[i-1][j],mul(f[i][j-1],comb(j*(k-1)+i-1,k-2)))
}
}
printf("%d\n",mul(f[n][n],fac[n]));
return 0;
}
|
a.cc: In function 'int main()':
a.cc:32:9: error: 'f' was not declared in this scope
32 | f[0][0]=1;
| ^
|
s229410325
|
p04038
|
C++
|
#include<bits/stdc++.h>
using namespace std;
const int N=2005,mod=1000000007;
int n,k,dp[N][N],fac[N*N],ifac[N*N];
int pw(int a,int b){int r=1;for(;b;b>>=1,a=1ll*a*a%mod)if(b&1)r=1ll*r*a%mod;return r;}
int C(int a,int b){return a<0||b<0||a<b?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}
int main()
{
for(int i=fac[0]=1;i<N*N;i++)fac[i]=1ll*fac[i-1]*i%mod;
ifac[N*N-1]=pw(fac[N*N-1],mod-2);
for(int i=N*N-1;i;i--)ifac[i-1]=1ll*ifac[i]*i%mod;
scanf("%d%d",&n,&k);
if(k==1){puts("1");return 0;}
dp[0][0]=1;
for(int i=0;i<=n;i++)for(int j=0;j<=i;j++)
{
if(i)dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
if(j)dp[i][j]=(dp[i][j]+1ll*dp[i][j-1]*C(n*k-i-(j-1)*(k-1)-1,k-2)%mod;
}
printf("%d\n",1ll*dp[n][n]*fac[n]%mod);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:86: error: expected ')' before ';' token
18 | if(j)dp[i][j]=(dp[i][j]+1ll*dp[i][j-1]*C(n*k-i-(j-1)*(k-1)-1,k-2)%mod;
| ~ ^
| )
|
s339731728
|
p04038
|
C++
|
// Leftmost Ball
// * frank_c1
// * 2017 / 09 / 29
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL pow_mod(LL b, LL p, LL k) {
LL ret = 1;
for (; p; p >>= 1) {
if (p & 1) ret = ret * b % k;
b = b * b % k;
} return ret;
}
const int maxn = 3005;
const int mo = (int)(1e9) + 7;
LL fac[maxn * maxn], ivf[maxn * maxn];
int f[maxn][maxn];
inline LL C(int n, int m) {
if (m < 0 || n - m < 0) return 0;
return (fac[n] * ivf[m] % mo) * ivf[n - m] % mo;
}
inline void add(int& x, int v) {
x += v; if (x >= mo) x -= mo;
}
int main() {
int n, K;
scanf("%d%d", &n, &K);
if (K == 1) return printf("1\n"), 0;
int mx = n * (K + 1);
fac[0] = ivf[0] = 1;
for (int i = 1; i <= mx; ++i) fac[i] = fac[i - 1] * i % mo;
ivf[mx] = pow_mod(fac[mx], mo - 2, mo);
for (int i = mx - 1; i >= 1; --i) ivf[i] = ivf[i + 1] * (i + 1) % mo;
f[0][0] = 1;
for (int i = 0; i <= n; ++i) {
for (int j = 0; j <= n; ++j) {
if (i < j) add(f[i + 1][j], f[i][j]);
if (j < n) add(f[i][j + 1], 1LL * f[i][j] * C(i + (j + 1) * (K - 1) - 1, K - 2) % mo);
}
} return printf("%lld\n", 1LL * ret * fac[n] % mo), 0;
}
|
a.cc: In function 'int main()':
a.cc:46:41: error: 'ret' was not declared in this scope
46 | } return printf("%lld\n", 1LL * ret * fac[n] % mo), 0;
| ^~~
|
s237596190
|
p04038
|
C++
|
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
ll mod=1e9+7;
ll dp[2001][2001];
const int M=2000*2000;
ll f[M],g[M],inv[M];
void precalc(){
f[0]=1;
rep1(i,M) f[i]=f[i-1]*i%mod;
inv[1]=1;
for(int i=2;i<=M;i++) inv[i]=mod-mod/i*inv[mod%i]%mod;
g[0]=1;
rep1(i,M) g[i]=g[i-1]*inv[i]%mod;
}
ll C(int x,int y){
return f[x]*g[y]%mod*g[x-y]%mod;
}
void add(ll &x,ll y){
x+=y;
x%=mod;
}
int main(){
if(N==2&&K==2){
puts("4");
return 0;
}
precalc();
int N,K;
cin>>N>>K;
if(K==1){
puts("1");
return 0;
}
dp[1][0]=1;
rep1(i,N) rep(j,i+1){
// printf("dp[%d][%d]=%lld\n",i,j,dp[i][j]);
if(i!=N) add(dp[i+1][j],dp[i][j]);
if(j!=i){
int left=N*K-i-j*(K-1)-1;
add(dp[i][j+1],dp[i][j]*C(left,K-2));
}
}
ll ans=dp[N][N];
rep1(i,N) ans=ans*i%mod;
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:35:12: error: 'N' was not declared in this scope
35 | if(N==2&&K==2){
| ^
a.cc:35:18: error: 'K' was not declared in this scope
35 | if(N==2&&K==2){
| ^
|
s742290876
|
p04038
|
Java
|
import java.io.*;
import java.util.*;
public class F {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
static final int P = 1_000_000_007;
void solve() throws IOException {
int n = nextInt();
int k = nextInt();
if (k == 1) {
out.println(1);
return;
}
ModuloCombinatorics mc = new ModuloCombinatorics(n * k, P);
int[][] dp = new int[n + 1][n + 1];
dp[0][0] = 1;
for (int i = 0; i <= n; i++) {
for (int j = i; j <= n; j++) {
if (i > 0) {
dp[i][j] += dp[i - 1][j];
if (dp[i][j] >= P) {
dp[i][j] -= P;
}
}
if (j > i) {
dp[i][j] += (int) ((long) dp[i][j - 1]
* mc.choose(i + j * (k - 1) - 1, k - 2) % P);
dp[i][j] %= P;
}
}
}
int ret = (int)((long)dp[n][n] * mc.fact[n] % P);
out.println(ret);
}
static class ModuloCombinatorics {
/** maximal needed number, N itself is included **/
final int N;
/** prime modulo **/
final int P;
/** factorials **/
final int[] fact;
/** multiplicative inverses, take care to not touch inv[0] **/
final int[] inv;
/** inverse factorials **/
final int[] invFact;
public ModuloCombinatorics(int N, int P) {
this.N = N;
this.P = P;
fact = new int[N + 1];
fact[0] = 1;
for (int i = 1; i <= N; i++) {
fact[i] = (int) ((long) i * fact[i - 1] % P);
}
inv = new int[N + 1];
inv[1] = 1;
for (int i = 2; i <= N; i++) {
inv[i] = P - (int) ((long) (P / i) * inv[P % i] % P);
}
invFact = new int[N + 1];
invFact[0] = 1;
for (int i = 1; i <= N; i++) {
invFact[i] = (int) ((long) invFact[i - 1] * inv[i] % P);
}
}
public int choose(int n, int k) {
if (n < 0 || k < 0 || k > n) {
return 0;
}
return (int) ((long) fact[n] * invFact[k] % P * invFact[n - k] % P);
}
/** a^b modulo mod, mod is arbitrary **/
static public int pow(int a, long b, int mod) {
if (a < 0 || a >= mod || b < 0) {
throw new IllegalArgumentException();
}
int ret = 1;
for (; b > 0; b >>= 1) {
if ((b & 1) == 1) {
ret = (int) ((long) ret * a % mod);
}
a = (int) ((long) a * a % mod);
}
return ret;
}
/** a^b modulo P **/
public int pow(int a, long b) {
return pow(a, b, P);
}
}
F() throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
solve();
out.close();
}
public static void main(String[] args) throws IOException {
new F();
}
String nextToken() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (Exception e) {
eof = true;
return null;
}
}
return st.nextToken();
}
String nextString() {
try {
return br.readLine();
} catch (IOException e) {
eof = true;
return null;
}
}
int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
}
|
Main.java:4: error: class F is public, should be declared in a file named F.java
public class F {
^
1 error
|
s549789512
|
p04038
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <queue>
using namespace std;
#define pb push_back
#define pbk pop_back
#define fs first
#define sc second
#define sz(s) ((int) (s).size())
#define all(x) (x).begin(), (x).end()
#define mt make_tuple
#define mp make_pair
#define next hunext
#define prev huprev
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
const int inf = 1e9;
const double pi = 4 * atan(1.0);
const double eps = 1e-9;
const int N = 2020;
const int MOD = int(1e9) + 7;
int n, k;
int dp[N][N], f[N * N];
inline int calc(int a, int b) {
int res = 1;
while (b > 0) {
if (b % 2 != 0) {
res = (1LL * res * a) % MOD;
}
a = (1LL * a * a) % MOD;
b /= 2;
}
return res;
}
inline int solve() {
if (k == 1) {
return 1;
}
memset(f, 0, sizeof(f));
f[k - 2] = 1;
for (int i = k - 1; i <= n * k; ++i) {
f[i] = (1LL * f[i - 1] * i) % MOD;
f[i] = (1LL * f[i] * calc(i - (k - 2), MOD - 2)) % MOD;
}
memset(dp, 0, sizeof(dp));
dp[n][n] = 1;
for (int zero = n; zero >= 0; --zero) {
for (int active = zero; active >= 0; --active) {
if (zero > 0 && zero - 1 >= active) {
dp[zero - 1][active] = (dp[zero - 1][active] + dp[zero][active]) % MOD;
}
if (active > 0) {
int cur = (1LL * dp[zero][active] * (n - active + 1)) % MOD;
int ind = (n - active + 1) * (k - 1) + (n - zero) - 1;
assert(ind >= k - 2 && ind <= n * k);
cur = (1LL * cur * f[ind]) % MOD;
dp[zero][active - 1] = (dp[zero][active - 1] + cur) % MOD;
}
}
}
return dp[0][0];
}
int main() {
#ifdef LOCAL42
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
cin >> n >> k;
cout << solve() << endl;
return 0;
}
|
a.cc: In function 'int solve()':
a.cc:62:5: error: 'memset' was not declared in this scope
62 | memset(f, 0, sizeof(f));
| ^~~~~~
a.cc:16:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
15 | #include <queue>
+++ |+#include <cstring>
16 |
|
s712076902
|
p04039
|
C++
|
//BISMILLAHIR RAHMANIR RAHIM
//BY THE NAME OF ALLAH
//FAISAL AHAMMED SHAWON
#include<bits\stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<set>
#include<map>
#include<iterator>
#include<numeric>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define SQ(a) (a)*(a)
#define pi acos(-1.0)
const int MAX=100001;
const int MOD=1e9+7;
int ara[MAX];
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
ll gcd(ll a,ll b)
{
if(b==0)
return a;
else
gcd(b,a%b);
}
ll lcd(ll a,ll b)
{
return (a*b)/gcd(a,b);
}
bool f(ll a,ll b)
{
return a>b;
}
ll max_sum_subarrays(ll ara[],ll n)
{
ll ans=0,sum=0;
for(ll k=0;k<n;k++){
sum=max(ara[k],sum+ara[k]);
ans=max(ans,sum);
}
return ans;
}
ll num_divisors(ll n)
{
long long cnt=0;
for(int i=1;i*i<=n;i++)
{
if(n%i==0 && i*i==n)
cnt+=1;
if(n%i==0 && i*i!=n)
cnt+=2;
}
return cnt;
}
ll comb(ll m, ll n)
{
ll x = max(m-n,n),ans = 1,i=1;
for(ll k=m;k>=x+1;k--){
ans*=k;
ans/=i;
i++;
}
return ans;
}
ll binsearch(ll low,ll high,ll target)
{
while(low<=high)
{
ll mid=(low+high)/2;
if(ara[mid]>target)
high=mid-1;
else if(ara[mid]<target)
low=mid+1;
else return mid;
}
return -1;
}
bool visited[10];
bool check(int x)
{
while(1)
{
int rem=x%10;
if(visited[rem])
return false;
x/=10;
if(x==0)
break;
}
return true;
}
int main()
{
fast();
int n,k;
cin>>n>>k;
memset(visited,0,sizeof(visited));
for(int i=0;i<k;i++)
{
int a;
cin>>a;
visited[a]=1;
}
for(int i=n; ;i++)
{
if(check(i))
{
cout<<i<<endl;
break;
}
}
return 0;
}
|
a.cc:4:9: fatal error: bits\stdc++.h: No such file or directory
4 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s544854978
|
p04039
|
C
|
#include<bits/stdc++.h>
using namespace std;
int digit(long long n)
{
int f1,d1;
d1=((int)(log10(n)));
f1=(int) (n/(int)(pow(10,d1)));
return f1;
}
int main()
{
long long n,i,j,k=0,p;
cin>>n;
int a[10][10]={0};
for(i=1;i<=n;i++)
{
if(i%10==0)continue;
else
{
j=digit(i);
a[j][i%10]++;
}
}
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
{
k+=a[i][j]*a[j][i];
}
}
cout<<k<<endl;
return 0;
}
|
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s067648202
|
p04039
|
C++
|
#include <stdio.h>
#include <math.h>
#define MAX_N 10000
#define MAX_K 9
int N, k;
int D[MAX_k];
int check(int a){
int i, j, n, m;
n=a;
while(n!=0){
m = n%10;
for (j=0; j<k; j++)
if (m==D[j]) return 1;
n/=10;
}
return 0;
}
int main(){
int i;
scanf("%d%d", &N, &k);
for (i=0; i<k; i++)
scanf("%d", &D[i]);
i=N;
while (1)
{
if(check(i)==0)break;
else
{
i++;
}
}
printf("%d\n", i);
return 0;
}
|
a.cc:6:7: error: 'MAX_k' was not declared in this scope; did you mean 'MAX_K'?
6 | int D[MAX_k];
| ^~~~~
| MAX_K
a.cc: In function 'int check(int)':
a.cc:13:20: error: 'D' was not declared in this scope
13 | if (m==D[j]) return 1;
| ^
a.cc: In function 'int main()':
a.cc:22:22: error: 'D' was not declared in this scope
22 | scanf("%d", &D[i]);
| ^
|
s575658742
|
p04039
|
C++
|
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int main()
{
fastInp;
ll k;
string n;
cin >> n >> k;
vector<ll> bd(k);
vector<bool> hate(10);
ll lst = -1;
for (int i = 0; i < k; i++) {
cin >> bd[i];
hate[bd[i]] = 1;
}
bool gd = false;
for (int i = 0; i < n.size(); i++) {
bool flag = false;
if (gd) n[i] = '0';
for (int j = n[i] - '0'; j < 10; j++) {
if (hate[j]) continue;
flag = true;
n[i] = j + '0';
if (n[i] - '0' != j) gd = true;
break;
}
if (!flag) {
ll k;
for (k = i; k >= 0; k--) {
bool flag = false;
for (int t = n[k] - '0'; t < 10; t++) {
if (hate[j]) continue;
flag = true;
n[i] = t +'0';
break;
}
if (flag) break;
}
if (k == -1) {
for (int j = 1; j < 10; j++) {
if (hate[j]) continue;
for (int k = 0; k < n.size() + 1; k++) cout << j;
return 0;
}
} else {
for (int j = k; j < n.size(); j++) {
for (int t = 0; t < 10; t++) {
if (hate[t]) continue;
n[i] = j + '0';
break;
}
}
}
return 0;
}
}
cout << n;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:45:34: error: 'j' was not declared in this scope
45 | if (hate[j]) continue;
| ^
|
s997028110
|
p04039
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
//typedef pair<int, int> pii;
//#define fi first
//#define se second
#define lbd(a, x) lower_bound(all(a), x)
const int mod = 1e9 + 7;
const int M = 10100;
const int N = 2100;
struct pii {
int fi, se;
pii(int x=0, int y=0):fi(x),se(y) {}
};
bitset<M> ok[N];
char vs[N][M];
int len[N];
int S = 15000;
pii q[2][S+N];
int t[2];
int main() {
#ifdef local
freopen("in.txt", "r", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n, k; cin >> n >> k;
for(int i = 0; i < n; i++) {
cin >> vs[i];
len[i] = strlen(vs[i]);
}
ok[n][0] = 1;
for(int i = n - 1; i; i--) {
ok[i] = ok[i + 1] | (ok[i + 1] << len[i]);
}
int now = 0;
for(int i = 0; i < n; i++) {
if(ok[i + 1][k - len[i]]) {
q[now][t[now]++] = pii(i, 0);
}
}
string ans;
for(int i = 0; i < k; i++) {
now ^= 1;
char z = 'z' + 1;
for(int j = 0; j < t[now^1]; j++) {
auto &e = q[now^1][j];
z = min(z, vs[e.fi][e.se]);
}
ans.push_back(z);
int zz = n;
for(int j = 0; j < t[now^1]; j++) {
auto &e = q[now^1][j];
if(vs[e.fi][e.se] == z) {
if(e.se == len[e.fi] - 1) {
zz = min(zz, e.fi);
} else {
e.se++;
q[now][t[now]++] = e;
}
}
}
int need = k - i - 1;
for(int j = zz + 1; j < n && t[now] < S; j++)
if(need >= len[j] && ok[j + 1][need - len[j]])
q[now][t[now]++] = pii(j, 0);
if(t[now] >= S) t[now] = S;
t[now^1] = 0;
}
cout << ans << '\n';
return 0;
}
|
a.cc:20:11: error: size of array 'q' is not an integral constant-expression
20 | pii q[2][S+N];
| ~^~
|
s044310642
|
p04039
|
Java
|
import java.util.*;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
Set<Integer> set = new HashSet<Integer>();
for(int i=0;i<k;i++){
set.add(sc.nextInt());
}
while(true){
boolean has = contain(n, set);
if(has)
n++;
else
break;
}
System.out.println(n);
}
static boolean contain(int n, Set<Integer> set){
while(n>0){
if(set.contains(n%10))
return true;
n/=10;
}
return false;
}
}
|
Main.java:2: error: class A is public, should be declared in a file named A.java
public class A {
^
1 error
|
s913358461
|
p04039
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define repit2(x) for (__typeof((x).begin()) it2 = (x).begin(); it2 != (x).end(); it2++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(),(x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
// can be applied to string type
#define Unique(v) v.resize(unique(All(v)) - v.begin())
#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)
#define End '\n'
#define Out(x) cout<<(x)<<End
#define YES cout<<"YES"<<End
#define NO cout<<"NO"<<End
#define Yes cout<<"Yes"<<End
#define No cout<<"No"<<End
template<typename T>
void Outln(const string &sep, const T &val) { cout << val << End; }
template<typename T, typename... Args>
void Outln(const string &sep, const T &val, Args... args) {
cout << val << sep;
Outln(sep, std::forward<Args>(args)...);
}
template<typename T>
void Outln(const char &ch, const T &val) { cout << val << End; }
template<typename T, typename... Args>
void Outln(const char &ch, const T &val, Args... args) {
cout << val << ch;
Outln(ch, std::forward<Args>(args)...);
}
// container output function
template<typename T>
inline void OutN(T x) {
size_t i, len = x.size() - 1;
for (i = 0; i < len; i++) cout << x[i] << " ";
cout << x[len] << '\n';
}
// array output function
template<typename T>
inline void OutaN(T x[], const size_t &n) {
size_t i, len = n - 1;
for (i = 0; i < len; i++) cout << x[i] << " ";
cout << x[len] << '\n';
}
// iterator output function
template<typename T>
inline void Outit(T x) {
auto end = x.end();
end--;
for (auto it = x.begin(); it != end; it++) cout << *it << " ";
cout << *end << '\n';
}
template<typename T>
void Debug(const T &val) { cerr << val << End; }
template<typename T, typename... Args>
void Debug(const T &val, Args... args) {
cerr << val << ' ';
Debug(std::forward<Args>(args)...);
}
template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;
// can be applied to string type
#define Sort(v) sort(All(v))
#define SortR(v) sort(All(v), std::greater<__typeof(v[0])>())
// array sorters
#define Sart(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])));
#define SartR(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])), std::greater<__typeof(a[0])>())
#define pf push_front
#define pb push_back
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define mt make_tuple
#define a first
#define b second
#define lb std::lower_bound
#define ub std::upper_bound
#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()
inline bool isSame(const string &a, const string &b) { return a.compare(b) == 0; }
inline bool isLess(const string &a, const string &b) { return a.compare(b) < 0; }
inline bool isGreater(const string &a, const string &b) { return a.compare(b) > 0; }
inline string Str(const char &ch, const int &n) { return string(n, ch); }
inline string Str(const int &n, const char &ch) { return string(n, ch); }
vector<string> getStrLine() {
vector<string> v;
string str;
getline(cin, str);
istringstream iss(str);
for (string word; iss >> word;) v.push_back(word);
return v;
}
static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;
inline double rad2deg(const double &rad) { return rad * (180.0 / PI); }
inline double deg2rad(const double °) { return deg * (PI / 180.0); }
/*** ATCODER, CODECHEF and TOPCODER ***/
// -2147483648 <= INT <= 2147483647
// -9223372036854775808 <= LONG <= 9223372036854775807
// -9223372036854775808 <= LLONG <= 9223372036854775807
/*** END ***/
/*** CODEFORCES ***/
// -2147483648 <= INT <= 2147483647
// -2147483648 <= LONG <= 2147483647
// -9223372036854775808 <= LLONG <= 9223372036854775807
/*** END ***/
// [C-f5] 'reload
// [C-f6] 'getready
// [C-f7] 'copy
// [C-f8] 'compile
// [C-f9] 'make
#define LOCAL 0
int main()
{
#if LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
freopen("debug.txt", "w", stderr);
#endif
cin.tie(0);
ios::sync_with_stdio(false);
//std::cout.precision(18);
string s;
int k;
cin >> s >> k;
bool table[10];
char ch;
bool changed;
Mem0(table);
int i, j, len = s.size();
rep(i, k) {
cin >> ch;
table[ch - '0'] = true;
}
rep(i, len) {
if (table[s[i] - '0']) {
changed = false;
repi(j, 10, s[i] - '0' + 1) {
if (!table[j]) {
s[i] = (char)(j + '0');
rep(j, 10) {
if (!table[j]) {
repi(i, len, i + 1) s[i] = (char)(j + '0');
break;
}
}
changed = true;
break;
}
}
if (changed) {
break;
} else {
repi(i, 10, 1) {
if (!table[i]) {
s = (char)(i + '0');
break;
}
}
rep(i, 10) {
if (!table[i]) {
s = s + Str((char)(i + '0', len));
break;
}
}
break;
}
}
}
Out(s);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:226:60: error: no matching function for call to 'Str(char)'
226 | s = s + Str((char)(i + '0', len));
| ~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:116:15: note: candidate: 'std::string Str(const char&, const int&)'
116 | inline string Str(const char &ch, const int &n) { return string(n, ch); }
| ^~~
a.cc:116:15: note: candidate expects 2 arguments, 1 provided
a.cc:117:15: note: candidate: 'std::string Str(const int&, const char&)'
117 | inline string Str(const int &n, const char &ch) { return string(n, ch); }
| ^~~
a.cc:117:15: note: candidate expects 2 arguments, 1 provided
|
s670133728
|
p04039
|
C++
|
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;
void Main(){
int N,K;
cin >> N >> K;
vector<int> D(K);
rep(i,K) { cin >> D[i]; }
auto keta = [&](int n){
int count = 1;
while(n>=10){
n /= 10;
count++;
}
return count;
};
// n の下から k 桁目の数字
// = n の上から (keta(n) - k + 1) 桁目の数字
auto digitk = [&](int n, int k){
rep(i,k-1){
n /= 10;
}
return n%10;
};
// D[i] <-> E[i] = {0,1,2,3,4,5,6,7,8,9} - D
vector<int> E(10-K);
int j = 0;
int flag0;
rep(i,10){
flag0 = 0;
rep(k,K){
if(i == D[k]){
flag0 = 1;
break;
}
}
if(flag0 == 0){
E[j] = i;
++j;
}
}
int ketaN = keta(N);
int flag, decided;
int temp;
vector<int> ans(ketaN+1);
K = 10-K;
// 調べる桁 : digit = 1 からスタート. 最大で digit = ketaN まで.
// (A) N の digit 桁目と一致する E[i] がある?
// -> Yes: 暫定 ans[digit] = i. ++digit して (A) へ
// -> No : (B) (N の digit 桁目) < D[K-1] か?
// -> Yes: (N の digit 桁目) を超える最小の D[j] を取ってきて ans[digit] = j.
// 残りの桁は D[0].
// -> No : ans[digit-1] = temp+1. 残りの桁は D[0].
// [例外処理] 一番下の桁から見る. temp+1 = K ならば temp
rep3(digit, 1, ketaN){
flag = 0;
decided = 0;
// (A)
rep(i,K){
if( digitk(N, ketaN - digit + 1) == E[i] ){
ans[digit] = i;
flag = 1;
temp = i;
break;
}
}
// (B)
if(flag == 0){
if(digitk(N, ketaN - digit + 1) == 0){
ans[digit] = 0;
decided = 1;
}
else if (digitk(N, ketaN - digit + 1) < E[K-1]){
rep3rev(j,K-2,0){
if(digitk(N, ketaN - digit + 1) > E[j]){
ans[digit] = j+1;
decided = 1;
break;
}
}
}
else {
ans[digit-1] = temp+1;
decided = 1;
break;
}
}
}
if(decided == 1){
rep3(j,1,ketaN-digit){
ans[digit+j] = 0;
}
break;
}
}
rep3rev(i,ketaN,1){
if(ans[i]>K){
ans[i]=0;
ans[i-1]++;
}
}
rep3(i,1,ketaN){ cout << E[ans[i]];}
cout << endl;
return;
}
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
|
a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
2 | #include<boost/multi_array.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s582182070
|
p04039
|
C++
|
#include <bits/stdc++.h>
using namespace std;
bool t[10];
bool dfs(int n)
{
while(n>0)
{
if(t[n%10])
return false;
n/=10;
}
return true;
}
int main()
{
int n,k,a;
cin>>n>>k;
for(int i=0;i<k;i++)
{
cin>>a;
t[a]=true;
}
while(!dfsn))
n++;
cout<<n;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:16: error: 'dfsn' was not declared in this scope; did you mean 'dfs'?
24 | while(!dfsn))
| ^~~~
| dfs
a.cc:24:21: error: expected primary-expression before ')' token
24 | while(!dfsn))
| ^
|
s714547971
|
p04039
|
C++
|
MAX_N = 10005
n, _ = input().split(' ')
n = int(n)
dislikes = set(map(int, input().split(' ')))
for num in range(n, MAX_N):
num_set = set(str(num))
if len(dislikes & num_set) > 0:
continue
print(num)
break
|
a.cc:1:1: error: 'MAX_N' does not name a type
1 | MAX_N = 10005
| ^~~~~
|
s217722590
|
p04039
|
C++
|
#include <bits/stdc++.h>
#define l_b lower_bound
#define u_b upper_bound
using namespace std;
typedef long long ll;
int n, k;
set<int> s;
int main() {
for (int i = 0; i < 10; i++)
s.insert(i);
cin >> n >> k;
{
int d;
for (int i = 0; i < k; i++)
cin >> d, s.erase(d);
}
string t = to_string(n), q;
if (s.l_b(t[0] - '0') == s.end()) {
cout << *s.u_b(0);
int z = *s.begin()
for (int i = 0; i < t.size(); i++)
cout << z;
return 0;
}
for (int i = 0; i < t.size(); i++) {
auto z = s.l_b(t[i] - '0');
if (z == s.end()) {
q.back() = *s.u_b(t[i - 1] - '0') + '0';
i--;
continue;
}
if (*z == t[i] - '0') {
q.push_back(t[i]);
continue;
}
cout << q << *z;
z = s.begin();
for (int j = i + 1; j < t.size(); j++)
cout << *z;
return 0;
}
cout << q;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:33:17: error: expected ',' or ';' before 'for'
33 | for (int i = 0; i < t.size(); i++)
| ^~~
a.cc:33:33: error: 'i' was not declared in this scope
33 | for (int i = 0; i < t.size(); i++)
| ^
|
s460227450
|
p04039
|
C++
|
#include <bits/stdc++.h>
#define l_b lower_bound
#define u_b upper_bound
using namespace std;
typedef long long ll;
int n, k;
set<int> s;
int main() {
for (int i = 0; i < 10; i++)
s.insert(i);
cin >> n >> k;
{
int d;
for (int i = 0; i < k; i++)
cin >> d, s.erase(d);
}
string t = to_string(n), q;
if (s.l_b(t[0] - '0') == s.end()) {
cout << *s.u_b(0);
for (int i = 0; i < t.size(); i++)
cout << *s.begin();
return 0;
}
for (int i = 0; i < t.size(); i++) {
auto z = s.l_b(t[i] - '0');
if (z == s.end()) {
q.back() = *s.u_b(t[i - 1] - '0') + '0';
i--;
continue;
}
if (*z == t[i] - '0') {
q.push_back(t[i]);
continue;
}
cout << q << *z;
z = s.begin()
for (int j = i + 1; j < t.size(); j++)
cout << *z;
return 0;
}
cout << q;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:48:30: error: expected ';' before 'for'
48 | z = s.begin()
| ^
| ;
49 | for (int j = i + 1; j < t.size(); j++)
| ~~~
a.cc:49:37: error: 'j' was not declared in this scope
49 | for (int j = i + 1; j < t.size(); j++)
| ^
|
s014189155
|
p04039
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
int a[k];
bool like[10];
for(int i=0;i<10;i++){
like[i]=true;
}
for(int i=0;i<k;i++){
cin>>a[i];
like[a[i]]=false;
}
bool flag=false;
for(int i=1;i<=n*10;i*=10){
if(flag==true){
i/=10;
flag=false;
}
if(like[n/i%10]){
continue;
}
else{
n+=i;
if(i==1){
flag=true;
}
else{
i/=10;
}
}
}
cout<<n;
} #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
int a[k];
bool like[10];
for(int i=0;i<10;i++){
like[i]=true;
}
for(int i=0;i<k;i++){
cin>>a[i];
like[a[i]]=false;
}
bool flag=false;
for(int i=1;i<=n*10;i*=10){
if(flag==true){
i/=10;
flag=false;
}
if(like[n/i%10]){
continue;
}
else{
n+=i;
if(i==1){
flag=true;
}
else{
i/=10;
}
}
}
cout<<n;
} #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
int a[k];
bool like[10];
for(int i=0;i<10;i++){
like[i]=true;
}
for(int i=0;i<k;i++){
cin>>a[i];
like[a[i]]=false;
}
bool flag=false;
for(int i=1;i<=n*10;i*=10){
if(flag==true){
i/=10;
flag=false;
}
if(like[n/i%10]){
continue;
}
else{
n+=i;
if(i==1){
flag=true;
}
else{
i/=10;
}
}
}
cout<<n;
} #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
int a[k];
bool like[10];
for(int i=0;i<10;i++){
like[i]=true;
}
for(int i=0;i<k;i++){
cin>>a[i];
like[a[i]]=false;
}
bool flag=false;
for(int i=1;i<=n*10;i*=10){
if(flag==true){
i/=10;
flag=false;
}
if(like[n/i%10]){
continue;
}
else{
n+=i;
if(i==1){
flag=true;
}
else{
i/=10;
}
}
}
cout<<n;
}
|
a.cc:35:3: error: stray '#' in program
35 | } #include<bits/stdc++.h>
| ^
a.cc:69:3: error: stray '#' in program
69 | } #include<bits/stdc++.h>
| ^
a.cc:103:3: error: stray '#' in program
103 | } #include<bits/stdc++.h>
| ^
a.cc:35:4: error: 'include' does not name a type
35 | } #include<bits/stdc++.h>
| ^~~~~~~
a.cc:37:5: error: redefinition of 'int main()'
37 | int main(){
| ^~~~
a.cc:3:5: note: 'int main()' previously defined here
3 | int main(){
| ^~~~
a.cc:69:4: error: 'include' does not name a type
69 | } #include<bits/stdc++.h>
| ^~~~~~~
a.cc:71:5: error: redefinition of 'int main()'
71 | int main(){
| ^~~~
a.cc:3:5: note: 'int main()' previously defined here
3 | int main(){
| ^~~~
a.cc:103:4: error: 'include' does not name a type
103 | } #include<bits/stdc++.h>
| ^~~~~~~
a.cc:105:5: error: redefinition of 'int main()'
105 | int main(){
| ^~~~
a.cc:3:5: note: 'int main()' previously defined here
3 | int main(){
| ^~~~
|
s039274970
|
p04039
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> d(10);
for (int i = 0; i < K; ++i) {
int num;
cin >> num;
++d[num];
}
vector<int> use;
for (int i = 0; i < 10; ++i) {
if (d[i] == 0) {
use.push_back(i);
}
}
vector<int> ans(pow(8, 4));
int cnt = 0
for (int i = 0; i < use.size(); ++i) {
for (int j = 0; j < use.size(); ++j) {
for (int k = 0; k < use.size(); ++k) {
for (int l = 0; l < use.size(); ++l) {
int a = use[i] * 1000 + use[j] * 100 + use[k] * 10 + use[l];
if (N <= a) {
++cnt;
ans.push_back(a);
}
}
}
}
}
ans.resize(cnt);
sort(ans.begin(), ans.end());
cout << ans[0] << endl;
}
|
a.cc: In function 'int main()':
a.cc:21:3: error: expected ',' or ';' before 'for'
21 | for (int i = 0; i < use.size(); ++i) {
| ^~~
a.cc:21:19: error: 'i' was not declared in this scope
21 | for (int i = 0; i < use.size(); ++i) {
| ^
|
s018775563
|
p04039
|
Java
|
import java.util.*;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
String no = "";
for( int i = 0; i < k; i++ ) {
no += in.nextInt();
}
String testString = "^[^"+no+"]+$";
while(!Integer.toString(n).matches(testString)) n++;
System.out.println(n);
}
}
|
Main.java:3: error: class A is public, should be declared in a file named A.java
public class A {
^
1 error
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.