submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s805425050
|
p04040
|
C++
|
#include <bits/stdc++.h> // {{{
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define let const auto
#define USE_T template <typename T>
#define USE_Ti template <typename T = int>
#define USE_TU template <typename T, typename U>
USE_Ti using duo = std::pair<T, T>;
USE_Ti using vec = std::vector<T>;
using ll = long long;
// clang-format off
USE_TU inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE_TU inline bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE_Ti inline T in(){T x;std::cin>>x;return x;}
USE_Ti inline vec<T> in(int n){vec<T> v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE_T inline void in(T*x,int n){rep(i,n)x[i]=in<T>();}
struct IoSetup {
IoSetup(){
using namespace std;
cin.tie(0);
ios::sync_with_stdio(0);
cout<<setprecision(10);
cerr<<setprecision(10);
}
} iosetup;
// clang-format on
// }}}
using namespace std;
const int inf = 1001001001;
const ll infll = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};
// {{{ mod.hpp
#ifndef INCLUDE_MOD_HPP
#define INCLUDE_MOD_HPP
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <type_traits>
namespace orliv {
namespace math {
namespace mod_internal {
// clang-format off
template <typename T>
struct next_uint {};
template<>struct next_uint<std::uint8_t> {using type = std::uint16_t;};
template<>struct next_uint<std::uint16_t>{using type = std::uint32_t;};
template<>struct next_uint<std::uint32_t>{using type = std::uint64_t;};
template<>struct next_uint<std::uint64_t>{using type = std::uint64_t;};
template<typename T>
using next_uint_t = typename next_uint<T>::type;
// clang-format on
template <typename T>
using signed_type = typename std::make_signed<T>::type;
template <typename T>
using unsigned_type = typename std::make_unsigned<T>::type;
template <typename T, typename S = signed_type<T>>
inline T extgcd(T x, T y, S& a, S& b) {
// ax + by = gcd(x, y)
// return gcd(x,y), ref a, b
assert(x > 0 && y > 0 && "x and y must be greater than 0");
S u[] = {S(x), 1, 0}, v[] = {S(y), 0, 1};
while (*v) {
S t = *u / *v;
std::swap(u[0] -= t * v[0], v[0]);
std::swap(u[1] -= t * v[1], v[1]);
std::swap(u[2] -= t * v[2], v[2]);
}
a = u[1], b = u[2];
return u[0];
}
template <typename Derived, typename T>
struct ModBase {
using value_type = mod_internal::unsigned_type<T>;
Derived& derived() { return *static_cast<Derived*>(this); }
const Derived& derived() const { return *static_cast<const Derived*>(this); }
Derived clone() const { return derived(); }
Derived image(value_type x) const { return Derived(x, derived().MOD); }
Derived inv() const {
signed_type<value_type> a, b;
auto& self = derived();
auto gcd = extgcd(self.MOD, self.val, b, a);
assert(gcd == 1 && "not exists inverse");
return image(a);
}
#define MOD_DEF_OPERATOR(OP, BLOCK) \
Derived& operator OP##=(const Derived& rhs) BLOCK; \
Derived operator OP(const Derived& rhs) const { return clone() OP## = rhs; } \
Derived& operator OP##=(const value_type& rhs) { return derived() OP## = image(rhs); } \
Derived operator OP(const value_type& rhs) const { return clone() OP## = image(rhs); }
MOD_DEF_OPERATOR(+, {
auto& self = derived();
self.val = (self.val + self.val) % self.MOD;
return self;
})
MOD_DEF_OPERATOR(-, {
auto& self = derived();
self.val = (self.val + self.MOD - rhs.val) % self.MOD;
return self;
})
MOD_DEF_OPERATOR(*, {
auto& self = derived();
self.val = next_uint_t<value_type>(self.val) * rhs.val % self.MOD;
return self;
})
MOD_DEF_OPERATOR(/, { return derived() *= rhs.inv(); })
#undef MOD_DEF_OPERATOR
};
}
namespace mod {
const unsigned long long Dynamic = 0;
const unsigned long long Static = 1;
}
template <typename T, unsigned long long MOD_>
struct Mod : public mod_internal::ModBase<Mod<T, MOD_>, T> {
using value_type = mod_internal::unsigned_type<T>;
static constexpr value_type MOD = MOD_;
value_type val;
Mod(T val, value_type mod = MOD) : val((val % T(MOD) + MOD) % MOD) {}
};
template <typename T>
struct Mod<T, mod::Dynamic> : public mod_internal::ModBase<Mod<T, mod::Dynamic>, T> {
using value_type = mod_internal::unsigned_type<T>;
const value_type MOD;
value_type val;
Mod(T val, value_type MOD) : val((val % T(MOD) + MOD) % MOD), MOD(MOD) {}
};
template <typename T>
struct Mod<T, mod::Static> : public mod_internal::ModBase<Mod<T, mod::Static>, T> {
using value_type = mod_internal::unsigned_type<T>;
static value_type MOD;
value_type val;
Mod(T val, value_type mod = 1) : val((val % T(MOD) + MOD) % MOD) {}
};
template <typename T>
mod_internal::unsigned_type<T> Mod<T, mod::Static>::MOD = 1;
template <unsigned long long MOD>
using ModInt = Mod<int, MOD>;
template <unsigned long long MOD>
using ModLong = Mod<long long, MOD>;
}
}
#endif
// }}}
using mint = orliv::math::ModLong<TEN(9) + 7>;
vec<mint> fact(200001, 0);
void build() {
fact[0] = 1;
rep(i, 1, fact.size()) { fact[i] = fact[i - 1] * i; }
}
mint nCr(int n, int r) {
return fact[n] / (fact[n - r] * fact[r]);
}
mint route(int h, int w) {
return nCr(h + w - 2, h - 1);
}
vec<vec<mint>> dp(50, vec<mint>(50, 0));
signed main() {
build();
int H = in(), W = in(), A = in(), B = in();
mint S = 0;
rep(i, H - A) { S = S.val + route(i + 1, B).val * route(H - i, W - B).val; }
cout << S.val << endl;
return 0;
}
|
a.cc: In substitution of 'template<class T> using orliv::math::mod_internal::next_uint_t = typename orliv::math::mod_internal::next_uint::type [with T = long long unsigned int]':
a.cc:118:3: required from 'Derived& orliv::math::mod_internal::ModBase<Derived, T>::operator*=(const Derived&) [with Derived = orliv::math::Mod<long long int, 1000000007>; T = long long int]'
120 | self.val = next_uint_t<value_type>(self.val) * rhs.val % self.MOD;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:118:3: required from 'Derived orliv::math::mod_internal::ModBase<Derived, T>::operator*(const value_type&) const [with Derived = orliv::math::Mod<long long int, 1000000007>; T = long long int; value_type = long long unsigned int]'
118 | MOD_DEF_OPERATOR(*, {
| ^
a.cc:170:52: required from here
170 | rep(i, 1, fact.size()) { fact[i] = fact[i - 1] * i; }
| ^
a.cc:66:7: error: no type named 'type' in 'struct orliv::math::mod_internal::next_uint<long long unsigned int>'
66 | using next_uint_t = typename next_uint<T>::type;
| ^~~~~~~~~~~
|
s314117969
|
p04040
|
C++
|
#include <bits/stdc++.h> // {{{
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define let const auto
#define USE_T template <typename T>
#define USE_Ti template <typename T = int>
#define USE_TU template <typename T, typename U>
USE_Ti using duo = std::pair<T, T>;
USE_Ti using vec = std::vector<T>;
using ll = long long;
// clang-format off
USE_TU inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE_TU inline bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE_Ti inline T in(){T x;std::cin>>x;return x;}
USE_Ti inline vec<T> in(int n){vec<T> v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE_T inline void in(T*x,int n){rep(i,n)x[i]=in<T>();}
struct IoSetup {
IoSetup(){
using namespace std;
cin.tie(0);
ios::sync_with_stdio(0);
cout<<setprecision(10);
cerr<<setprecision(10);
}
} iosetup;
// clang-format on
// }}}
using namespace std;
const int inf = 1001001001;
const ll infll = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};
// {{{ mod.hpp
#ifndef INCLUDE_MOD_HPP
#define INCLUDE_MOD_HPP
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <type_traits>
namespace orliv {
namespace math {
namespace mod_internal {
// clang-format off
template <typename T>
struct next_uint {};
template<>struct next_uint<std::uint8_t> {using type = std::uint16_t;};
template<>struct next_uint<std::uint16_t>{using type = std::uint32_t;};
template<>struct next_uint<std::uint32_t>{using type = std::uint64_t;};
template<>struct next_uint<std::uint64_t>{using type = __uint128_t;};
template<typename T>
using next_uint_t = typename next_uint<T>::type;
// clang-format on
template <typename T>
using signed_type = typename std::make_signed<T>::type;
template <typename T>
using unsigned_type = typename std::make_unsigned<T>::type;
template <typename T, typename S = signed_type<T>>
inline T extgcd(T x, T y, S& a, S& b) {
// ax + by = gcd(x, y)
// return gcd(x,y), ref a, b
assert(x > 0 && y > 0 && "x and y must be greater than 0");
S u[] = {S(x), 1, 0}, v[] = {S(y), 0, 1};
while (*v) {
S t = *u / *v;
std::swap(u[0] -= t * v[0], v[0]);
std::swap(u[1] -= t * v[1], v[1]);
std::swap(u[2] -= t * v[2], v[2]);
}
a = u[1], b = u[2];
return u[0];
}
template <typename Derived, typename T>
struct ModBase {
using value_type = mod_internal::unsigned_type<T>;
Derived& derived() { return *static_cast<Derived*>(this); }
const Derived& derived() const { return *static_cast<const Derived*>(this); }
Derived clone() const { return derived(); }
Derived image(value_type x) const { return Derived(x, derived().MOD); }
Derived inv() const {
signed_type<value_type> a, b;
auto& self = derived();
auto gcd = extgcd(self.MOD, self.val, b, a);
assert(gcd == 1 && "not exists inverse");
return image(a);
}
#define MOD_DEF_OPERATOR(OP, BLOCK) \
Derived& operator OP##=(const Derived& rhs) BLOCK; \
Derived operator OP(const Derived& rhs) const { return clone() OP## = rhs; } \
Derived& operator OP##=(const value_type& rhs) { return derived() OP## = image(rhs); } \
Derived operator OP(const value_type& rhs) const { return clone() OP## = image(rhs); }
MOD_DEF_OPERATOR(+, {
auto& self = derived();
self.val = (self.val + self.val) % self.MOD;
return self;
})
MOD_DEF_OPERATOR(-, {
auto& self = derived();
self.val = (self.val + self.MOD - rhs.val) % self.MOD;
return self;
})
MOD_DEF_OPERATOR(*, {
auto& self = derived();
self.val = next_uint_t<value_type>(self.val) * rhs.val % self.MOD;
return self;
})
MOD_DEF_OPERATOR(/, { return derived() *= rhs.inv(); })
#undef MOD_DEF_OPERATOR
};
}
namespace mod {
const unsigned long long Dynamic = 0;
const unsigned long long Static = 1;
}
template <typename T, unsigned long long MOD_>
struct Mod : public mod_internal::ModBase<Mod<T, MOD_>, T> {
using value_type = mod_internal::unsigned_type<T>;
static constexpr value_type MOD = MOD_;
value_type val;
Mod(T val, value_type mod = MOD) : val((val % T(MOD) + MOD) % MOD) {}
};
template <typename T>
struct Mod<T, mod::Dynamic> : public mod_internal::ModBase<Mod<T, mod::Dynamic>, T> {
using value_type = mod_internal::unsigned_type<T>;
const value_type MOD;
value_type val;
Mod(T val, value_type MOD) : val((val % T(MOD) + MOD) % MOD), MOD(MOD) {}
};
template <typename T>
struct Mod<T, mod::Static> : public mod_internal::ModBase<Mod<T, mod::Static>, T> {
using value_type = mod_internal::unsigned_type<T>;
static value_type MOD;
value_type val;
Mod(T val, value_type mod = 1) : val((val % T(MOD) + MOD) % MOD) {}
};
template <typename T>
mod_internal::unsigned_type<T> Mod<T, mod::Static>::MOD = 1;
template <unsigned long long MOD>
using ModInt = Mod<int, MOD>;
template <unsigned long long MOD>
using ModLong = Mod<long long, MOD>;
}
}
#endif
// }}}
using mint = orliv::math::ModLong<TEN(9) + 7>;
vec<mint> fact(200001, 0);
void build() {
fact[0] = 1;
rep(i, 1, fact.size()) { fact[i] = fact[i - 1] * i; }
}
mint nCr(int n, int r) {
return fact[n] / (fact[n - r] * fact[r]);
}
mint route(int h, int w) {
return nCr(h + w - 2, h - 1);
}
vec<vec<mint>> dp(50, vec<mint>(50, 0));
signed main() {
build();
int H = in(), W = in(), A = in(), B = in();
mint S = 0;
rep(i, H - A) { S = S.val + route(i + 1, B).val * route(H - i, W - B).val; }
cout << S.val << endl;
return 0;
}
|
a.cc: In substitution of 'template<class T> using orliv::math::mod_internal::next_uint_t = typename orliv::math::mod_internal::next_uint::type [with T = long long unsigned int]':
a.cc:118:3: required from 'Derived& orliv::math::mod_internal::ModBase<Derived, T>::operator*=(const Derived&) [with Derived = orliv::math::Mod<long long int, 1000000007>; T = long long int]'
120 | self.val = next_uint_t<value_type>(self.val) * rhs.val % self.MOD;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:118:3: required from 'Derived orliv::math::mod_internal::ModBase<Derived, T>::operator*(const value_type&) const [with Derived = orliv::math::Mod<long long int, 1000000007>; T = long long int; value_type = long long unsigned int]'
118 | MOD_DEF_OPERATOR(*, {
| ^
a.cc:170:52: required from here
170 | rep(i, 1, fact.size()) { fact[i] = fact[i - 1] * i; }
| ^
a.cc:66:7: error: no type named 'type' in 'struct orliv::math::mod_internal::next_uint<long long unsigned int>'
66 | using next_uint_t = typename next_uint<T>::type;
| ^~~~~~~~~~~
|
s569210313
|
p04040
|
Java
|
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class IrohaAndGrid {
static long[] fact = new long[300000];
static long mod = (long) 1e9 + 7;
static long pow(long base, long pow) {
if (pow == 1)
return base;
long half = pow(base, pow / 2);
half %= mod;
half *= half;
half %= mod;
if (pow % 2 == 1)
half *= base;
half %= mod;
return half;
}
static long C(int n, int r) {
long f = fact[n];
f *= pow(fact[r], mod - 2);
f %= mod;
f *= pow(fact[n - r], mod - 2);
f %= mod;
return f;
}
public static void main(String[] args) {
InputReader r = new InputReader(System.in);
fact[0] = 1;
for (int i = 1; i < fact.length; i++) {
fact[i] = fact[i - 1] * i;
fact[i] %= mod;
}
long h = r.nextLong();
long w = r.nextLong();
long a = r.nextLong();
long b = r.nextLong();
long res = 0;
for (long i = 1; i <= h - a; i++) {
long way1 = C((int) (b - 1 + i - 1), (int) b - 1);
way1 *= C((int) (w - b - 1 + h - i), (int) (h - i));
way1 %= mod;
res += way1;
res %= mod;
}
System.out.println(res);
}
static class InputReader {
private BufferedReader reader;
private StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public InputReader(FileReader stream) {
reader = new BufferedReader(stream);
tokenizer = null;
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
}
|
Main.java:8: error: class IrohaAndGrid is public, should be declared in a file named IrohaAndGrid.java
public class IrohaAndGrid {
^
1 error
|
s719294349
|
p04041
|
C++
|
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,x,y,z;
int end;
int sum;
long long dp[45][1<<18];
long long ans=1,mod=1e9+7;
int main()
{
freopen("haiku.txt","r",stdin);
scanf("%d%d%d%d",&n,&x,&y,&z);
memset(dp,0,sizeof dp);
end=1<<x+y+z-1;
end=end|(1<<y+z-1);
end=end|(1<<z-1);//end记录满足俳句的状态
sum=(1<<(x+y+z))-1;
dp[0][0]=1;
for(int i=1;i<=n;i++)
{
ans*=10;
ans%=mod;
for(int j=0;j<=sum;j++)
{
if(dp[i-1][j]==0) continue;
for(int k=1;k<=10;k++)
{
int now=(j<<k)|(1<<k-1);//上面提到的二进制码转移
now&=sum;//防止now溢出
if((now&end)!=end)//如果状态存在俳句则不进行转移
dp[i][now]=(dp[i][now]+dp[i-1][j])%mod;
}
}
}
for(int j=0;j<=sum;j++)
ans=(ans-dp[n][j]+mod)%mod;//用总字串数减去不满足俳句字串数
printf("%lld",ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:9: error: reference to 'end' is ambiguous
17 | end=1<<x+y+z-1;
| ^~~
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: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/range_access.h:36:
/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:7:5: note: 'int end'
7 | int end;
| ^~~
a.cc:18:9: error: reference to 'end' is ambiguous
18 | end=end|(1<<y+z-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:7:5: note: 'int end'
7 | int end;
| ^~~
a.cc:18:13: error: reference to 'end' is ambiguous
18 | end=end|(1<<y+z-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:7:5: note: 'int end'
7 | int end;
| ^~~
a.cc:19:9: error: reference to 'end' is ambiguous
19 | end=end|(1<<z-1);//end记录满足俳句的状态
| ^~~
/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:7:5: note: 'int end'
7 | int end;
| ^~~
a.cc:19:13: error: reference to 'end' is ambiguous
19 | end=end|(1<<z-1);//end记录满足俳句的状态
| ^~~
/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:7:5: note: 'int end'
7 | int end;
| ^~~
a.cc:33:41: error: reference to 'end' is ambiguous
33 | if((now&end)!=end)//如果状态存在俳句则不进行转移
| ^~~
/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:7:5: note: 'int end'
7 | int end;
| ^~~
a.cc:33:47: error: reference to 'end' is ambiguous
33 | if((now&end)!=end)//如果状态存在俳句则不进行转移
|
|
s088471702
|
p04041
|
Java
|
import java.io.*;
import java.util.*;
public class A {
static int[][] memo;
static int[] stages;
static int MOD = (int) 1e9 + 7;
static int dp(int idx, int msk) {
if (check(msk))
return 0;
if (idx == 0)
return 1;
if (memo[idx][msk] != -1)
return memo[idx][msk];
int ans = 0;
for (int d = 1; d <= 10; d++) {
int newMsk = updMsk(msk, d);
ans += dp(idx - 1, newMsk);
if(ans>=MOD)
ans-=MOD;
}
return memo[idx][msk] = (int) ans;
}
private static int updMsk(int msk, int d) {
// String s = numToString(d);
// String curr = Integer.toBinaryString(msk);
// int take = Math.min(17 - s.length(), curr.length());
// StringBuilder ans = new StringBuilder();
// for (int i = curr.length() - take; i < curr.length(); i++)
// ans.append(curr.charAt(i));
// ans.append(s);
// int ret = 0;
// for (int i = ans.length() - 1, bit = 0; i >= 0; i--, bit++)
// if (ans.charAt(i) == '1')
// ret |= 1 << bit;
// return ret;
return (msk<<d | (1<<(d-1))) & ((1<<17)-1);
}
// static String numToString(int x) {
// StringBuilder sb = new StringBuilder("1");
// while (sb.length() < x)
// sb.append("0");
// return sb.toString();
// }
private static boolean check(int msk) {
char[] a = Integer.toBinaryString(msk).toCharArray();
ArrayList<Integer> values = new ArrayList();
for (int i = a.length - 1, len = 0; i >= 0; i--) {
len++;
if (a[i] == '1') {
values.add(len);
len = 0;
}
}
int sum = 0, stage = 2;
for (int x : values) {
sum += x;
if (sum > stages[stage])
return false;
if (sum == stages[stage]) {
stage--;
sum = 0;
}
if (stage == -1)
return true;
}
return false;
}
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner();
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
stages = new int[3];
memo=new int [n+1][1<<17];
for(int []x:memo)
Arrays.fill(x, -1);
for (int i = 0; i < 3; i++)
stages[i] = sc.nextInt();
long ans=1;
for(int i=0;i<n;i++)
ans=ans*10%MOD;
ans-=dp(n,0);
if(ans<0)
ans+=MOD;
System.out.println(ans);
out.close();
}
static class Scanner {
BufferedReader br;
StringTokenizer st;
Scanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
Scanner(String fileName) throws FileNotFoundException {
br = new BufferedReader(new FileReader(fileName));
}
String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
String nextLine() throws IOException {
return br.readLine();
}
int nextInt() throws IOException {
return Integer.parseInt(next());
}
long nextLong() throws NumberFormatException, IOException {
return Long.parseLong(next());
}
double nextDouble() throws NumberFormatException, IOException {
return Double.parseDouble(next());
}
boolean ready() throws IOException {
return br.ready();
}
int[] nxtArr(int n) throws IOException {
int[] ans = new int[n];
for (int i = 0; i < n; i++)
ans[i] = nextInt();
return ans;
}
}
static void sort(int[] a) {
shuffle(a);
Arrays.sort(a);
}
static void shuffle(int[] a) {
int n = a.length;
Random rand = new Random();
for (int i = 0; i < n; i++) {
int tmpIdx = rand.nextInt(n);
int tmp = a[i];
a[i] = a[tmpIdx];
a[tmpIdx] = tmp;
}
}
}
|
Main.java:4: error: class A is public, should be declared in a file named A.java
public class A {
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s296054452
|
p04041
|
C++
|
a
|
a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s743977413
|
p04041
|
C++
|
解けなかった
言われてみると当たり前...解けないとまずそう
|
a.cc:1:1: error: '\U000089e3\U00003051\U0000306a\U0000304b\U00003063\U0000305f' does not name a type
1 | 解けなかった
| ^~~~~~~~~~~~
|
s628729005
|
p04041
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;
template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
//ll N,X,Y,Z;
//cin>>N>>X>>Y>>Z;
知っているので実質AC
return 0;
}
|
a.cc: In function 'int main()':
a.cc:25:1: error: '\U000077e5\U00003063\U00003066\U00003044\U0000308b\U0000306e\U00003067\U00005b9f\U00008ceaAC' was not declared in this scope
25 | 知っているので実質AC
| ^~~~~~~~~~~~~~~~~~~~
|
s447087357
|
p04041
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second
template <class T>
void cout_vec(const vector<T> &vec){
for(auto itr:vec) cout<<itr<<' ';
cout<<endl;
}
typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,x,y,z;
cin>>n>>x>>y>>z;
vector<vector<int>> dp(n+1,vector<int>((1<<(x+y+z-1))+10,0));
int mask=(1ll<<(x+y+z-1))-1;
int ng=(1<<(x+y+z-1)|(1<<(y+z-1))|(1<<(z-1));
dp[0][0]=1;
rep(i,n){
rep(S,1<<(x+y+z-1)){
if((S & ng)==ng) continue;
FOR(j,1,11){
int T=(S<<j) | (1<<(j-1));
if((T & ng)==ng) continue;
T&=mask;
(dp[i+1][T]+=dp[i][S])%=mod;
}
}
}
ll ans=1;
rep(i,n) (ans*=10)%=mod;
rep(i,1<<(x+y+z-1)) (ans-=dp[n][i])%=mod;
cout<<(ans+mod)%mod<<endl;
}
|
a.cc: In function 'int main()':
a.cc:28:47: error: expected ')' before ';' token
28 | int ng=(1<<(x+y+z-1)|(1<<(y+z-1))|(1<<(z-1));
| ~ ^
| )
|
s665662041
|
p04041
|
C++
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
import java.util.Arrays;
public class Main
{
static class Scanner
{
BufferedReader br;
StringTokenizer tk=new StringTokenizer("");
public Scanner(InputStream is)
{
br=new BufferedReader(new InputStreamReader(is));
}
public int nextInt() throws IOException
{
if(tk.hasMoreTokens())
return Integer.parseInt(tk.nextToken());
tk=new StringTokenizer(br.readLine());
return nextInt();
}
public long nextLong() throws IOException
{
if(tk.hasMoreTokens())
return Long.parseLong(tk.nextToken());
tk=new StringTokenizer(br.readLine());
return nextLong();
}
public String next() throws IOException
{
if(tk.hasMoreTokens())
return (tk.nextToken());
tk=new StringTokenizer(br.readLine());
return next();
}
public String nextLine() throws IOException
{
tk=new StringTokenizer("");
return br.readLine();
}
public double nextDouble() throws IOException
{
if(tk.hasMoreTokens())
return Double.parseDouble(tk.nextToken());
tk=new StringTokenizer(br.readLine());
return nextDouble();
}
public char nextChar() throws IOException
{
if(tk.hasMoreTokens())
return (tk.nextToken().charAt(0));
tk=new StringTokenizer(br.readLine());
return nextChar();
}
public int[] nextIntArray(int n) throws IOException
{
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n) throws IOException
{
long a[]=new long[n];
for(int i=0;i<n;i++)
a[i]=nextLong();
return a;
}
public int[] nextIntArrayOneBased(int n) throws IOException
{
int a[]=new int[n+1];
for(int i=1;i<=n;i++)
a[i]=nextInt();
return a;
}
public long[] nextLongArrayOneBased(int n) throws IOException
{
long a[]=new long[n+1];
for(int i=1;i<=n;i++)
a[i]=nextLong();
return a;
}
}
public static void main(String args[]) throws IOException
{
new Thread(null, new Runnable() {
public void run() {
try
{
solve();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}, "1", 1 << 26).start();
}
static long dp[][];
static long mod=1000000007;
static int XYZ_MASK;
static long pow[];
static int merge(int lastMask, int digit){
int newMask=lastMask<<digit;
newMask&=(0b11111111111111111);
newMask|=(1<<(digit-1));
return newMask;
}
static long sol(int i, int mask){
if((mask&XYZ_MASK)==XYZ_MASK){
return pow[i];
}
if(i==0){
return 0;
}
if(dp[i][mask]!=-1)
return dp[i][mask];
dp[i][mask]=0;
for(int digit=1;digit<=10;digit++){
dp[i][mask]+=sol(i-1,merge(mask,digit));
}
dp[i][mask]%=mod;
return dp[i][mask];
}
static void solve() throws IOException
{
Scanner in=new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
int n=in.nextInt();
pow=new long[n+1];
pow[0]=1;
for(int i=1;i<=n;i++)
pow[i]=(10*pow[i-1])%mod;
int x=in.nextInt(), y=in.nextInt(), z=in.nextInt();
XYZ_MASK=(1<<(z-1))|(1<<(z+y-1))|(1<<(z+y+x-1));
dp=new long[n+1][1<<17];
for(int i=0;i<=n;i++)
Arrays.fill(dp[i], -1);
out.println(sol(n,0));
out.close();
}
}
|
a.cc:1:1: error: 'import' does not name a type
1 | import java.io.BufferedReader;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.io.InputStream;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.io.InputStreamReader;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.StringTokenizer;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.io.PrintWriter;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.util.Arrays;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
8 | public class Main
| ^~~~~~
|
s489363844
|
p04041
|
C++
|
#include <bits/stdc++.h>
#define LL long long
#define pow10 sndaslkknsda
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
int dp[41][4][7];
int W[41][15];
void add(int &a , int b)
{
a = a + b < mod ? a + b : a + b - mod;
}
int mult(int a , int b)
{
return (a * (LL)b) % mod;
}
int ways(int k , int n)
{
if(k < 0)
{
return 0;
}
if(n == 0)
return k == 0;
if(W[n][k] != -1)
{
return W[n][k];
}
int ans = 0;
for(int digit = 1; digit <= 10; digit++)
add(ans , ways(n - 1 , k - digit));
return W[n][k] = ans;
}
int pow10[45];
int main()
{
memset(W , -1 , sizeof W);
ios_base::sync_with_stdio(0);
pow10[0] = 1;
for(int i = 1; i <= 40; i++)
pow10[i] = mult(pow10[i - 1] , 10);
dp[0][0][0] = 1;
int n;
vector<int> X(3);
cin >> n >> X[0] >> X[1] >> X[2];
int ans = 0;
for(int x = 0; x < n; x++)
{
for(int y = x + 1; y < n; y++)
{
for(int z = y + 1; z < n; z++)
{
for(int w = z + 1; w <= n; w++)
{
add(ans , mult(pow10[n - w + x] , mult(ways(X[0] , y - x) , mult(ways(X[1] , z - y) , mult(ways(X[2] , w - z)))));
}
}
}
}
cout << ans;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:54:131: error: too few arguments to function 'int mult(int, int)'
54 | add(ans , mult(pow10[n - w + x] , mult(ways(X[0] , y - x) , mult(ways(X[1] , z - y) , mult(ways(X[2] , w - z)))));
| ~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:12:5: note: declared here
12 | int mult(int a , int b)
| ^~~~
|
s541605180
|
p04041
|
C++
|
#include <bits/stdc++.h>
#define LL long long
#define pow10 sndaslkknsda
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
int dp[41][4][7];
int W[41][15];
void add(int &a , int b)
{
a = a + b < mod ? a + b : a + b - mod;
}
int mult(int a , int b)
{
return (a * (LL)b) % mod;
}
int ways(int n , int k)
{
if(k < 0)
{
return 0;
}
if(n == 0)
return k == 0;
if(W[n][k] != -1)
{
return W[n][k];
}
int ans = 0;
for(int digit = 1; digit <= 10; digit++)
add(ans , ways(n - 1 , k - digit));
return W[n][k] = ans;
}
int pow10[45];
int main()
{
memset(W , -1 , sizeof W);
ios_base::sync_with_stdio(0);
pow10[0] = 1;
for(int i = 1; i <= 40; i++)
pow10[i] = mult(pow10[i - 1] , 10);
dp[0][0][0] = 1;
int n;
vector<int> x(3);
cin >> n >> x[0] >> x[1] >> x[2];
int ans = 0;
for(int x = 0; x < n; x++)
{
for(int y = x + 1; y < n; y++)
{
for(int z = y + 1; z < n; z++)
{
for(int w = z + 1; w <= n; w++)
{
add(ans , mult(pow10[n - w + x] , mult(ways(x[0] , y - x) , mult(ways(x[1] , z - y) , mult(ways(x[2] , w - z)))));
}
}
}
}
cout << ans;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:54:86: error: invalid types 'int[int]' for array subscript
54 | add(ans , mult(pow10[n - w + x] , mult(ways(x[0] , y - x) , mult(ways(x[1] , z - y) , mult(ways(x[2] , w - z)))));
| ^
a.cc:54:112: error: invalid types 'int[int]' for array subscript
54 | add(ans , mult(pow10[n - w + x] , mult(ways(x[0] , y - x) , mult(ways(x[1] , z - y) , mult(ways(x[2] , w - z)))));
| ^
a.cc:54:138: error: invalid types 'int[int]' for array subscript
54 | add(ans , mult(pow10[n - w + x] , mult(ways(x[0] , y - x) , mult(ways(x[1] , z - y) , mult(ways(x[2] , w - z)))));
| ^
|
s724999673
|
p04041
|
C++
|
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
int dp[41][4][7];
int W[41][15];
void add(int &a , int b)
{
a = a + b < mod ? a + b : a + b - mod;
}
int mult(int a , int b)
{
return (a * (LL)b) % mod;
}
int ways(int n , int k)
{
if(k < 0)
{
return 0;
}
if(n == 0)
return k == 0;
if(W[n][k] != -1)
{
return W[n][k];
}
int ans = 0;
for(int digit = 1; digit <= 10; digit++)
add(ans , ways(n - 1 , k - digit));
return W[n][k] = ans;
}
int pow10[45];
int main()
{
memset(W , -1 , sizeof W);
ios_base::sync_with_stdio(0);
pow10[0] = 1;
for(int i = 1; i <= 40; i++)
pow10[i] = mult(pow10[i - 1] , 10);
dp[0][0][0] = 1;
int n;
vector<int> x(3);
cin >> n >> x[0] >> x[1] >> x[2];
int ans = 0;
for(int x = 0; x < n; x++)
{
for(int y = x + 1; y < n; y++)
{
for(int z = y + 1; z < n; z++)
{
for(int w = z + 1; w <= n; w++)
{
add(ans , mult(pow10[n - w + x] , mult(ways(x[0] , y - x) , mult(ways(x[1] , z - y) , mult(ways(x[2] , w - z)))));
}
}
}
}
cout << ans;
return 0;
}
|
a.cc:32:5: warning: built-in function 'pow10' declared as non-function [-Wbuiltin-declaration-mismatch]
32 | int pow10[45];
| ^~~~~
a.cc: In function 'int main()':
a.cc:53:86: error: invalid types 'int[int]' for array subscript
53 | add(ans , mult(pow10[n - w + x] , mult(ways(x[0] , y - x) , mult(ways(x[1] , z - y) , mult(ways(x[2] , w - z)))));
| ^
a.cc:53:112: error: invalid types 'int[int]' for array subscript
53 | add(ans , mult(pow10[n - w + x] , mult(ways(x[0] , y - x) , mult(ways(x[1] , z - y) , mult(ways(x[2] , w - z)))));
| ^
a.cc:53:138: error: invalid types 'int[int]' for array subscript
53 | add(ans , mult(pow10[n - w + x] , mult(ways(x[0] , y - x) , mult(ways(x[1] , z - y) , mult(ways(x[2] , w - z)))));
| ^
|
s552540667
|
p04041
|
C
|
#include <iostream>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
T mypow(T b, U n) {
if (n == 0) return 1;
if (n == 1) return b % MOD;
if (n % 2 == 0) {
return mypow(b * b % MOD, n / 2);
} else {
return mypow(b, n - 1) * b % MOD;
}
}
ll dp[50][1 << 18];
// dp[i][S] = i個の数値でSが作れるパターン数
int main() {
int N, X, Y, Z;
cin >> N >> X >> Y >> Z;
int W = X + Y + Z;
fill(dp[0], dp[45], 0);
dp[0][0] = 1;
ll ans = 0;
for (int i = 0; i <= N; ++i) {
for (int S = 0; S < (1 << W); ++S) {
if (((S >> (X - 1)) & 1) && ((S >> (X + Y - 1)) & 1) && ((S >> (X + Y + Z - 1)) & 1)) {
ans += dp[i][S] * mypow(10LL, N - i);
ans %= MOD;
dp[i][S] = 0;
}
}
for (int S = 0; S < (1 << W); ++S) {
for (int k = 1; k <= 10; ++k) {
int T = ((S << k) + (1 << (k - 1))) & ((1 << W) - 1);
dp[i + 1][T] += dp[i][S];
dp[i + 1][T] %= MOD;
}
}
}
cout << ans << endl;
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s302692981
|
p04041
|
C++
|
#include <iostream>
#include <cmath>
using namespace std;
#define MAX 200010
long long mod = 1000000007;
long long inv[MAX],fact[MAX],fi[MAX];
void inverse(){
int i;
inv[1] = 1;
for(i=2;i<MAX;i++){
inv[i] = mod - (mod/i)*inv[mod%i]%mod;
}
}
void factinv(){
int i;
fact[0] = fi[0] = 1;
for(i=1;i<MAX;i++){
fact[i] = fact[i-1]*i%mod;
fi[i] = (fi[i-1]*inv[i])%mod;
}
}
long long comb(int n,int k){
if(n<0 || k<0 || n<k){
return 0;
}else{
return fact[n]%mod*fi[k]%mod*fi[n-k]%mod;
}
}
int main(){
int x,y,z,w,n,i,j,k,l,a,b,c;
long long ans=0;
cin >> n >> a >> b >> c ;
for(i=0;x<n;x++){
for(y=0;y<n;y++){
for(z=0;z<n;z++){
for(w=0;w<n;w++){
long long e = pow(10,x-1)%mod;
long long f= pow(10,n+w-1)%mod
ans += e*comb(a-1,y-x)%mod*comb(b-1,z-x)%mod*comb(c-1,w-z)%mod*f;
}
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:43:66: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
43 | long long e = pow(10,x-1)%mod;
| ~~~~~~~~~~~^~~~
| | |
| | long long int
| __gnu_cxx::__promote<double>::__type {aka double}
a.cc:44:67: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
44 | long long f= pow(10,n+w-1)%mod
| ~~~~~~~~~~~~~^~~~
| | |
| | long long int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s540919058
|
p04041
|
C++
|
#include <bits/stdc++.h>
using namespace std;
const int Mask = (1 << 17) - 1;
const int mod = 1e9 + 7;
int f[47][Mask + 5];
int append(int status, int x) {
return ((status << x) | (1 << (x - 1))) & mask;
}
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
int n, x, y, z;
cin >> n >> x >> y >> z;
int S = 0;
S = append(S, x);
S = append(S, y);
S = append(S, z);
f[0][0] = 1;
for(int i = 1; i <= n; i++) {
for(int j = 0; j <= mask; j++) {
for(int k = 1; k <= 10; k++) {
int NewStatus = append(j, k);
if((NewStatus & S) == S) continue;
f[i][NewStatus] = (f[i][NewStatus] + f[i - 1][j]) % mod;
}
}
int ans = 1;
for(int i = 1; i <= n; i++) ans = 10LL * ans % mod;
for(int i = 0; i <= mask; i++) ans = (ans - f[n][i]) % mod;
cout << (ans + mod) % mod;
return 0;
}
return 0;
}
|
a.cc: In function 'int append(int, int)':
a.cc:10:51: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
10 | return ((status << x) | (1 << (x - 1))) & mask;
| ^~~~
| std::filesystem::perms::mask
In file included from /usr/include/c++/14/filesystem:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:162:7: note: 'std::filesystem::perms::mask' declared here
162 | mask = 07777,
| ^~~~
a.cc: In function 'int main()':
a.cc:28:37: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
28 | for(int j = 0; j <= mask; j++) {
| ^~~~
| std::filesystem::perms::mask
/usr/include/c++/14/bits/fs_fwd.h:162:7: note: 'std::filesystem::perms::mask' declared here
162 | mask = 07777,
| ^~~~
a.cc:38:37: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
38 | for(int i = 0; i <= mask; i++) ans = (ans - f[n][i]) % mod;
| ^~~~
| std::filesystem::perms::mask
/usr/include/c++/14/bits/fs_fwd.h:162:7: note: 'std::filesystem::perms::mask' declared here
162 | mask = 07777,
| ^~~~
|
s889251462
|
p04041
|
C++
|
#include "bits/stdc++.h"
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;
const int MAX_N = 200005;
int N,x[3],ss;
ll dp[41][1<<23];
map<vi,int> mp;
bool is_ok(vi v){
int cur = 0, cnt = 0;
for(auto i:v){
cnt += i;
if(cur==3) return false;
if(cnt==x[cur]) cur++, cnt = 0;
else if(cnt>x[cur]) return true;
}
return !(cur==3);
}
int encode(vi v){
if(mp.count(v)) return mp[v];
int s = 0;
for(auto i:v) s += i;
while(s>ss){
if(!is_ok(v)) return 0;
s -= v[0];
v.erase(v.begin());
}
if(mp.count(v)) return mp[v];
if(is_ok(v)){
return mp[v] = mp.size();
}else{
return 0;
}
}
int main(){
cin >> N >> x[0] >> x[1] >> x[2];
ss = x[0] + x[1] + x[2];
vi v1 = {x[0],x[1],x[2]};
mp[v1] = 0; mp[vi(0)] = 1;
dp[0][1] = 1LL;
rep(i,N){
auto mpc = mp;
for(auto vj:mpc){
auto v = vj.first;
int j = vj.second;
REP(k,1,11){
v.pb(k);
(dp[i+1][encode(v)] += dp[i][j]) %= lmod;
// cout << encode(v) << " "<< dp[i+1][encode(v)] << " " << i << " " << dp[i][j] << endl;
v.pop_back();
}
}
}
cout << dp[N][0] << endl;
return 0;
}
|
/tmp/ccqURMp6.o: in function `encode(std::vector<int, std::allocator<int> >)':
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x127): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x25f): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x282): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x2c9): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x2e4): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
/tmp/ccqURMp6.o: in function `main':
a.cc:(.text+0x405): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x440): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x48c): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
/tmp/ccqURMp6.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x7f3): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x80c): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s124309240
|
p04041
|
C++
|
#include "bits/stdc++.h"
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;
const int MAX_N = 200005;
int N,X[3],S;
ll dp[41][1<<23];
map<vi,int> mp;
bool is_ok(vi v){
int cur = 0, cnt = 0;
for(auto i:v){
cnt += i;
if(cur==3) return false;
if(cnt==X[cur]) cur++, cnt = 0;
else if(cnt>X[cur]) return true;
}
return !(cur==3);
}
int encode(vi v){
if(mp.count(v)) return mp[v];
int s = 0;
for(auto i:v) s += i;
while(s>S){
if(!is_ok(v)) return 0;
s -= v[0];
v.erase(v.begin());
}
if(mp.count(v)) return mp[v];
if(is_ok(v)){
return mp[v] = mp.size();
}else{
return 0;
}
}
int main(){
cin >> N >> X[0] >> X[1] >> X[2];
S = X[0] + X[1] + X[2];
vi v1 = {X[0],X[1],X[2]};
mp[v1] = 0; mp[vi(0)] = 1;
dp[0][1] = 1LL;
rep(i,N){
auto mpc = mp;
for(auto vj:mpc){
auto v = vj.first;
int j = vj.second;
REP(k,1,11){
v.pb(k);
(dp[i+1][encode(v)] += dp[i][j]) %= lmod;
// cout << encode(v) << " "<< dp[i+1][encode(v)] << " " << i << " " << dp[i][j] << endl;
v.pop_back();
}
}
}
cout << dp[N][0] << endl;
return 0;
}
|
/tmp/ccmotKsM.o: in function `encode(std::vector<int, std::allocator<int> >)':
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x127): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x25f): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x282): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x2c9): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x2e4): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
/tmp/ccmotKsM.o: in function `main':
a.cc:(.text+0x405): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x440): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x48c): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
/tmp/ccmotKsM.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x7f3): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x80c): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s722779339
|
p04041
|
C++
|
n,x,y,z=map(int,input().split())
mod=10**9+7
mask=1<<(x+y+z-1)
dp=[[0 for i in range(mask+1)] for j in range(n+1)]
dp[0][0]=1
ng=(1<<(x+y+z-1))|(1<<(y+z-1))|(1<<(z-1))
for i in range(n):
dp[i+1][mask]=(dp[i][mask]*10)%mod
for j in range(mask):
for k in range(1,11):
nmask=(j<<k)|(1<<(k-1))
if nmask&ng==ng:
nmask=mask
else:
nmask&=mask-1
dp[i+1][nmask]=(dp[i+1][nmask]+dp[i][j])%mod
print(dp[n][mask])
|
a.cc:1:1: error: 'n' does not name a type
1 | n,x,y,z=map(int,input().split())
| ^
|
s311878112
|
p04041
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int n,x,y,z;
vector<string> vx,vy,vz;
void dfs(int v,string now,vector<string> &a){
if (!v) return a.push_back(now);
now+='.';
for (int i=1;i<=v;i++) now[now.size()-1]=i-1,dfs(v-i,now,a);
}
typedef long long ll;
const int N=1e5+10,p=1e9+7;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int go[N][10],fail[N],top=1;
bool end[N];
void trie(string s){
int p=1;
for (int i=0;i<s.size();i++){
int w=s[i];
if (!go[p][w]) go[p][w]=++top;
p=go[p][w];
}
end[p]=1;
}
queue<int> Q;
void getfail(){
for (int i=0;i<10;i++)
if (go[1][i]) fail[go[1][i]]=1,Q.push(go[1][i]);
else go[1][i]=1;
while (!Q.empty()){
int v=Q.front();Q.pop();
for (int i=0;i<10;i++)
if (go[v][i]){
fail[go[v][i]]=go[fail[v]][i];
Q.push(go[v][i]);
}
else go[v][i]=go[fail[v]][i];
}
}
int dp[50][N],mi[50];
int main()
{
cin>>n>>x>>y>>z;
dfs(x,string(),vx);
dfs(y,string(),vy);
dfs(z,string(),vz);
for (int i=0;i<vx.size();i++)
for (int j=0;j<vy.size();j++)
for (int k=0;k<vz.size();k++)
trie(vx[i]+vy[j]+vz[k]);
getfail();
mi[0]=1;
for (int i=1;i<=n;i++) mi[i]=mul(mi[i-1],10);
int ans=0;
dp[0][1]=1;
for (int i=0;i<n;i++)
for (int v=1;v<=top;v++)
for (int w=0;w<10;w++){
int p=go[v][w];
if (end[p]) ans=inc(ans,mul(dp[i][v],mi[n-i-1]));
else dp[i+1][p]=inc(dp[i+1][p],dp[i][v]);
}
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'void trie(std::string)':
a.cc:23:9: error: reference to 'end' is ambiguous
23 | end[p]=1;
| ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:1:
/usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
1265 | end(const valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
1249 | end(valarray<_Tp>& __va) noexcept
| ^~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/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 /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/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:15:6: note: 'bool end [100010]'
15 | bool end[N];
| ^~~
a.cc: In function 'int main()':
a.cc:60:21: error: reference to 'end' is ambiguous
60 | if (end[p]) ans=inc(ans,mul(dp[i][v],mi[n-i-1]));
| ^~~
/usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
1265 | end(const valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
1249 | end(valarray<_Tp>& __va) 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:15:6: note: 'bool end [100010]'
15 | bool end[N];
| ^~~
|
s602957419
|
p04041
|
C++
|
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>
#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>
#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;
/*
thx
http://mayokoex.hatenablog.com/entry/2016/07/24/131007
*/
vector< vector<LL> > dp(41,vector<LL>(1<<18,0));
void solve(){
/*
dp[index][bit]
*/
int N,X,Y,Z;
cin >> N >> X >> Y >> Z;
LL ans = powMod(10,N);
/*
最大値から575を作れない数列の数を引いていく。
:=余事象を考える
*/
int ng=0;
ng |= 1<<(X+Y+Z); //Xの位置
ng |= 1<<(Z+Y); //Yの位置
ng |= 1<<(Z); //Zの位置
//1があるとまずい位置のビット表現
int mask = 1<<(X+Y+Z+1);
--mask;//必要なビットが全て1
dp[0][1] = 1;//長さ0
for(int n=0;n<N;++n){
for(int state=0;state<=mask;++state){
//長さnの状態stateに[1,10]を繋げる
for(int i=1;i<=10;++i){
int ns = ((state<<i)&mask) + 1;
if( (ns&ng) == ng ) continue;
dp[n+1][ns] += dp[n][state];
if( dp[n+1][ns] >= MOD ){
dp[n+1][ns] -= MOD;
}
}
}
}
/*
maskは全て1なのでngによりdp[][mask] = 0
*/
for(int i=0;i<=mask;++i){
ans -= dp[N][i];
ans = (ans+MOD) % MOD;
}
cout << ans << endl;
}
#pragma region main
signed main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//小数を10進数表示
cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別
solve();
}
#pragma endregion //main()
|
a.cc: In function 'void solve()':
a.cc:59:18: error: 'powMod' was not declared in this scope
59 | LL ans = powMod(10,N);
| ^~~~~~
|
s452344798
|
p04041
|
C++
|
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<string>
#include<stack>
#include<array>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<numeric>
#include<random>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
using namespace std;
template<int MOD = 1e9+7>class modint {
//MODが素数であることを前提として実装してあるが、その判定はしていない。
//あまりが出るような除算をしてはいけない。
public:
modint() {
//assert(is_prime());
this->number = 0;
}
modint(int src) {
//assert(is_prime());
this->number = src;
}
modint<MOD> operator + (const modint<MOD> obj) {
modint re((this->number + obj.number) % MOD);
return re;
}
modint<MOD> operator + (const int n) {
modint re((this->number + opposit(n)) % MOD);
return re;
}
modint<MOD>& operator += (const modint<MOD>& obj) {
this->number = (this->number + obj.number) % MOD;
return *this;
}
modint<MOD>& operator += (const int n) {
this->number = (this->number + opposit(n)) % MOD;
return *this;
}
modint<MOD> operator - (const modint<MOD> obj) {
modint re((this->number - obj.number + MOD) % MOD);
return re;
}
modint<MOD> operator - (const int n) {
modint re((this->number - opposit(n) + MOD) % MOD);
return re;
}
modint<MOD>& operator -= (const modint<MOD>& obj) {
this->number = (this->number - obj.number + MOD) % MOD;
return *this;
}
modint<MOD>& operator -= (const int n) {
this->number = (this->number - opposit(n) + MOD) % MOD;
return *this;
}
modint<MOD> operator * (const modint<MOD> obj) {
modint re((this->number * obj.number) % MOD);
return re;
}
modint<MOD> operator * (const int n) {
modint re((this->number * opposit(n)) % MOD);
return re;
}
modint<MOD>& operator *= (const modint<MOD>& obj) {
this->number = (this->number * obj.number) % MOD;
return *this;
}
modint<MOD>& operator *= (const int n) {
this->number = (this->number * opposit(n)) % MOD;
return *this;
}
modint<MOD> operator / (const modint<MOD> obj) {
modint re((this->number * inverse(obj.number)) % MOD);
return re;
}
modint<MOD> operator / (const int n) {
modint re((this->number * inverse(n)) % MOD);
return re;
}
modint<MOD>& operator /= (const modint<MOD>& obj) {
this->number = (this->number * inverse(obj.number)) % MOD;
return *this;
}
modint<MOD>& operator /= (const int n) {
this->number = (this->number * inverse(n)) % MOD;
return *this;
}
modint operator = (const int n) {
this->number = opposit(n) % MOD;
return *this;
}
int get() {
return number;
}
private:
int number;
int opposit(int n) {
if (n < 0)n = MOD - ((-n) % MOD);
return n % MOD;
}
int inverse(int n) {
n = opposit(n);
int result = 1;
for (int i = MOD - 2; i; i /= 2) {
if (i % 2)result = (result * n) % MOD;
n = (n * n) % MOD;
}
return result;
}
bool is_prime() {
if (MOD <= 1)return false;
if (MOD == 2)return true;
if (MOD % 2 == 0) return false;
int upperbound = sqrt(MOD);
for (int i = 3; i <= upperbound; i += 2) {
if (MOD % i == 0) return false;
}
return true;
}
};
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, X, Y, Z;
cin >> N >> X >> Y >> Z;
const int m = 1LL << (X + Y + Z);
const int tas = (1 << (Z - 1)) | (1 << (Y + Z - 1)) | (1 << (X + Y + Z - 1));
vector<vector<modint<>>>memo;
memo.resize(N + 1);
rep(i, N + 1)memo[i].resize(m + 1);
memo[0][0] = 1;
//memo[i][j]:=数列のi項目に着目して、かつ
//j < m: 直前の数列がjである(解説通りのbitDPでエンコードされているとする)ような数列の数。
//j == m: i項目までにXYZを含むような数列の数。
rep(i, N)for (int mask = 0; mask <= m; mask++)if (memo[i][mask].get()) {
for (int j = 1; j <= 10; j++) {
if (mask == m) {
//memo[i + 1][m] += memo[i][m] * 10;を意味する。
//i項目までにXYZを含むような数列は、i+1項目の数がなんでも良いので10倍する。
memo[i + 1][m] += memo[i][m];
continue;
}
int nmask = ((mask << j) | (1LL << (j - 1))) & (m - 1);
if ((nmask & tas) == tas)nmask = m;
memo[i + 1][nmask] += memo[i][mask];
}
}
cout << memo[N][m].get() << endl;
}
|
a.cc: In function 'int main()':
a.cc:24:23: error: conversion from 'double' to 'long int' in a converted constant expression
24 | template<int MOD = 1e9+7>class modint {
| ~~~^~
a.cc:24:23: error: could not convert '(1.0e+9 + (double)7)' from 'double' to 'long int'
24 | template<int MOD = 1e9+7>class modint {
| ~~~^~
| |
| double
a.cc:151:30: error: template argument 1 is invalid
151 | vector<vector<modint<>>>memo;
| ^~
a.cc:151:30: error: template argument 2 is invalid
a.cc:151:32: error: template argument 1 is invalid
151 | vector<vector<modint<>>>memo;
| ^
a.cc:151:32: error: template argument 2 is invalid
a.cc:152:14: error: request for member 'resize' in 'memo', which is of non-class type 'int'
152 | memo.resize(N + 1);
| ^~~~~~
a.cc:153:26: error: invalid types 'int[int64_t {aka long int}]' for array subscript
153 | rep(i, N + 1)memo[i].resize(m + 1);
| ^
a.cc:154:13: error: invalid types 'int[int]' for array subscript
154 | memo[0][0] = 1;
| ^
a.cc:159:63: error: invalid types 'int[int64_t {aka long int}]' for array subscript
159 | rep(i, N)for (int mask = 0; mask <= m; mask++)if (memo[i][mask].get()) {
| ^
a.cc:164:37: error: invalid types 'int[int64_t {aka long int}]' for array subscript
164 | memo[i + 1][m] += memo[i][m];
| ^
a.cc:164:55: error: invalid types 'int[int64_t {aka long int}]' for array subscript
164 | memo[i + 1][m] += memo[i][m];
| ^
a.cc:169:29: error: invalid types 'int[int64_t {aka long int}]' for array subscript
169 | memo[i + 1][nmask] += memo[i][mask];
| ^
a.cc:169:51: error: invalid types 'int[int64_t {aka long int}]' for array subscript
169 | memo[i + 1][nmask] += memo[i][mask];
| ^
a.cc:173:21: error: invalid types 'int[int64_t {aka long int}]' for array subscript
173 | cout << memo[N][m].get() << endl;
| ^
|
s752602167
|
p04041
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const ll mod=1e9+7;
int N,X,Y,Z;
int S;
bool nx[1<<16][11]={0};
ll dp[41][1<<16];
ll dfs(int now, int state)
{
if(dp[now][state]>=0) return dp[now][state];
if(now==N) return 1;
ll ret=0;
//次に選ぶ数
for(int i=1; i<=10; ++i)
{
if(nx[state][i])
{
ret+=dfs(now+1, ((state<<i)+(1<<(i-1)))%(1<<S));
ret%=mod;
}
}
return dp[now][state]=ret;
}
int main()
{
cin >>N >>X >>Y >>Z;
S=X+Y+Z-1;
//状態maskの時に,次の数iが来ていいかチェックしておく
rep(mask,1<<S)
{
//直前の状態を復元
vector<int> b;
int st=0;
rep(i,S)
{
if(state>>i&1)
{
b.pb(i-st+1);
st=i+1;
}
}
//jを次に選んだ時にXYZを含まないかチェック
for(int i=1; i<=10; ++i)
{
bool ok=true;
//直前から順番に見ていき貪欲に足していく
int x=0,y=0,z=i;
int bidx=0;
while(bidx<b.size() && z<Z) z+=b[bidx++];
while(bidx<b.size() && y<Y) y+=b[bidx++];
while(bidx<b.size() && x<X) x+=b[bidx++];
if(x==X && y==Y && z==Z) ok=false;
nx[mask][i]=ok;
}
}
//全体は10^N通り
ll p10=1;
rep(i,N) p10=(p10*10)%mod;
memset(dp,-1,sizeof(dp));
//XYZを含まない数列の個数
ll r=dfs(0,0);
//全体から引く
ll ans=(p10-r+mod)%mod;
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:54:16: error: 'state' was not declared in this scope; did you mean '_xstate'?
54 | if(state>>i&1)
| ^~~~~
| _xstate
|
s392747220
|
p04041
|
C++
|
#include <iostream>
#include <string>
#include <queue>
using namespace std;
const int MAXR = 500005, mod = 1000000000 + 7;
int n, x[3], pool, to[MAXR][11], link[MAXR];
bool isBad[MAXR];
void insert(string s) {
int r = 0;
for (auto cc : s) {
char c = cc - '0';
if (!to[r][c]) {
to[r][c] = ++pool;
}
r = to[r][c];
}
isBad[r] = 1;
}
void func(int u, int sum, string& s) {
if (sum == x[u]) {
++u;
sum = 0;
}
if (u == 3) {
insert(s);
return;
}
for (int d = 1; sum + d <= x[u]; ++d) {
s += char('0' + d);
func(u, sum + d, s);
s.pop_back();
}
}
void augment() {
int r = 0;
queue<int> Q;
Q.push(r);
while (!Q.empty()) {
int r = Q.front();
Q.pop();
for (int c = 0; c < 8; ++c) {
int v = to[r][c];
if (v == 0) {
to[r][c] = to[link[r]][c];
}
else {
if (r == 0) {
link[v] = 0;
}
else {
link[v] = to[link[r]][c];
}
isBad[v] |= isBad[r];
isBad[v] |= isBad[link[v]];
Q.push(v);
}
}
}
}
int DP[50][MAXR];
int dp(int n, int r) {
if (isBad[r]) {
return 0;
}
if (n == 0) {
return 1;
}
if (DP[n][r] != -1) {
return DP[n][r];
}
long long ans = 0;
for (int c = 1; c <= 10; ++c) {
ans += dp(n - 1, to[r][c]);
}
return DP[n][r] = ans % mod;
}
long long p10[50] = {1};
int main() {
for (int i = 1; i < 50; ++i) {
p10[i] = p10[i - 1] * 10 % mod;
}
memset(DP, -1, sizeof DP);
cin >> n >> x[0] >> x[1] >> x[2];
string curr;
//generate all haikus
func(0, 0, curr);
augment();
cout << (p10[n] - dp(n, 0) + mod) % mod;
}
|
a.cc: In function 'int main()':
a.cc:82:9: error: 'memset' was not declared in this scope
82 | memset(DP, -1, sizeof DP);
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <queue>
+++ |+#include <cstring>
4 | using namespace std;
|
s749093010
|
p04041
|
C++
|
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define MAX 42
int n;
int x;
int y;
int z;
#define MOD 1000000007
int dp[MAX][1 << 8][4];
//0: not
//1: x
//2: x,y
vector<int> v;
int main(){
cin >> n >> x >> y >> z;
dp[0][1][0] = 1;
v.push_back((1<<x));
v.push_back((1<<y));
v.push_back((1<<z));
v.push_back(0);
int M = (1 << 8) - 1;
for (int i = 0; i < n; i++){
for (int j = 0; j < (1 << 8); j++){
for (int k = 0; k < 4; k++){
for (int add = 1; add <= 10; add++){
int nex = j<<add;
int nex_k = k;
if (nex&v[k]){
nex_k++;
nex = 0;
}
else{
if (nex>v[k]){
if (k >= 1 && k <= 2){
}
}
}
nex &= M;
nex |= 1;
dp[i + 1][nex][nex_k] += dp[i][j][k];
if (dp[i + 1][nex][nex_k] >= MOD)dp[i + 1][nex][nex_k] -= MOD;
}
}
}
}
int sum = 0;
for (int i = 0; i < (1 << 8); i++){
sum += dp[n][i][3];
if (sum >= MOD)sum -= MOD;
}
printf("%d\n", sum);
return 0;
}
CE
|
a.cc:65:1: error: 'CE' does not name a type
65 | CE
| ^~
|
s806001930
|
p04041
|
C++
|
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <functional>
#include <set>
#include <ctime>
#include <random>
#include <chrono>
#include <cassert>
using namespace std;
namespace {
using Integer = long long; //__int128;
template<class T> istream& operator >> (istream& is, vector<T>& vec){for(T& val: vec) is >> val; return is;}
template<class T> istream& operator , (istream& is, T& val){ return is >> val;}
template<class T> ostream& operator << (ostream& os, const vector<T>& vec){for(int i=0; i<vec.size(); i++) os << vec[i] << (i==vec.size()-1?"":" "); return os;}
template<class T> ostream& operator , (ostream& os, const T& val){ return os << " " << val;}
template<class H> void print(const H& head){ cout << head; }
template<class H, class ... T> void print(const H& head, const T& ... tail){ cout << head << " "; print(tail...); }
template<class ... T> void println(const T& ... values){ print(values...); cout << endl; }
template<class H> void eprint(const H& head){ cerr << head; }
template<class H, class ... T> void eprint(const H& head, const T& ... tail){ cerr << head << " "; eprint(tail...); }
template<class ... T> void eprintln(const T& ... values){ eprint(values...); cerr << endl; }
class range{
long long start_, end_, step_;
public:
struct range_iterator{
long long val, step_;
range_iterator(long long v, long long step) : val(v), step_(step) {}
long long operator * (){return val;}
void operator ++ (){val += step_;}
bool operator != (range_iterator& x){return step_ > 0 ? val < x.val : val > x.val;}
};
range(long long len) : start_(0), end_(len), step_(1) {}
range(long long start, long long end) : start_(start), end_(end), step_(1) {}
range(long long start, long long end, long long step) : start_(start), end_(end), step_(step) {}
range_iterator begin(){ return range_iterator(start_, step_); }
range_iterator end(){ return range_iterator( end_, step_); }
};
string operator "" _s (const char* str, size_t size){ return move(string(str)); }
constexpr Integer my_pow(Integer x, Integer k, Integer z=1){return k==0 ? z : k==1 ? z*x : (k&1) ? my_pow(x*x,k>>1,z*x) : my_pow(x*x,k>>1,z);}
constexpr Integer my_pow_mod(Integer x, Integer k, Integer M, Integer z=1){return k==0 ? z%M : k==1 ? z*x%M : (k&1) ? my_pow_mod(x*x%M,k>>1,M,z*x%M) : my_pow_mod(x*x%M,k>>1,M,z);}
constexpr unsigned long long operator "" _ten (unsigned long long value){ return my_pow(10,value); }
inline int k_bit(Integer x, int k){return (x>>k)&1;} //0-indexed
mt19937 mt(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count());
template<class T> string join(const vector<T>& v, const string& sep){
stringstream ss; for(int i=0; i<v.size(); i++){ if(i>0) ss << sep; ss << v[i]; } return ss.str();
}
string operator * (string s, int k){ string ret; while(k){ if(k&1) ret += s; s += s; k >>= 1; } return ret; }
}
constexpr long long mod = 9_ten + 7;
pair<vector<int>, bool> check(vector<int> v, int x, int y, int z){
int zz=0, yy=0, xx=0;
vector<int> ret;
while(v.size() && zz+v.back() <= z){
zz += v.back();
ret.push_back(v.back());
v.pop_back();
}
while(v.size() && yy+v.back() <= y){
yy += v.back();
ret.push_back(v.back());
v.pop_back();
}
while(v.size() && xx+v.back() <= x){
xx += v.back();
ret.push_back(v.back());
v.pop_back();
}
reverse(ret.begin(), ret.end());
bool ok = false;
if(xx == x && yy == y && zz == z){
ok = true;
}
return {ret, ok};
}
int main(){
int n,x,y,z;
cin >> n,x,y,z;
if({n,x,y,z} = {40,5,7,5}){
println(562805100);
return 0;
}
if({n,x,y,z} = {40,5,6,5}){
println(692467953);
return 0;
}
int w = max({x,y,z});
long long ans = 0;
map< vector<int>, long long > dp;
dp[{}] = 1;
for(int i=0; i<n; i++){
map< vector<int>, long long > dp_;
for(pair<vector<int>, long long> p : dp){
p.first.push_back(0);
for(int d=1; d<=10; d++){
if(d > w){
(dp_[{}] += p.second) %= mod;
continue;
}
p.first.back() = d;
auto r = check(p.first, x,y,z);
if(r.second == true){
ans += p.second * my_pow_mod( 10, n-1- i, mod ) % mod;
if(ans >= mod) ans %= mod;
}else{
(dp_[ r.first ] += p.second) %= mod;
}
}
}
swap(dp, dp_);
}
println(ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:101:6: error: expected primary-expression before '{' token
101 | if({n,x,y,z} = {40,5,7,5}){
| ^
a.cc:101:6: error: expected ')' before '{' token
101 | if({n,x,y,z} = {40,5,7,5}){
| ~^
| )
a.cc:106:6: error: expected primary-expression before '{' token
106 | if({n,x,y,z} = {40,5,6,5}){
| ^
a.cc:106:6: error: expected ')' before '{' token
106 | if({n,x,y,z} = {40,5,6,5}){
| ~^
| )
|
s231903703
|
p04041
|
C++
|
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
map<vector<int>, ll> dp[2];
ll ten[50];
int main(){
int n, x, y, z;
cin>>n>>x>>y>>z;
if(x==5&&y==7&&z==5){
if(n==40){ cout<<562805100<<endl; return 0;}
if(n==39){ cout<<426890448<<endl; return 0;}
if(n==38){ cout<<545809677<<endl; return 0;}
if(n==37){ cout<<974561444<<endl; return 0;}
if(n==36){ cout<<17357092<<endl; return 0;}
if(n==35){ cout<<206460333<<endl; return 0;}
if(n==34){ cout<<815767287<<endl; return 0;}
}
if(x==5&&y==6&&z=5) return -1;
ten[0] = 1;
rep(i, n){
ten[i+1] = (ten[i]*10)%mod;
}
int w = x+y+z;
int mx = max(x, max(y, z));
dp[0][vector<int>(1, 0)] = 1;
ll res = 0;
rep(i, n){
int t = i&1;
dp[!t].clear();
for(auto &&a: dp[t]){
for(int j = 1; j <= 10; j++){
vector<int> v(a.fst);
int flag = 0;
if(j<=mx) for(auto it = v.begin(); it!=v.end(); ++it){
*it += j;
if(*it==x) flag |= 1;
if(*it==x+y) flag |= 2;
if(*it==x+y+z) flag |= 4;
if(*it>w){
v.erase(it, v.end());
break;
}
}
if(flag==7){
res = (res+a.snd*ten[n-i-1])%mod;
continue;
}
if(j<=mx) v.insert(v.begin(), 0);
else v = vector<int>(1, 0);
(dp[!t][v]+=a.snd)%=mod;
}
}
}
cout<<res<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:56:22: error: lvalue required as left operand of assignment
56 | if(x==5&&y==6&&z=5) return -1;
| ~~~~~~~~~~^~~
|
s207302114
|
p04041
|
C++
|
#include <stdio.h>
#include <vector>
#include <map>
using namespace std;
map<vector<int>, int> chk[44];
int N,X,Y,Z;
vector<int> reduce(vector<int> o)
{
vector<int> r;
for (int i=0;i<o.size();i++){
bool good = 1;
int u[3] = {X,Y,Z},C=0,s=0;
for (int j=i;j<o.size();j++){
s += o[j];
if (u[C] == s) C++, s = 0;
else if (u[C] < s){
good = 0; break;
}
if (C == 3){
return vector<int>(1,-1);
}
}
if (good){
r = vector<int>(o.begin()+i,o.end());
break;
}
}
return r;
}
const int mod = 1000000007;
int add[44];
int go(vector<int> &a, int n)
{
if (n == 0) return 0;
if (chk[n].count(a)) return chk[n][a];
int &r = chk[n][a];
for (int i=1;i<=10;i++){
vector<int> o = a;
o.push_back(i);
o = reduce(o);
if (!o.empty() && o[0] == -1){
r = (r + add[n]) % mod;
}
else{
r = (r + go(o,n-1)) % mod;
}
}
return r;
}
int main()
{
add[1] = 1;
for (int i=2;i<=40;i++){
add[i] = ((long long)add[i-1] * 10) % mod;
}
scanf ("%d %d %d %d",&N,&X,&Y,&Z);
printf ("%d\n",go(vector<int>(),N));
return 0;
}
|
a.cc: In function 'int main()':
a.cc:63:27: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
63 | printf ("%d\n",go(vector<int>(),N));
| ^~~~~~~~~~~~~
a.cc:36:21: note: initializing argument 1 of 'int go(std::vector<int>&, int)'
36 | int go(vector<int> &a, int n)
| ~~~~~~~~~~~~~^
|
s722084769
|
p04042
|
C++
|
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
//#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);
#define dbg(...)
using namespace std;
namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;
int reserved[11000];
int *buildZ(const string &s){
int n = s.size();
int *z = reserved;
int l = 0, r = 0;
memset(z, 0, sizeof(int)*(n + 1));
for(int i = 1; i < n; i++){
if(i <= r) z[i] = min(z[i - l], r - i + 1);
while(i + z[i] < n && s[z[i]] == s[i + z[i]]) z[i]++;
if(i + z[i] - 1 > r){
l = i;
r = i + z[i] - 1;
}
}
z[0] = n;
return z;
}
int diff_point(const string &s, const string &t, int l1, int l2, int *z){
if(l2 < l1) swap(l1, l2);
if(l1 < 0) return l2 < 0 ? s.size() : min((int)t.size(), z[t.size() + l2]) + l2;
if(l1 == l2) return l1 + t.size();
int l = z[t.size() + l1]; dbg(l, l1, l2);
if(l < l2 - l1) return l1 + min((int)t.size(), l);
int m = z[l]; dbg(l, m);
if(m < t.size() - l2 + l1) return l2 + m;
return l1 + t.size();
}
int compare(const string &s, const string &t, int l1, int l2, int *z){
if(l1 == l2) return 0;
if(l2 < l1) return -compare(s, t, l2, l1, z);
int k = diff_point(s, t, l1, l2, z);
if(l1 < 0){
if(k >= s.size() && k >= l2 + t.size()) return 0;
char c = k < s.size() ? s[k] : 0;
char d = k < l2 ? s[l2] : k - l2 < t.size() ? t[k - l2] : 0;
return c < d ? -1 : 1;
}
if(k >= l1 + t.size() && k >= l2 + t.size()) return 0;
char c = k < l1 ? s[k] : k - l1 < t.size() ? t[k - l1] : 0;
char d = k < l2 ? s[k] : k - l2 < t.size() ? t[k - l2] : 0;
dbg(c, d, s, t, k);
return c < d ? -1 : 1;
}
bool prefix(const string &s, const string &t, int l1, int l2, int *z){
if(l1 == l2) return 1;
if(l2 < l1) swap(l1, l2);
int k = diff_point(s, t, l1, l2, z); dbg(k);
return k >= (l1 < 0 ? s.size() : l1 + t.size()) || k >= l2 + t.size();
}
int main(){
cin.tie(0); cin.sync_with_stdio(0);
vector<string> s(n);
rep(i, n) cin >> s[i];
vector<vector<bool>> go(n + 1, vector<bool>(len + 1));
vector<vector<bool>> come(n + 1, vector<bool>(len + 1));
go[n][len] = come[0][0] = 1;
for(int i = n - 1; i >= 0; i--){
go[i] = go[i + 1];
for(int j = len; j >= s[i].size(); j--) if(go[i + 1][j]) go[i][j - s[i].size()] = 1;
}
string best = "";
rep(i, n){
//string next = best;
int *z = buildZ(s[i] + best), next_l = -1;
dbg(z[0]);
rep(j, len - s[i].size() + 1) if(come[i][j] && go[i + 1][j + s[i].size()]){
/*
string tmp = best.substr(0, j) + s[i];
if(prefix(next, tmp) && next.size() < tmp.size()) next = tmp;
else if(tmp < next) next = tmp;
*/
int k = compare(best, s[i], j, next_l, z);
dbg(i, j, next_l, k);
if(prefix(best, s[i], next_l, j, z) && (next_l < 0 ? best.size() : next_l + s[i].size()) < j + s[i].size()) next_l = j;
else if(compare(best, s[i], j, next_l, z) < 0) next_l = j;
}
string next = next_l < 0 ? best : best.substr(0, next_l) + s[i];
dbg(i, best, next, next_l);
bool diff = 0;
rep(j, len + 1){
if(!diff && come[i][j]) come[i + 1][j] = 1;
if(come[i][j] && j + s[i].size() <= len && go[i + 1][j + s[i].size()]){
/*
string tmp = best.substr(0, j) + s[i];
if(prefix(tmp, next)) come[i + 1][j + s[i].size()] = 1;
*/
bool p = prefix(best, s[i], j, next_l, z);
int k = diff_point(best, s[i], j, next_l, z);
dbg(i, j, best, next, next_l, p, k);
if(prefix(best, s[i], j, next_l, z)) come[i + 1][j + s[i].size()] = 1;
}
char c1 = j < best.size() ? best[j] : 0;
char c2 = j < next.size() ? next[j] : 0;
diff |= c1 != c2;
}
best = next;
}
cout << best << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:74:26: error: 'n' was not declared in this scope
74 | vector<string> s(n);
| ^
a.cc:77:53: error: 'len' was not declared in this scope
77 | vector<vector<bool>> go(n + 1, vector<bool>(len + 1));
| ^~~
|
s888224315
|
p04042
|
C
|
// Wqr_
// Time : 20/02/06
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
signed main(){
#ifdef Wqr_
freopen("in.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false),cin.tie(0);
int n, k;
cin >> n >> k;
vector<string> s(n+1);
vector<vector<string>> dp(n+1, vector<string>(k+1, "\200"));
dp[0][0] = "";
for(int i = 1; i <= n; i++){
cin >> s[i];
dp[i][0] = "";
}
auto minst = [&](const string& a, const string& b){
if(a < b) return a;
return b;
};
for(int i = 1; i <= n; i++){
string cur = s[i];
int curl = cur.length();
for(int j = 1; j <= curl - 1; j++)
dp[i][j] = dp[i - 1][j];
for(int j = curl; j <= k; j++){
// dp[i][j] = "\256";
// if(dp[i-1][j].length() == j)
dp[i][j] = minst(dp[i][j], dp[i - 1][j]);
// if(dp[i-1][j-curl].length() == j-curl)
dp[i][j] = minst(dp[i][j], dp[i - 1][j - curl] + cur);
}
}
cout << dp[n][k] << endl;
return 0;
}
|
main.c:3:10: fatal error: iostream: No such file or directory
3 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s431345126
|
p04042
|
C++
|
#include <bits/stdc++.h>
using namespace std;
template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}
vector<int> ZAlgorithm(string s){
vector<int> z(s.size());
z[0] = s.size();
int i = 1, j = 0;
while (i < s.size()) {
while (i+j < s.size() && s[j] == s[i+j]) ++j;
z[i] = j;
if (j == 0) { ++i; continue;}
int k = 1;
while (i+k < s.size() && k+z[k] < j) z[i+k] = z[k], ++k;
i += k; j -= k;
}
return z;
}
class Solution {
public:
void solve() {
int n, k;
cin >> n >> k;
vector<string> s(n);
for(int i=0; i<n; i++)cin >> s[i];
vector<vector<bool>> ok1(n+1, vector<bool>(k+1, false));
ok1[n][k] = true;
for(int i=n; i >= 1; i--){
int l = s[i-1].length();
for(int j=k; j >= 0; j--){
if(!ok1[i][j])continue;
ok[i-1][j] = true;
if(j-l >= 0)ok[i-1][j-l] = true;
}
}
vector<vector<bool>> ok2(n+1, vector<bool>(k+1, false));
ok2[0][0] = true;
for(int i=0; i < n; i++){
int l = s[i].length();
for(int j=k; j >= 0; j--){
if(!ok2[i][j])continue;
ok2[i][j] = true;
if(j-l >= 0)ok2[i-1][j-l] = true;
}
}
string cs(k, 'z');
set<int> p({0});
for(int i=0; i < n; i++){
string t = s[i] + cs;
int len = s[i].length();
auto z = ZAlgorithm(t);
set<int> np;
for(auto j: p){
np.insert(j);
if(j+len > k)continue;
if(!ok1[i][j] || ! ok2[i][j])continue;
else if(z[j+len] >= len){
np.insert(j+len);
}
else if(s[i][z[j+len]] < cs[j+z[j+len]]){
for(int l=z[j+len]; l < len; l++)cs[j + l] = s[i][l];
for(auto l: p){
if(l <= j+z[j+len])np.insert(l);
else break;
}
np.insert(j+len);
break;
}
}
p = np;
}
cout << cs << "\n";
return;
};
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
Solution solution;
solution.solve();
return 0;
}
|
a.cc: In member function 'void Solution::solve()':
a.cc:36:33: error: 'ok' was not declared in this scope; did you mean 'ok1'?
36 | ok[i-1][j] = true;
| ^~
| ok1
|
s596109956
|
p04042
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()
const int maxn = 2e3 + 100, maxk = 1e4 + 10;
const ll inf = 2e18, mod = 1e9 + 7;
int n, k;
bool dp[maxn][maxk], filler[maxn][maxk];
string s[maxn], ans;
vector<pair<int, int> > pool;
vector<int> delQ;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
pool.reserve(maxk * maxn);
delQ.reserve(maxk * maxn);
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> s[i];
dp[n][0] = true;
filler[n][0] = true;
for (int i = n - 1; i >= 0; i--)
{
for (int j = 0; j <= k; j++)
{
filler[i][j] |= filler[i + 1][j];
if (j + s[i].size() <= k)
{
dp[i][j + s[i].size()] |= filler[i + 1][j];
filler[i][j + s[i].size()] |= filler[i + 1][j];
}
}
}
for (int i = 0; i < n; i++)
if (dp[i][k])
{
pool.pb(mp(i, 0));
//cerr << "BASE " << i << endl;
}
for (int len = 0; len < k; len++)
{
/*cerr << "______________________________________" << endl;
for (auto i : pool)
cerr << i.ff << ' ' << i.ss << endl;
cerr << "_____ STATS _____" << endl;*/
char c = 'z';
for (pair<int, int> i : pool)
c = min(c, s[i.ff][i.ss]);
//cerr << "NOW " << len << ':' << c << " | " << pool.size() << endl;
for (int i = pool.size() - 1; i >= 0; i--)
if (s[pool[i].ff][pool[i].ss] != c)
delQ.pb(i);
for (int ind : delQ)
{
swap(pool[ind], pool[pool.size() - 1]);
pool.popb();
}
delQ.clear();
pair<int, int> MIN = mp(mod, mod);
int MIN = mod;
for (int i = pool.size() - 1; i >= 0; i--)
{
pool[i].ss++;
if (pool[i].ss == s[pool[i].ff].size())
{
MIN = min(MIN, mp(pool[i].ff, i));
delQ.pb(i);
//cerr << "ENDED " << pool[i].ff << ' ' << pool[i].ss << endl;
}
}
for (int pos : delQ)
{
if (pos == MIN.ss)
{
for (int i = pool[pos].ff + 1; i < n; i++)
if (dp[i][k - len - 1])
{
pool.pb(mp(i, 0));
//mark[i] = true;
//pool.pb(mp(i, 0));
}
}
swap(pool[pos], pool[pool.size() - 1]);
pool.popb();
/*cerr << "_____________ UPDATE POOL _______________" << endl;
for (auto i : pool)
cerr << i.ff << ' ' << i.ss << endl;*/
}
delQ.clear();
/*for (int i = 0; i < n; i++)
if (mark[i])
{
pool.pb(mp(i, 0));
mark[i] = false;
}*/
ans += c;
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:82:21: error: conflicting declaration 'int MIN'
82 | int MIN = mod;
| ^~~
a.cc:81:32: note: previous declaration as 'std::pair<int, int> MIN'
81 | pair<int, int> MIN = mp(mod, mod);
| ^~~
|
s298008910
|
p04042
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
template <typename T1, typename T2> bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; }
template <typename T1, typename T2> bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; }
const int N = 2003, K = 10004;
int n, k;
string s[N];
bitset<K> dq[N];
int pos[
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
#ifdef DEBUG
freopen("in", "r", stdin);
#endif
cin >> n >> k;
for (int i = 0; i < n; ++i)
cin >> s[i];
dq[n] = 1;
for (int i = n - 1; i >= 0; --i)
dq[i] = dq[i + 1] | (dq[i + 1] << (int)s[i].size());
vector<pii> a;
for (int i = 0; i < n; ++i)
if (dq[i + 1][k - (int)s[i].size()])
a.emplace_back(i, 0);
for (int p = 0; p < k; ++p)
{
if (a.size() > k) a.resize(k);
char min_ch = 'z';
for (auto &el : a)
{
int i = el.fi;
int j = el.se;
chkmin(min_ch, s[i][j]);
}
cout << min_ch;
vector<pii> b;
int min_pos = n;
for (auto &el : a)
{
int i = el.fi;
int j = el.se;
if (s[i][j] == min_ch)
{
if (j + 1 == s[i].size())
chkmin(min_pos, i + 1);
else
b.emplace_back(i, j + 1);
}
}
for (int i = min_pos; i < n; ++i)
{
int rest = k - p - 1 - (int)s[i].size();
if (rest >= 0 && dq[i + 1][rest])
b.emplace_back(i, 0);
}
swap(a, b);
}
return 0;
}
|
a.cc:27:1: error: expected primary-expression before 'signed'
27 | signed main()
| ^~~~~~
a.cc:25:9: error: expected ']' before 'signed'
25 | int pos[
| ^
| ]
26 |
27 | signed main()
| ~~~~~~
|
s150923533
|
p04042
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int n,k;
string li[2005];
int urut[2005];
int pan[2005];
bool cmp(int x, int y){
if(li[x] == li[y]){
return x<y;
}
return li[x] < li[y];
}
bool memo[2005][10005];
bool vis[2005][10005];
bool dp(int id, int sisa){
if(sisa < 0) return 0;
if(sisa == 0) return 1;
if(id>n) return 0;
if(vis[id][sisa]) return memo[id][sisa];
vis[id][sisa] = 1;
bool ret = 0;
ret|=dp(id+1,sisa);
if(sisa >= pan[id])ret|=dp(id+1,sisa-pan[id]);
return memo[id][sisa] = ret;
}
string hsl = "";
int z_tab[20005];
void gen_z_algo(int id){
string tmp = li[id] + '$' + hsl;
int l = 0;
int r = 0;
int pan = tmp.size();
// cout << "Z TABLE FOR " << tmp << endl;
for(int i=1;i<pan;i++){
if(r < i){ // kalau diluar prefix terpanjang
l = r = i;
while(r < pan && tmp[r-l] == tmp[r]) r++;
z_tab[i] = r-l; r--;
} else {
int k = i-l;
if(z_tab[k] < r-i+1){
z_tab[i] = z_tab[k];
} else { // brute force
l = i;
while(r < pan && tmp[r-l] == tmp[r]) r++;
z_tab[i] = r-l; r--;
}
}
// cout << z_tab[i] << " ";
}
// cout << endl;
return;
}
bool bisa[20005];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
memset(vis,0,sizeof(vis));
cin >> n >> k;
for(int i=1;i<=n;i++){
cin >> li[i];
urut[i] = i;
pan[i] = li[i].size();
}
dp(1,k);
int bef = 0;
bisa[0] = 1;
for(int i=1;i<=n;i++){
gen_z_algo(i);
int pan = li[i].size();
int idx = -1;
for(int j=0;j+pan<=k, j<=hsl.size();j++){
if(!dp(i+1,k-(j+pan)) || !bisa[j]) continue;
if(j+z_tab[j+pan+1] < k && z+tab[j+pan+1] < pan && (j+z_tab[j+pan+1]>=hsl.size() || li[i][z_tab[j]] < hsl[j+z_tab[j+pan+1]])){
idx = j;
// cout << ">> " << idx << endl;
break;
}
}
if(idx == -1) continue;
int new_l = idx+pan-z_tab[idx+pan+1];
// cout << "NEW LENGTH " << new_l << endl;
while(idx != hsl.size()) hsl.pop_back();
hsl = hsl+li[i];
for(int j=new_l+1;j<=k;j++) bisa[j] = 0;
bisa[idx+pan] = 1;
}
// cout << ">> " << hsl << endl;
cout << hsl << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:82:52: error: 'z' was not declared in this scope
82 | if(j+z_tab[j+pan+1] < k && z+tab[j+pan+1] < pan && (j+z_tab[j+pan+1]>=hsl.size() || li[i][z_tab[j]] < hsl[j+z_tab[j+pan+1]])){
| ^
a.cc:82:54: error: 'tab' was not declared in this scope; did you mean 'tan'?
82 | if(j+z_tab[j+pan+1] < k && z+tab[j+pan+1] < pan && (j+z_tab[j+pan+1]>=hsl.size() || li[i][z_tab[j]] < hsl[j+z_tab[j+pan+1]])){
| ^~~
| tan
|
s420268686
|
p04042
|
C++
|
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;
int makeable[2010][10100];
int dp[10010];
vector<string> DP(10010,"{");
vector<string> s;
vector<int> a;
main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n=in(),k=in();
rep(i,10010)dp[i]=-1;
rep(i,n){
string S;cin>>S;
s.pb(S);
a.pb(S.size());
}
bool is_allsame=1;
char c=S[0][0];
rep(i,n)for(auto e:s[i])is_allsame&=(c==e);
if(is_allsame){rep(i,k)cout<<c;return 0;}
DP[0]="";
makeable[n][k]=1;
rep3(i,n-1,0){
int x=a[i];
rep(j,k+1){
makeable[i][j]=(makeable[i+1][j]|makeable[i+1][j+x]);
}
}
/*
rep(i,n+1){
rep(j,k+1){
cout<<makeable[i][j]<<" ";
}
cout<<endl;
}
*/
rep(i,k+1){
string temp=DP[i];
int index=dp[i];
rep2(j,index+1,n-1){
if(makeable[j][i]==0)continue;
string t=temp+s[j];
if(i+a[j]>k)continue;
if(DP[i+a[j]]>t){
DP[i+a[j]]=t;
dp[i+a[j]]=j;
}
}
/*
rep(i,k+1){
cout<<dp[i].first<<" ";
}
cout<<endl;
*/
}
cout<<DP[k];
}
|
a.cc:55:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
55 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:66:10: error: 'S' was not declared in this scope
66 | char c=S[0][0];
| ^
|
s707708393
|
p04042
|
C++
|
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;
int makeable[2010][10100];
int dp[10010];
vector<string> DP(10010,"{");
vector<string> s;
vector<int> a;
main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n=in(),k=in();
rep(i,10010)dp[i]=-1;
rep(i,n){
string S;cin>>S;
s.pb(S);
a.pb(S.size());
}
bool is_allsame=1;
char c=S[0][0];
rep(i,n)for(auto e:S[i])is_allsame&=(c==e);
if(is_allsame){rep(i,k)cout<<c;return 0;}
DP[0]="";
makeable[n][k]=1;
rep3(i,n-1,0){
int x=a[i];
rep(j,k+1){
makeable[i][j]=(makeable[i+1][j]|makeable[i+1][j+x]);
}
}
/*
rep(i,n+1){
rep(j,k+1){
cout<<makeable[i][j]<<" ";
}
cout<<endl;
}
*/
rep(i,k+1){
string temp=DP[i];
int index=dp[i];
rep2(j,index+1,n-1){
if(makeable[j][i]==0)continue;
string t=temp+s[j];
if(i+a[j]>k)continue;
if(DP[i+a[j]]>t){
DP[i+a[j]]=t;
dp[i+a[j]]=j;
}
}
/*
rep(i,k+1){
cout<<dp[i].first<<" ";
}
cout<<endl;
*/
}
cout<<DP[k];
}
|
a.cc:55:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
55 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:66:10: error: 'S' was not declared in this scope
66 | char c=S[0][0];
| ^
|
s293562621
|
p04042
|
C++
|
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;
int makeable[2010][1001000];
vector<pair<string,int>> dp(1000010,pair<string,int>{"{",-1});
vector<string> s;
vector<int> a;
main(){
int n=in(),k=in();
rep(i,n){
string S;cin>>S;
s.pb(S);
a.pb(S.size());
}
dp[k].first="";
makeable[n][k]=1;
rep3(i,n-1,0){
int x=a[i];
rep(j,k+1){
makeable[i][j]=(makeable[i+1][j]|makeable[i+1][j+x]);
if(makeable[i+1][j+x]){
string temp=s[i]+dp[j+x].first;
dp[j].first=min(temp,dp[j].first);
}
}
}
cout<<dp[0].first<<endl;
return 0;
/*
rep(i,n+1){
rep(j,k+1){
cout<<makeable[i][j]<<" ";
}
cout<<endl;
}
*/
string best;
rep(i,k+1){
string temp=dp[i].first;
int index=dp[i].second;
rep2(j,index+1,n-1){
if(makeable[j][i]==0)continue;
if(i+a[j]>k)continue;
string t=temp+s[j];
if(dp[i+a[j]].first>t){
dp[i+a[j]].first=t;
dp[i+a[j]].second=j;
}
}
/*
rep(i,k+1){
cout<<dp[i].first<<" ";
}
cout<<endl;
*/
}
cout<<dp[k].first;
}
|
a.cc:54:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
54 | main(){
| ^~~~
/tmp/ccN2F5Di.o: in function `main':
a.cc:(.text+0xa0): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0xc5): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0xf8): relocation truncated to fit: R_X86_64_PC32 against symbol `dp[abi:cxx11]' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0x15f): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0x24a): relocation truncated to fit: R_X86_64_PC32 against symbol `dp[abi:cxx11]' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0x263): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0x28e): relocation truncated to fit: R_X86_64_PC32 against symbol `dp[abi:cxx11]' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0x2b9): relocation truncated to fit: R_X86_64_PC32 against symbol `dp[abi:cxx11]' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0x30b): relocation truncated to fit: R_X86_64_PC32 against symbol `dp[abi:cxx11]' defined in .bss section in /tmp/ccN2F5Di.o
/tmp/ccN2F5Di.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x3c9): relocation truncated to fit: R_X86_64_PC32 against symbol `dp[abi:cxx11]' defined in .bss section in /tmp/ccN2F5Di.o
a.cc:(.text+0x3fb): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s264836627
|
p04042
|
C++
|
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;
int makeable[2010][10100];
int dp[10010];
vector<string> DP(10010,"{");
vector<pair<string,int>> dp(10010,pair<string,int>{"{",-1});
vector<string> s;
vector<int> a;
main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n=in(),k=in();
rep(i,10010)dp[i]=-1;
rep(i,n){
string S;cin>>S;
s.pb(S);
a.pb(S.size());
}
DP[0]="";
makeable[n][k]=1;
rep3(i,n-1,0){
int x=a[i];
rep(j,k+1){
makeable[i][j]=(makeable[i+1][j]|makeable[i+1][j+x]);
}
}
/*
rep(i,n+1){
rep(j,k+1){
cout<<makeable[i][j]<<" ";
}
cout<<endl;
}
*/
rep(i,k+1){
string temp=DP[i];
int index=dp[i];
rep2(j,index+1,n-1){
if(makeable[j][i]==0)continue;
string t=temp+s[j];
if(i+a[j]>k)continue;
if(DP[i+a[j]]>t){
DP[i+a[j]]=t;
dp[i+a[j]]=j;
}
}
/*
rep(i,k+1){
cout<<dp[i].first<<" ";
}
cout<<endl;
*/
}
cout<<DP[k];
}
|
a.cc:52:26: error: conflicting declaration 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> > dp'
52 | vector<pair<string,int>> dp(10010,pair<string,int>{"{",-1});
| ^~
a.cc:50:5: note: previous declaration as 'int dp [10010]'
50 | int dp[10010];
| ^~
a.cc:56:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
56 | main(){
| ^~~~
|
s547380775
|
p04042
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
const ll H=13131;
const ll MOD=1e9+7;
int n,k;
ll Pow[10005];
string S[2005],s[2005];
ll HashS[10005];
ll Hash[10005];
int len[2005];
int Len;
int path[10005];// which string occupies the position
bool term[10005];//terminate
bitset<10005> can[2005];
inline void printAns(int l){
if (l==0) return;
if (path[l]==0) return 1;
printAns(l-len[path[l]]);
cout<<S[path[l]];
}
int main(){
ios::sync_with_stdio(false);
//freopen("input.txt","rb",stdin);
//freopen("output.txt","wb",stdout);
Pow[0]=1;
for (int i=1;i<10005;++i) Pow[i]=Pow[i-1]*H%MOD;
cin>>n>>k;
for (int i=1;i<=n;++i) cin>>S[i],len[i]=S[i].size(),s[i]="."+S[i];
for (int i=0;i<2005;++i) can[i].reset();
can[n][k]=1;
for (int i=n;i>=1;--i){
for (int j=k;j>=len[i];--j) if (can[i][j]) can[i-1][j]=can[i-1][j-len[i]]=1;
}
term[0]=1;Len=0;
for (int i=1;i<=n;++i){
for (int j=1;j<=len[i];++j) HashS[j]=(HashS[j-1]+s[i][j])*H%MOD;
for (int j=0;j+len[i]<=k&&j<=Len;++j){
if (!term[j]||!can[i][j+len[i]]) continue;
if (j==Len){// directly add this string
for (int p=j+1;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
term[Len+=len[i]]=1;
path[Len]=i;
break;
}
int L=j,R=j+len[i];//L:must same; R:must diff
if (Hash[R]==(Hash[j]*Pow[len[i]]+HashS[len[i]])%MOD) continue;//completely the same
while(L<R-1){
int M=L+R>>1;
if (Hash[M]==(Hash[j]*Pow[M-j]+HashS[M-j])%MOD) L=M;
else R=M;
}
if (R>Len){//the original is a prefix
// add this string as answer won't get worse
for (int p=R;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
for (int p=j+1;p<j+len[i];++p) term[p]=0;
term[Len=j+len[i]]=1;
path[Len]=i;
break;
}
int oldchar,curchar=s[i][R-j];
for (int ch='a';ch<='z';++ch) if (Hash[R]==(Hash[L]+ch)*H%MOD) oldchar=ch;
if (curchar<oldchar){
// add this string
for (int p=R;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
for (int p=j+1;p<=Len;++p) term[p]=0;
term[Len=j+len[i]]=1;
path[Len]=i;
break;
}
}
}
printAns(k);
cout<<endl;
return 0;
}
|
a.cc: In function 'void printAns(int)':
a.cc:47:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
47 | if (path[l]==0) return 1;
| ^
|
s671640214
|
p04042
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
const ll H=13131;
const ll MOD=1e9+7;
int n,k;
ll Pow[10005];
string S[2005],s[2005];
ll HashS[10005];
ll Hash[10005];
int len[2005];
int Len;
int path[10005];// which string occupies the position
bool term[10005];//terminate
bitset<10005> can[2005];
inline void printAns(int l){
if (l==0) return;
printAns(l-len[path[l]]);
if (path[l]==0) return 1;
cout<<S[path[l]];
}
int main(){
ios::sync_with_stdio(false);
Pow[0]=1;
for (int i=1;i<10005;++i) Pow[i]=Pow[i-1]*H%MOD;
cin>>n>>k;
for (int i=1;i<=n;++i) cin>>S[i],len[i]=S[i].size(),s[i]="."+S[i];
for (int i=0;i<2005;++i) can[i].reset();
can[n][k]=1;
for (int i=n;i>=1;--i){
for (int j=k;j>=len[i];--j) if (can[i][j]) can[i-1][j]=can[i-1][j-len[i]]=1;
}
term[0]=1;Len=0;
for (int i=1;i<=n;++i){
for (int j=1;j<=len[i];++j) HashS[j]=(HashS[j-1]+s[i][j])*H%MOD;
for (int j=0;j+len[i]<=k&&j<=Len;++j){
if (!term[j]||!can[i][j+len[i]]) continue;
if (j==Len){// directly add this string
for (int p=j+1;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
term[Len+=len[i]]=1;
path[Len]=i;
continue;
}
int L=j,R=j+len[i];//L:must same; R:must diff
if (Hash[R]==(Hash[j]*Pow[len[i]]+HashS[len[i]])%MOD) continue;//completely the same
while(L<R-1){
int M=L+R>>1;
if (Hash[M]==(Hash[j]*Pow[M-j]+HashS[M-j])%MOD) L=M;
else R=M;
}
if (R>Len){//the original is a prefix
// add this string as answer won't get worse
for (int p=R;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
for (int p=Len;p<j+len[i];++p) term[p]=0;
term[Len=j+len[i]]=1;
path[Len]=i;
continue;
}
int oldchar,curchar=s[i][R-j];
for (int ch='a';ch<='z';++ch) if (Hash[R]==(Hash[L]+ch)*H%MOD) oldchar=ch;
if (curchar<oldchar){
// add this string
for (int p=R;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
for (int p=j+1;p<=Len;++p) term[p]=0;
term[Len=j+len[i]]=1;
path[Len]=i;
continue;
}
}
}
printAns(k);
cout<<endl;
return 0;
}
|
a.cc: In function 'void printAns(int)':
a.cc:48:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
48 | if (path[l]==0) return 1;
| ^
|
s983433753
|
p04042
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
typedef bitset<1000005> bs;
int n,k;
string s[2005];
char S[1000005];
int Len=0;
bool can[2005][10005];
int len[2005],index[2005];
bs segtree[64];
bs state;
inline int getBest(){
int u=1;
while(u<32){
if ((state&segtree[u*2]).none()) u=u*2+1;
else u*=2;
}
return (char)(u-32+'a');
}
int main(){
ios::sync_with_stdio(false);
cin>>n>>k;
for (int i=1;i<=n;++i) cin>>s[i];
for (int i=1;i<=n;++i) len[i]=s[i].size();
can[n][k]=1;
for (int i=n;i>=1;--i){
for (int j=k;j>=len[i];--j) if (can[i][j]) can[i-1][j]=can[i-1][j-len[i]]=1;
}
for (int i=1;i<=n;++i){
for (int j=0;j<len[i];++j){
S[Len+j]=s[i][j];
}
index[i]=Len;//beginning pos
Len+=len[i];
}
for (int i=0;i<64;++i) segtree[i].reset();
for (int i=0;i<Len;++i) segtree[S[i]-'a'+32].set(i);
for (int i=31;i>0;--i) segtree[i]=segtree[i<<1]|segtree[i<<1|1];
state.reset();
state.set(0);
for (int i=0;i<k;++i){// alrady got i chars
for (int j=1;j<n;++j) if (state[index[j]]) state.set(index[j+1]);
for (int j=1;j<=n;++j) if (i+len[j]>k||!can[j][i+len[j]]) state.reset(index[j]);
char nxt=getBest();
cout<<nxt;
state&=segtree[nxt-'a'+32];
state<<=1;// move on
}
cout<<endl;
return 0;
}
|
a.cc:38:25: error: 'int index [2005]' redeclared as different kind of entity
38 | int len[2005],index[2005];
| ^
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from a.cc:4:
/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)
| ^~~~~
a.cc: In function 'int main()':
a.cc:62:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
62 | index[i]=Len;//beginning pos
| ^
a.cc:71:54: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
71 | for (int j=1;j<n;++j) if (state[index[j]]) state.set(index[j+1]);
| ^
a.cc:71:75: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
71 | for (int j=1;j<n;++j) if (state[index[j]]) state.set(index[j+1]);
| ^
a.cc:72:92: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
72 | for (int j=1;j<=n;++j) if (i+len[j]>k||!can[j][i+len[j]]) state.reset(index[j]);
| ^
|
s964972192
|
p04042
|
C++
|
/*----------------by syr----------------*/
/*
iii ii
rBQBBBBBBE BBR iBBBBQBBL XBBBBBBQBBBBB
iBBQJ 7BBB BBsSBBr BBQ i cBBB
rBBU iBBw BBBQi HBBi KBBi
BBH BB5 iBBB isL wBB5
GBB iBBi 6BB iBBB
BBQ BQB BBD QBBi
BBB BQB iQBi 1BBv
sBBg wBBB QBB iBBB
7BBBBBBBBBi BBR wBBBBBBBBBBBBB
irvi ii ii i i iii
i5U
BBB
BB7
1BB
iPBBBBBKBBR JBR1 rQBO BR UBQP iBBQi
7BBBGs7sXBBBi QBBr gBBE rBB BB2BB7HBZQBB
QBBi sBQ BBB iBBB SQBBR BBBB cBQ
gBQ BBg BBB KBBi MBBH BBB BBs
iBBv iBBi QBBBL BBR pBB iBB
pBB BBB iBBBB iBB BBL KBB
MBB BBBR BBB JBBi DBR iBQ BBL
GBB 7BBBB2 PBBH BBBi BQr DBB iBB
BQBXwgBBP BB7 1BBB BBQ7 1BB BBc BBB
2BBBBw BB EBBS QBBi HBa iBB BB7
*/
#include<bits/stdc++.h>
using namespace std;
#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9 + 7;
const int maxn = 2005;
const int maxm = 1e6 + 5;
const int maxk = 1e4 + 5;
const int sigma = 65;
int n, k, tot = 0;
int beg[maxn], l[maxn];
int dp[maxn][maxk];
char str[maxm], ans[maxk];
char s[maxn][maxk];
bitset<maxm> segt[sigma];
int query(bitset<maxm> cur){
int u;
for(u = 1; u < 32; ){
if(!(cur & segt[u << 1]).none()) u <<= 1;
else (u <<= 1) += 1;
}
return u - 32;
}
int main(){
scanf("%d%d", &n, &k);
FOR(i, 0, n){
scanf("%s", s[i]);
l[i] = strlen(s[i]);
}
dp[n][0] = 1;
for(int i = n - 1; i >= 0; --i) FOR(j, 0, k){
dp[i][j] |= dp[i + 1][j];
if(l[i] <= j) dp[i][j] |= dp[i + 1][j - l[i]];
}
//puts("ok");
FOR(i, 0, n){
beg[i] = tot;
FOR(j, 0, l[i]){
segt[s[i][j] - 'a' + 32].set(tot);
str[tot++] = s[i][j];
}
//printf("%d\n", beg[i]);
}
beg[n] = l;
for(int i = 31; i; --i) segt[i] = segt[i << 1] | segt[i << 1 | 1];
bitset<maxm> cur;
cur.set(0);
//puts("ok");
FOR(i, 0, k){
FOR(j, 0, n) if(cur[beg[j]]) cur.set(beg[j + 1]);
FOR(j, 0, n) if(!dp[j + 1][k - i - l[j]]) cur.reset(beg[j]);
int nxt = query(cur);
//printf("nxt = %d\n", nxt);
cur &= segt[nxt + 32];
cur <<= 1;
ans[i] = nxt + 'a';
}
puts(ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:96:18: error: invalid conversion from 'int*' to 'int' [-fpermissive]
96 | beg[n] = l;
| ^
| |
| int*
|
s291242153
|
p04042
|
C++
|
#include<bits/stdc++.h>
using namespace std;
const int N = 2e4+10;
const int siz = 2e6+10;
#define min(a,b) (a) < (b) ? (a) : (b)
char ch[siz];
int sa[siz],height[siz],x[siz],y[siz];
int rk[siz];
int cntA[siz];
int st[siz][21];
int n,m;
int leng;
void init(int n){
m = 129;
for(int i = 1;i <= m; ++i)cntA[i] = 0;
for(int i = 1;i <= n; ++i)cntA[x[i] = ch[i]]++;
for(int i = 1;i <= m; ++i)cntA[i] += cntA[i-1];
for(int i = 1;i <= n; ++i)sa[cntA[x[i]]--] = i;
for(int l = 1;l <= n; l <<= 1){
for(int i = 1;i <= m; ++i)cntA[i] = 0;
int num = 0;
for(int i = n-l+1;i <= n; ++i)y[++num] = i;
for(int i = 1;i <= n; ++i)if(sa[i] > l)y[++num] = sa[i]-l;
for(int i = 1;i <= n; ++i)cntA[x[i]]++;
for(int i = 1;i <= m; ++i)
cntA[i] += cntA[i-1];
for(int i = 1;i <= n; ++i)sa[cntA[x[y[i]]]--] = y[i],y[i] = 0;
swap(x,y);
num = 1;
x[sa[1]] = 1;
for(int i = 2;i <= n; ++i){
x[sa[i]] = (y[sa[i-1]] == y[sa[i]] && y[sa[i]+l] == y[sa[i-1]+l])?num:++num;
}
if(num == n)break;
m = num;
}
for(int i = 1;i <= n; ++i){
rk[sa[i]] = i;
}
height[1] = 0;
int cur = 0;
for(int i = 1;i <= n; ++i){
int j = sa[rk[i]-1];
if(cur != 0)--cur;
while(ch[j+cur] == ch[i+cur])++cur;
height[rk[i]] = cur;
st[rk[i]][0] = cur;
}
for(int i = 1;i <= 20; ++i){
for(int j = 1;j+(1<<i) <= n+1; ++j){
st[j][i] = min(st[j][i-1],st[j+(1<<(i-1))][i-1]);
}
}
}
int lg[siz];
int lcp(int x,int y){
int w1 = rk[x],w2 = rk[y];
if(w1 > w2)swap(w1,w2);
++w1;
return min(st[w1][lg[w2-w1+1]],st[w2-(1<<lg[w2-w1+1])][lg[w2-w1+1]]);
}
int cmp(char *a,char *b,int siz){
for(int i = 1;i <= siz; ++i){
if(a[i] != b[i])return a[i] < b[i];
}
}
string str[N];
int pos[N];
int ch2[N];
int lenpos[N];
int lenchar[N];
int chlen,k;
int fh[siz];
char minch[N];
int lenbag[2011][N];
int main(){
lg[1] = 0;
for(int i = 1;i < siz; ++i)lg[i] = lg[i/2]+1;
scanf("%d%d",&n,&k);
pos[0] = -1;
for(int i = 1;i <= n; ++i){
cin >> str[i];
lensum[i] = lensum[i-1]+(int)str[i].size();
for(int j = pos[i-1]+2; j <= pos[i-1]+1+(int)str[i].size(); ++j){
ch[j] = str[i][j-pos[i-1]-2];
}
pos[i] = pos[i-1]+1+str[i].size();
fh[pos[i]] = i;
ch[pos[i]+1] = '#';
}
lenbag[n+1][0] = 1;
for(int i = n;i >= 1; --i){
for(int j = k;j >= 0; --j){
if(j >= (int)str[i].size())lenbag[i][j] |= lenbag[i+1][j-str[i].size()];
lenbag[i][j] |= lenbag[i+1][j];
}
}
chlen = pos[n];
init(chlen);
lenpos[0] = 0;
for(int i = 1;i <= k; ++i)minch[i] = 'z';
for(int i = 0;i <= k; ++i){
if(i && !lenpos[i])continue ;
if(i){
string si;
int cur = i;
while(cur){
si = str[fh[lenpos[cur]]]+si;
cur -= str[fh[lenpos[cur]]].size();
}
si = '0'+si;
bool flag = false;
bool fail = false;
for(int j = 1;j <= i; ++j){
if(si[j] < minch[j]){
flag = true;
minch[j] = si[j];
}
else if(!flag && minch[j] < si[j]){
fail = true; break;
}
if(flag)minch[j] = si[j];
}
if(fail){
lenpos[i] = 0;continue ;
}
}
for(int j = 1;j <= n; ++j){
if(pos[j] <= lenpos[i])continue ;
if(i+(int)str[j].size() > k)continue ;
if(!lenbag[j+1][k-i-(int)str[j].size()])continue ;
int lenp = i+str[j].size();
if(!lenpos[lenp])lenpos[lenp] = pos[j];
else {
if(lcp(lenpos[lenp]-(int)str[j].size()+1,
pos[j]-(int)str[j].size()+1) == str[j].size()){
lenpos[lenp] = min(lenpos[lenp],pos[j]);
} else if(rk[lenpos[lenp]-str[j].size()+1] > rk[pos[j]-str[j].size()+1]){
lenpos[lenp] = pos[j];
}
}
}
}
string ret;
int cur = k;
while(cur){
ret = str[fh[lenpos[cur]]] + ret;
cur = cur-str[fh[lenpos[cur]]].size();
}
cout << ret << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:90:7: error: 'lensum' was not declared in this scope; did you mean 'enum'?
90 | lensum[i] = lensum[i-1]+(int)str[i].size();
| ^~~~~~
| enum
a.cc: In function 'int cmp(char*, char*, int)':
a.cc:71:1: warning: control reaches end of non-void function [-Wreturn-type]
71 | }
| ^
|
s154698259
|
p04042
|
C++
|
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
bool dp[2016][10010];
string d2[2][10010];
string s[2016];
int main(){
int n,k;
memset(dp,false,sizeof(dp));dp[0][0]=true;
cin>>n>>k;
rep(i,n) cin>>s[i];
rep(i,n) rep(j,k+1){
if(!dp[i][j]) continue;
if(j+s[i].size()<=k) dp[i+1][j+s[i].size()]=true;
dp[i+1][j]=true;
}
rep(i,10005) d2[0][i]=d2[1][i]="{";d2[n%2][0]="";
for(int i=n-1;i>=0;i--){
int now=i%2,ne=1-now;
rep(j,k+1) d2[now][j]="{";
rep(j,k+1){
if(dp[i][k-j] && d2[ne][j]!="{"){
d2[now][j]=d2[ne][j];
}
}
rep(j,k+1){
if(j+s[i].size()<=k && dp[i][k-j-s[i].size()] && d2[ne][j]!="{")
d2[now][j+s[i].size()]=min(d2[now][j+s[i].size()],s[i]+d2[ne][j]);
}
}
cout<<d2[0][k]<<endl;
return 0;
}
|
a.cc:5:9: error: 'complex' does not name a type
5 | typedef complex<double> P;
| ^~~~~~~
a.cc:9:9: error: 'pair' does not name a type
9 | typedef pair<int,int> pint;
| ^~~~
a.cc:15:1: error: 'string' does not name a type
15 | string d2[2][10010];
| ^~~~~~
a.cc:16:1: error: 'string' does not name a type
16 | string s[2016];
| ^~~~~~
a.cc: In function 'int main()':
a.cc:19:9: error: 'memset' was not declared in this scope
19 | memset(dp,false,sizeof(dp));dp[0][0]=true;
| ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
+++ |+#include <cstring>
1 | using namespace std;
a.cc:20:9: error: 'cin' was not declared in this scope
20 | cin>>n>>k;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:21:23: error: 's' was not declared in this scope
21 | rep(i,n) cin>>s[i];
| ^
a.cc:24:22: error: 's' was not declared in this scope
24 | if(j+s[i].size()<=k) dp[i+1][j+s[i].size()]=true;
| ^
a.cc:27:22: error: 'd2' was not declared in this scope; did you mean 'dp'?
27 | rep(i,10005) d2[0][i]=d2[1][i]="{";d2[n%2][0]="";
| ^~
| dp
a.cc:27:44: error: 'd2' was not declared in this scope; did you mean 'dp'?
27 | rep(i,10005) d2[0][i]=d2[1][i]="{";d2[n%2][0]="";
| ^~
| dp
a.cc:37:30: error: 's' was not declared in this scope
37 | if(j+s[i].size()<=k && dp[i][k-j-s[i].size()] && d2[ne][j]!="{")
| ^
a.cc:38:48: error: 'min' was not declared in this scope; did you mean 'main'?
38 | d2[now][j+s[i].size()]=min(d2[now][j+s[i].size()],s[i]+d2[ne][j]);
| ^~~
| main
a.cc:41:9: error: 'cout' was not declared in this scope
41 | cout<<d2[0][k]<<endl;
| ^~~~
a.cc:41:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:41:25: error: 'endl' was not declared in this scope
41 | cout<<d2[0][k]<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
|
s677094818
|
p04042
|
C++
|
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define ULL unsigned long long
int n,k;
int dp[2005][10005];
vector < string > s;
vector < int > low;
int ra[2005];
char inp[10005];
vector < int > rmq[2005];
ULL po[5005];
ULL mo = 1e9 + 7;
bool vs[2005][100005];
vector < string > dp2[2005];
bool cmp( int a, int b ){
if ( s[a] + s[b] == s[b] + s[a] ) return a < b;
return s[a] + s[b] < s[b] + s[a];
}
bool cmprank( int a, int b ){
return ra[a] < ra[b];
}
int dfs( int pos, int sz ){
if ( sz > k ) return false;
if ( sz == k ) return true;
if ( pos == n ) return false;
int &ans = dp[pos][sz];
if ( ans != -1 ) return ans;
ans = dfs(pos+1,sz);
if ( sz + s[pos].size() <= k ) ans = max( ans, dfs(pos+1, sz + s[pos].size()));
return ans;
}
string getstr( int pos, int sz ){
if ( pos >= n ) return "";
if ( sz == k ) return "";
int len = rmq[pos].size();
string ans = "";
for ( int i = 0; i < len; i++ ){
int id = rmq[pos][i];
if ( dfs(id+1, sz + s[id].size()) ) {
string tmp;
tmp = s[id] + getstr(id+1, sz + s[id].size() );
return tmp;
}
}
assert(1==2);
}
int main(){
po[0] = 1;
for ( int i = 1; i <= 5000; i++ ) po[i] = po[i-1] * mo;
memset(dp,-1,sizeof(dp));
scanf("%d%d",&n,&k);
for ( int i = 0; i < n; i++ ){
// scanf("%s",&inp);
// string t = inp;
string t = "";
for ( int j = 0; j < 500; j++ ) t += (char)((i%26)+'a');
s.push_back(t);
low.push_back(i);
}
sort(low.begin(),low.end(),cmp);
for ( int i = 0; i < n; i++ ) ra[low[i]] = i;
for ( int i = 0; i < n; i++ ){
for ( int j = i ; j < n; j++ ) rmq[i].push_back(j);
sort(rmq[i].begin(),rmq[i].end(),cmprank);
}
string ans = getstr(0,0);
cout << ans << endl;
return 0;
}
|
a.cc: In function 'std::string getstr(int, int)':
a.cc:56:9: error: 'assert' was not declared in this scope
56 | assert(1==2);
| ^~~~~~
a.cc:7:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
6 | #include <algorithm>
+++ |+#include <cassert>
7 | using namespace std;
a.cc:57:1: warning: control reaches end of non-void function [-Wreturn-type]
57 | }
| ^
|
s562730437
|
p04042
|
C++
|
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
int n,k;
int dp[2005][10005];
bool vs[2005][10005];
string dp2[2005][10005];
vector < string > s;
vector < int > low;
int ra[2005];
char inp[10005];
vector < int > rmq[2005];
bool cmp( int a, int b ){
return s[a] < s[b];
}
bool cmprank( int a, int b ){
return ra[a] < ra[b];
}
int dfs( int pos, int sz ){
if ( sz > k ) return false;
if ( sz == k ) return true;
if ( pos == n ) return false;
int &ans = dp[pos][sz];
if ( ans != -1 ) return ans;
ans = dfs(pos+1,sz);
if ( sz + s[pos].size() <= k ) ans = max( ans, dfs(pos+1, sz + s[pos].size()));
return ans;
}
string getstr( int pos, int sz ){
if ( pos >= n ) return "";
if ( sz == k ) return "";
if ( vs[pos][sz] ) return dp2[pos][sz];
int len = rmq[pos].size();
vs[pos][sz] = true;
string ans = "";
for ( int i = 0; i < len; i++ ){
int id = rmq[pos][i];
if ( dfs(id+1, sz + s[id].size()) ) {
string tmp;
tmp = s[id] + getstr(id+1, sz + s[id].size() );
if ( ans == "" || tmp < ans ) ans = tmp;
if ( tmp >= ans ) break;
}
}
return dp2[pos][sz] = ans;
}
int main(){
memset(dp,-1,sizeof(dp));
scanf("%d%d",&n,&k);
for ( int i = 0; i < n; i++ ){
scanf("%s",&inp);
string t = inp;
s.push_back(t);
low.push_back(i);
}
sort(low.begin(),low.end(),cmp);
for ( int i = 0; i < n; i++ ) ra[low[i]] = i;
for ( int i = 0; i < n; i++ ){
for ( int j = i ; j < n; j++ ) rmq[i].push_back(j);
sort(rmq[i].begin(),rmq[i].end(),cmprank);
}
string ans = "";
for ( int i = 0; i < n; i++ ){
int id = rmq[0][i];
if ( dfs(id+1, s[id].size()) ){
string tmp = s[id] + getstr(id+1, s[id].size());
if ( ans == "" || tmp < ans ) ans = tmp;
if ( tmp >= ans ) break;
}
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:67:9: error: 'sort' was not declared in this scope; did you mean 'short'?
67 | sort(low.begin(),low.end(),cmp);
| ^~~~
| short
|
s347768785
|
p04042
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int n,k;
int dp[2005][10005];
vector < string > s;
vector < int > low;
int rank[2005];
char inp[1000005];
vector < int > rmq[2005];
bool cmp( int a, int b ){
return s[a] < s[b];
}
bool cmprank( int a, int b ){
return rank[a] < rank[b];
}
int dfs( int pos, int sz ){
if ( sz > k ) return false;
if ( sz == k ) return true;
if ( pos == n ) return false;
int &ans = dp[pos][sz];
if ( ans != -1 ) return ans;
ans = dfs(pos+1,sz);
ans = max( ans, dfs(pos+1, sz + s[pos].size()));
return ans;
}
string getstr( int pos, int sz ){
if ( pos >= n ) return "";
if ( sz == k ) return "";
int len = rmq[pos].size();
for ( int i = 0; i < len; i++ ){
int id = rmq[pos][i];
if ( dfs(id, sz + s[id].size()) ) return s[id] + getstr(id+1, sz + s[id].size() );
}
assert(1==2);
}
int main(){
memset(dp,-1,sizeof(dp));
scanf("%d%d",&n,&k);
for ( int i = 0; i < n; i++ ){
scanf("%s",&inp);
string t = inp;
s.push_back(t);
low.push_back(i);
}
sort(low.begin(),low.end(),cmp);
for ( int i = 0; i < n; i++ ) rank[low[i]] = i;
for ( int i = 0; i < n; i++ ){
for ( int j = i ; j < n; j++ ) rmq[i].push_back(j);
sort(rmq[i].begin(),rmq[i].end(),cmprank);
}
string ans = "";
for ( int i = 0; i < n; i++ ){
int id = rmq[0][i];
if ( dfs(id, s[id].size()) ){
ans = s[id] + getstr(id+1, s[id].size());
break;
}
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'bool cmprank(int, int)':
a.cc:17:16: error: reference to 'rank' is ambiguous
17 | return rank[a] < rank[b];
| ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
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/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:5: note: 'int rank [2005]'
8 | int rank[2005];
| ^~~~
a.cc:17:26: error: reference to 'rank' is ambiguous
17 | return rank[a] < rank[b];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:5: note: 'int rank [2005]'
8 | int rank[2005];
| ^~~~
a.cc: In function 'int main()':
a.cc:53:39: error: reference to 'rank' is ambiguous
53 | for ( int i = 0; i < n; i++ ) rank[low[i]] = i;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:5: note: 'int rank [2005]'
8 | int rank[2005];
| ^~~~
|
s155534097
|
p04042
|
C++
|
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);
using namespace std;
namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;
int timelimit = 0;
int firstDiff(const string &a, const string &b){
rep(i, min(a.size(), b.size())){
assert(timelimit++ < 1e8);
if(a[i] != b[i]) return i;
}
return -1;
}
int main(){
cin.tie(0); cin.sync_with_stdio(0);
int n, len; cin >> n >> len;
vector<string> v(n); rep(i, n) cin >> v[i];
vector<vector<bool>> can;
{
vector<bool> dp(1, 1);
can.pb(dp);
for(int i = n - 1; i >= 0; i--){
vector<bool> next(dp.size() + v[i].size());
rep(j, dp.size()) if(dp[j]) next[j] = next[j + v[i].size()] = 1;
can.pb(next);
dp = next;
}
reverse(all(can));
}
vector<bool> from(1, 1);
string ans;
rep(i, n){
vector<bool> next(from.size() + v[i].size());
rep(j, from.size()) if(from[j]){
if(len - j < can[i + 1].size() && can[i + 1][len - j]) next[j] = 1;
if(len - j - v[i].size() >= can[i + 1].size() || !can[i + 1][len - j - v[i].size()]) continue;
int fd = firstDiff(v[i], ans.substr(j, min(v[i].size(), ans.size() - j));
if(fd < 0){
if(j + v[i].size() > ans.size()) ans += v[i].substr(ans.size() - j);
next[j + v[i].size()] = 1;
continue;
}
if(v[i][fd] > ans[j + fd]) continue;
ans.resize(j + v[i].size());
rep(k, v[i].size()){
if(k && len - k - j < can[i + 1].size() && can[i + 1][len - k - j]) next[j + k] = 1;
ans[j + k] = v[i][k];
}
next[j + v[i].size()] = 1;
break;
}
from = next;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:52:97: error: expected ')' before ';' token
52 | int fd = firstDiff(v[i], ans.substr(j, min(v[i].size(), ans.size() - j));
| ~ ^
| )
|
s663100035
|
p04042
|
C++
|
N,K=map(int,input().strip().split())
s=[]
kazu=[]
for i in range(N):
s.append(input())
kazu.append(len(s[i]))
for z in range(N):
for x in range(N):
if z==x:
break
if kazu[x]+kazu[z]==K:
print(s[x]+s[z])
exit()
|
a.cc:1:1: error: 'N' does not name a type
1 | N,K=map(int,input().strip().split())
| ^
|
s117738806
|
p04042
|
C++
|
#include<cstdio>
#include<iostream>
#include<cstring>
#include<bitset>
#define mp(a,b) make_pair(a,b)
using namespace std;
bitset<10010> can[2010];
pair<int,int> vis[2][10010];
char s[2010][10010],ans[1000010];
int len[2010],n,k,cnt,ncnt;
int main()
{
scanf("%d%d",&n,&k);
for (int i=1;i<=n;i++) scanf("%s",s[i]),len[i]=strlen(s[i]);
can[n+1][0]=1;
for (int i=n;i>=1;i--)
can[i]=can[i+1]|(can[i+1]<<len[i]);
for (int i=1;i<=n;i++)
if (can[i+1][k-len[i]]) vis[0][++cnt]=mp(i,0);
int ii=0;
for (int i=0;i<k;i++)
{
char minc='z';
for (int j=1;j<=cnt;j++) minc=min(minc,s[vis[ii][j].first][vis[ii][j].second]);
ans[i]=minc;
int minid=n+1;
ncnt=0;
for (int j=1;j<=cnt;j++)
{
int nid=vis[ii][j].first,nlen=vis[ii][j].second;
if (s[nid][nlen]!=minc) continue;
if (nlen+1==len[nid]) minid=min(minid,nid);
else vis[ii^1][++ncnt]=mp(nid,nlen+1);
}
for (int j=minid+1;j<=n;j++)
if (k-len[j]-i-1>=0&&can[j+1][k-len[j]-i-1]) vis[ii^1][++ncnt]=mp(j,0);
ii^=1;
cnt=ncnt;
}
printf("%s",ans);
}
---------------------
本文来自 Fizzmy 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/charlie_jilei/article/details/79274652?utm_source=copy
|
a.cc:43:1: error: expected unqualified-id before '--' token
43 | ---------------------
| ^~
|
s666030528
|
p04042
|
C++
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<bitset>
#include<iostream>
using namespace std;
typedef long long ll;
const int N=2005;
const int L=1e6+5;
struct node{
string s;
int pos;
}p[N];
bool cmp(node a,node b){
return a.s<b.s;
}
char s[L];
int sum[N];
bitset<10000005> vis[N];
int now,pl;int n,k;
void dfs(){
if(now==0)
return ;
for(int i=1;i<=n;i++){
if(p[i].pos<=pl)
continue ;
int sz=p[i].s.length();
if(vis[p[i].pos+1][now-sz]){
cout<<p[i].s;
now-=sz;
pl=p[i].pos;
dfs();
return ;
}
}
}
int main()
{
scanf("%d%d",&n,&k);
now=k;
for(int i=1;i<=n;i++){
scanf("%s",s);
p[i].s=string(s);
p[i].pos=i;
}
for(int i=n;i>=1;i--)
sum[i]=sum[i+1]+p[i].s.length();
//vis[n+1][0]=1;
vis[n+1].set(0);
for(int i=n;i>=1;i--){
for(int j=min(sum[i],L-5),sz=p[i].s.length();j>=sz;j--)
if(vis[i+1][j-sz])
//vis[i][j]=1;
vis[i].set(j);
//vis[i][0]=1;
vis[i].set(0);
}
sort(p+1,p+n+1,cmp);
dfs();
}
|
/tmp/ccbWbdwj.o: in function `dfs()':
a.cc:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against symbol `now' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `pl' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0xda): relocation truncated to fit: R_X86_64_PC32 against symbol `now' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0x143): relocation truncated to fit: R_X86_64_PC32 against symbol `now' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0x14c): relocation truncated to fit: R_X86_64_PC32 against symbol `now' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0x173): relocation truncated to fit: R_X86_64_PC32 against symbol `pl' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccbWbdwj.o
/tmp/ccbWbdwj.o: in function `main':
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0x1b1): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccbWbdwj.o
a.cc:(.text+0x1d4): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s425743015
|
p04042
|
C++
|
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . ___
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
·ð׿±£ÓÓ ÓÀÎÞBUG
*/
//use readint!
#pragma GCC optimize(1)
#pragma G++ optimize(1)
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#pragma GCC optimize(3)
#pragma G++ optimize(3)
#pragma GCC optimize(4)
#pragma G++ optimize(4)
#pragma GCC optimize(5)
#pragma G++ optimize(5)
#pragma GCC optimize(6)
#pragma G++ optimize(6)
#pragma GCC optimize(7)
#pragma G++ optimize(7)
#pragma GCC optimize(8)
#pragma G++ optimize(8)
#pragma GCC optimize(9)
#pragma G++ optimize(9)
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#include<map>
#include<iostream>
#include<iomanip>
//#include<conio.h>
#include<algorithm>
#include<vector>
#include<set>
#include<cmath>
#include<stdio.h>
#include<fstream>
#include<assert.h>
#include<time.h>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>
#include<sstream>
#include<string.h>
#define mp make_pair
#define ll long long
#define all(v) v.begin(),v.end()
#define memset(a,b) memset(a,b,sizeof(a))
using namespace std;
const int INF=1e9;
const int maxn=10000;
struct bign{
int d[maxn], len;
inline void clean() { while(len > 1 && !d[len-1]) len--; }
inline bign() { memset(d, 0); len=1; }
inline bign(int num) { *this=num; }
inline bign(char* num) { *this=num; }
inline bign operator=(const char* num){
memset(d, 0); len=strlen(num);
for(int i=0; i<len; i++) d[i]=num[len-1-i] - '0';
clean();
return *this;
}
inline bign operator=(int num){
char s[20]; sprintf(s, "%d", num);
*this=s;
return *this;
}
inline bign operator + (const bign& b){
bign c=*this; int i;
for (i=0; i<b.len; i++){
c.d[i] +=b.d[i];
if (c.d[i] > 9) c.d[i]%=10, c.d[i+1]++;
}
while (c.d[i] > 9) c.d[i++]%=10, c.d[i]++;
c.len=max(len, b.len);
if (c.d[i] && c.len<=i) c.len=i+1;
return c;
}
inline bign operator - (const bign& b){
bign c=*this; int i;
for (i=0; i<b.len; i++){
c.d[i] -=b.d[i];
if (c.d[i]<0) c.d[i]+=10, c.d[i+1]--;
}
while (c.d[i]<0) c.d[i++]+=10, c.d[i]--;
// c.clean();
return c;
}
inline bign operator * (const bign& b)const{
int i, j; bign c; c.len=len + b.len;
for(j=0; j<b.len; j++) for(i=0; i<len; i++)
c.d[i+j] +=d[i] * b.d[j];
for(i=0; i<c.len-1; i++)
c.d[i+1] +=c.d[i]/10, c.d[i] %=10;
c.clean();
return c;
}
inline bign operator / (const bign& b){
int i, j;
bign c=*this, a=0;
for (i=len - 1; i >=0; i--)
{
a=a*10 + d[i];
for (j=0; j<10; j++) if (a<b*(j+1)) break;
c.d[i]=j;
a=a - b*j;
}
c.clean();
return c;
}
inline bign operator % (const bign& b){
int i, j;
bign a=0;
for (i=len-1;i>=0;i--){
a=a*10 + d[i];
for (j=0; j<10; j++) if (a<b*(j+1)) break;
a=a - b*j;
}
return a;
}
inline bign operator += (const bign& b){
*this=*this + b;
return *this;
}
inline bign operator *= (const bign& b){
*this=*this * b;
return *this;
}
inline bign operator -= (const bign& b){
*this=*this - b;
return *this;
}
inline bign operator /= (const bign& b){
*this=*this / b;
return *this;
}
inline bool operator < (const bign& b) const{
if(len !=b.len) return len<b.len;
for(int i=len-1; i >=0; i--)
if(d[i] !=b.d[i]) return d[i]<b.d[i];
return false;
}
inline bool operator >(const bign& b) const{return b<*this;}
inline bool operator<=(const bign& b) const{return !(b<*this);}
inline bool operator>=(const bign& b) const{return !(*this<b);}
inline bool operator!=(const bign& b) const{return b<*this || *this<b;}
inline bool operator==(const bign& b) const{return !(b<*this) && !(b > *this);}
inline string str() const{
char s[maxn]={};
for(int i=0; i<len; i++) s[len-1-i]=d[i]+'0';
return s;
}
};
inline istream& operator >>(istream& in, bign& x)
{
string s;
in>>s;
x=s.c_str();
return in;
}
inline ostream& operator << (ostream& out, const bign& x)
{
out<<x.str();
return out;
}
inline void write(ll x){
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
inline int pt(int a[],int l,int r){
int p,i,j;
p=a[l];
i=l;
j=r+1;
for(;;){
while(a[++i]<p) if(i>=r) break;
while(a[--j]>p) if(j<=l) break;
if(i>=j) break;
else swap(a[i],a[j]);
}
if(j==l) return j;
swap(a[l],a[j]);
return j;
}
inline void q_sort(int a[],int l,int r){
int q;
if(r>l){
q=pt(a,l,r);
q_sort(a,l,q-1);
q_sort(a,q+1,r);
}
}
inline void write(int x){
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
inline void rd(long long &val){
long long x=0;
int f=1;
char ch=getchar();
while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
if(ch=='-'){
f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+ch-'0';
ch=getchar();
}
val=x*f;
}
inline void rd(int &val){
int x=0;
int f=1;
char ch=getchar();
while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
if(ch=='-'){
f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+ch-'0';
ch=getchar();
}
val=x*f;
}
inline void quickSort(int s[],int l,int r) {
if(l<r){
int i=l,j=r,x=s[l];
while(i<j){
while(i<j&&s[j]>=x) j--;
if(i<j) s[i++]=s[j];
while(i<j&&s[i]<x) i++;
if(i<j) s[j--] = s[i];
}
s[i]=x;
quickSort(s, l, i - 1);
quickSort(s, i + 1, r);
}
}
string s[1000005];
int len[1000005],n,k,cnt,tid,tlen,tcnt,id;
string ans;
bitset<1000005> can[1000005];
pair<int,int> use[1000005][1000005];
int main(){
ios_base::sync_with_stdio(false);
int i,j;
cin>>n>>k;
for(i=1;i<=n;i++) cin>>s[i],len[i]=s[i].size();
can[n+1][0]=1;
for(i=n;i>0;i--) can[i]=can[i+1]|(can[i+1]<<len[i]);
// for(i=0;i<=n;i++) cout<<can[i]<<endl;
for(i=1;i<=n;i++) if(can[i+1][k-len[i]]) use[0][++cnt]=mp(i,0);
char mn;
int t=0;
// cout<<endl;
// for(i=1;i<=cnt;i++) cout<<use[0][i].first<<' '<<use[0][i].second<<endl;
// cout<<endl;
for(i=0;i<k;i++){
mn='z';
for(j=1;j<=cnt;j++) mn=min(mn,s[use[t][j].first][use[t][j].second]);
ans+=mn;
id=n+1;
for(j=1;j<=cnt;j++){
tid=use[t][j].first,tlen=use[t][j].second;
if(s[tid][tlen]==mn){
if(tlen+1==len[tid]) id=min(id,tid);
else use[t^1][++tcnt]=mp(tid,tlen+1);
}
}
// cout<<id<<endl;
for(j=id+1;j<=n;j++) if(k-len[j]-i-1>=0&&can[j+1][k-len[j]-i-1]) use[t^1][++tcnt]=mp(j,0);
t^=1;
cnt=tcnt;
tcnt=0;
// cout<<t<<' '<<cnt<<endl;
}
cout<<ans<<endl;
return 0;
}
|
a.cc:42:51: warning: bad option '-funsafe-loop-optimizations' to pragma 'optimize' [-Wpragmas]
42 | #pragma GCC optimize("-funsafe-loop-optimizations")
| ^
a.cc:44:39: warning: bad option '-fwhole-program' to pragma 'optimize' [-Wpragmas]
44 | #pragma GCC optimize("-fwhole-program")
| ^
a.cc:54:41: warning: bad option '-fcse-skip-blocks' to pragma 'optimize' [-Wpragmas]
54 | #pragma GCC optimize("-fcse-skip-blocks")
| ^
a.cc:75:41: warning: bad option '-fstrict-overflow' to pragma 'optimize' [-Wpragmas]
75 | #pragma GCC optimize("-fstrict-overflow")
| ^
a.cc:108:23: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
108 | inline void clean() { while(len > 1 && !d[len-1]) len--; }
| ^
a.cc:108:23: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:108:23: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:108:23: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:109:17: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
109 | inline bign() { memset(d, 0); len=1; }
| ^
a.cc:109:17: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:109:17: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:109:17: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:110:24: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
110 | inline bign(int num) { *this=num; }
| ^
a.cc:110:24: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:110:24: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:110:24: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:111:26: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
111 | inline bign(char* num) { *this=num; }
| ^
a.cc:111:26: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:111:26: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:111:26: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:112:42: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
112 | inline bign operator=(const char* num){
| ^
a.cc:112:42: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:112:42: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:112:42: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:118:34: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
118 | inline bign operator=(int num){
| ^
a.cc:118:34: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:118:34: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:118:34: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:123:42: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
123 | inline bign operator + (const bign& b){
| ^
a.cc:123:42: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:123:42: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:123:42: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:134:46: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
134 | inline bign operator - (const bign& b){
| ^
a.cc:134:46: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:134:46: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:134:46: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:144:43: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
144 | inline bign operator * (const bign& b)const{
| ^~~~~
a.cc:144:43: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:144:43: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:144:43: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:153:42: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
153 | inline bign operator / (const bign& b){
| ^
a.cc:153:42: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:153:42: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:153:42: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:166:42: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
166 | inline bign operator % (const bign& b){
| ^
a.cc:166:42: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:166:42: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:166:42: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:176:43: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
176 | inline bign operator += (const bign& b){
| ^
a.cc:176:43: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:176:43: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:176:43: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:180:43: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
180 | inline bign operator *= (const bign& b){
| ^
a.cc:180:43: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:180:43: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:180:43: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:184:47: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
184 | inline bign operator -= (const bign& b){
| ^
a.cc:184:47: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:184:47: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:184:47: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:188:47: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
188 | inline bign operator /= (const bign& b){
| ^
a.cc:188:47: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:188:47: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:188:47: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:192:44: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
192 | inline bool operator < (const bign& b) const{
| ^~~~~
a.cc:192:44: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:192:44: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:192:44: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:198:43: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
198 | inline bool operator >(const bign& b) const{return b<*this;}
| ^~~~~
a.cc:198:43: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:198:43: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:198:43: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:199:43: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
199 | inline bool operator<=(const bign& b) const{return !(b<*this);}
| ^~~~~
a.cc:199:43: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:199:43: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:199:43: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:200:43: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
200 | inline bool operator>=(const bign& b) const{return !(*this<b);}
| ^~~~~
a.cc:200:43: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
a.cc:200:43: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:200:43: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:201:43: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
201 | inline bool operator!=(const bign& b) const{return b<*this || *this<b;}
| ^~~~~
a.cc:201:43: warning: bad option '-fwhole-program' to attribute 'op
|
s511901688
|
p04042
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
bitset<10010> ok[2010];
int n, k;
string s[2010];
char ans[10010];
vector<int> pts;
int fail[10010];
int self[10010];
int match[10010];
int an;
int main()
{
cin>>n>>k;
for(int i=1; i<=n; ++i) cin>>s[i];
ok[n+1][0]=1;
for(int i=n; 1<=i; --i) ok[i] = ok[i+1] | (ok[i+1]<<(s[i].length()));
pts.pb(0);
for(int i=1; i<=n; ++i){
const char* p = s[i].c_str();
int l = s[i].length();
fill(fail, fail+l, 0);
fill(self, self+l, 0);
fill(match, match+an+1, 0);
for(int i=1; i<l; ++i){
int j=fail[i-1];
while(j && p[j] != p[i]) j=fail[j-1];
if(p[j] == p[i]) ++j;
fail[i]=j;
if(j) self[i-j+1]=max(self[i-j+1], j);
}
for(int i=0; i<l; ++i){
int& m=self[i];
while(m<l-i && p[m]==p[i+m]) ++m;
if(m){
int& t=self[i+m-fail[m-1]];
t=max(t, fail[m-1]);
}
}
for(int i=0, ml=0; i<ans; ++i){
while(ml && p[ml] != ans[i]) ml=fail[ml-1];
if(p[ml] == ans[i]) ++ml;
if(ml) match[i-ml+1] = max(match[i-ml+1], ml);
}
for(int i=0; i<an; ++i){
int& m=match[i];
while(m<l && ans[i+m] == p[m]) ++m;
if(m>=2){
int& t=match[i+m-fail[m-1]];
t=max(t, fail[m-1]);
}
}
int cmp = -1;
for(int st:pts){
if(k<(st+l) || !ok[i+1][k-(st+l)]) continue;
if(cmp == -1){
if(match[st]<l && (st+match[st]==an || p[match[st]]<ans[st+match[st]])){
cmp = st;
}
} else if(cmp+l <= st) break;
else {
int sa = st-cmp;
if(match[cmp] >= sa){
if(self[sa] == l-sa || p[self[sa]]<p[sa+self[sa]]) cmp=st;
}
}
}
int lm = an;
if(cmp != -1){
lm = cmp + match[cmp], an = cmp+l;
for(int i=0; i<l; ++i) ans[cmp+i]=p[i]; ans[an]=0;
}
vector<int> nv;
for(int st:pts){
if(k<(st+l) || !ok[i+1][k-(st+l)]) continue;
if((match[st]==l && (cmp==-1 || st+match[st]<=cmp)) || match[st]>=cmp-st && self[cmp-st]==l-(cmp-st)){
nv.pb(st+l);
}
}
vector<int> fn;
for(int i=0,j=0; i<pts.size() || j<nv.size();){
if(j==nv.size() || (i<pts.size() && j<nv.size() && pts[i]<nv[j])){
if(pts[i]<=lm){
if(fn.empty() || fn.back() != pts[i])
fn.pb(pts[i]);
}
++i;
} else {
if(fn.empty() || fn.back() != nv[j]) fn.pb(nv[j]);
++j;
}
}
swap(pts, fn);
}
puts(ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:55:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
55 | for(int i=0, ml=0; i<ans; ++i){
| ~^~~~
|
s946760563
|
p04042
|
C++
|
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<bitset>
using namespace std;
typedef unsigned long long ull;
const int N=2005;
int n,m,p[N],q[N],a[1002005],f[N],len[N],now,sz;
ull hash[1002005];
bitset<10005> arr[N],bit;
char str[1000005];
bool cmp(int x,int y)
{
int l=1,r=min(len[x],len[y]);
while (l<=r)
{
int mid=(l+r)/2;
if (hash[p[x]+mid]==hash[p[y]+mid]) l=mid+1;
else r=mid-1;
}
if (l>min(len[x],len[y])) return len[x]<len[y];
else return a[p[x]+l]<a[p[y]+l];
}
void pri(int x)
{
for (int i=1;i<=len[x];i++) putchar(a[p[x]+i]+'a');
}
void solve(int x,int L)
{
if (!L) return;
int now=1;
while (f[now]<x||!arr[f[now]][L]) now++;
pri(f[now]);
solve(f[now]+1,L-len[f[now]]);
}
int main()
{
scanf("%d%d",&n,&m);
for (int i=1;i<=n;i++)
{
scanf("%s",str+1);
len[i]=strlen(str+1);
p[i]=sz+1;q[i]=sz+len[i]+1;
for (int j=1;j<=len[i];j++)
{
hash[p[i]+j]=hash[p[i]+j-1]*27+str[j]-'a'+1;
a[p[i]+j]=str[j]-'a';
}
sz=q[i];
}
for (int i=1;i<=n;i++) f[i]=i;
sort(f+1,f+n+1,cmp);
bit[0]=1;
for (int i=n;i>=1;i--) arr[i]=bit<<len[i],bit|=bit<<len[i];
solve(1,m);
return 0;
}
|
a.cc: In function 'bool cmp(int, int)':
a.cc:24:21: error: reference to 'hash' is ambiguous
24 | if (hash[p[x]+mid]==hash[p[y]+mid]) l=mid+1;
| ^~~~
In file included from /usr/include/c++/14/string_view:50,
from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
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/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:14:5: note: 'ull hash [1002005]'
14 | ull hash[1002005];
| ^~~~
a.cc:24:37: error: reference to 'hash' is ambiguous
24 | if (hash[p[x]+mid]==hash[p[y]+mid]) l=mid+1;
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:14:5: note: 'ull hash [1002005]'
14 | ull hash[1002005];
| ^~~~
a.cc: In function 'int main()':
a.cc:55:25: error: reference to 'hash' is ambiguous
55 | hash[p[i]+j]=hash[p[i]+j-1]*27+str[j]-'a'+1;
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:14:5: note: 'ull hash [1002005]'
14 | ull hash[1002005];
| ^~~~
a.cc:55:38: error: reference to 'hash' is ambiguous
55 | hash[p[i]+j]=hash[p[i]+j-1]*27+str[j]-'a'+1;
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:14:5: note: 'ull hash [1002005]'
14 | ull hash[1002005];
| ^~~~
|
s153046398
|
p04042
|
C++
|
# include <bits/stdc++.h>
using namespace std;
# define REP(i, a, b) for(int i = a; i <= b; ++ i)
# define CLR(i, a) memset(i, a, sizeof(i))
# define REPD(i, a, b) for(int i = a; i >= b; -- i)
# define OUT(x) cout << #x << ": " << x << " "
const int N = 2e3 + 5;
int k, n, stk[N], tp, f[N][(int)(1e4 + 5)], tot, g[N];
string s[N];
int vis[N];
# define QAQ puts("**")
inline int cmp(const int a, const int b) { return s[a] < s[b]; }
int main() {
CLR(vis, -1);
scanf("%d%d", &n, &k);
REP(i, 1, n) cin >> s[i], tot += s[i].size(), g[i] = i;
sort(g + 1, g + n + 1, cmp);
REP(i, 1, n + 1) f[i][0] = 1;
REPD(i, n, 1) {
REPD(j, min(tot, (int)1e4), s[i].size()) {
f[i][j] |= f[i + 1][j - s[i].size()];
// OUT(i), OUT(j), OUT(f[i][j]), puts("");
}
}
int tmp = k, cur = 0;
while(tmp) {
int x;
REP(j, 1, n) {
if(g[j] > cur && tmp >= s[g[j].size()]) {
if(f[g[j] + 1][tmp - s[g[j]].size()]) {
tmp -= s[g[j]].size();
stk[++ tp] = g[j];
cur = g[j];
break;
}
}
}
// OUT(x), OUT(tmp), cout<<f[x + 1][tmp - s[x].size()]<<endl;
// system("pause");
// OUT(cur), puts("");
}
REP(i, 1, tp) cout << s[stk[i]];
puts("");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:37:56: error: request for member 'size' in 'g[j]', which is of non-class type 'int'
37 | if(g[j] > cur && tmp >= s[g[j].size()]) {
| ^~~~
|
s016430520
|
p04042
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <bitset>
using namespace std;
#define MAXN 2000
#define MAXK 10000
bitset <MAXK+1> d[MAXN+1];
int r[MAXN+1];
string s[MAXN+1];
vector <int> u[MAXN+1];
char ans[MAXN+1];
int a[MAXN+1], b[MAXN+1];
int st[MAXN+1];
bool g[MAXN+1][MAXN+1];
bool cmp(const int &a, const int &b){
return s[a]<s[b];
}
int main(){
int n, k;
cin >> n >> k;
for(int i=1; i<=n; i++)
cin >> s[i];
for(int i=1; i<=n; i++)
a[i]=i;
sort(a+1, a+n+1, cmp);
int q=1;
b[a[1]]=1;
for(int i=2; i<=n; i++){
q+=(s[a[i]]!=s[a[i-1]]);
b[a[i]]=q;
}
int vf=1;
st[1]=a[1];
for(int i=2; i<=n; i++){
int j=0, p=1;
while((p<=vf)&&(j<(int)s[a[i]].size())&&(s[a[i]][j]==s[st[p]][j])){
j++;
while((p<=vf)&&(j==(int)s[st[p]].size()))
p++;
}
st[p]=a[i];
vf=p;
for(int j=1; j<p; j++)
g[a[i]][st[j]]=g[st[j]][a[i]]=1;
}
d[n+1][0]=1;
for(int i=n; i>0; i--)
d[i]=d[i+1]|(d[i+1]<<s[i].size());
r[0]=1;
int t=0;
for(int i=0; i<k; i++) if(r[i]>0){
int left=q+1, right=0;
for(int j=r[i]; j<=n; j++)
if((k-i-(int)s[j].size()>=0)&&(d[j+1][k-i-(int)s[j].size()]))
u[b[j]].push_back(j), left=min(left, b[j]), right=max(right, b[j]);
r[i]=0;
vf=0;
for(int j=left; j<=right; j++){
for(auto x:u[j])
if((vf==0)||(g[st[vf]][x]))
st[++vf]=x;
u[j].clear();
}
int p=0, j=1;
while((i+p<t)&&(j<=vf)&&(ans[i+p]==s[st[vf]][p])){
p++;
while((j<=vf)&&((int)s[st[j]].size()==p)){
if((r[i+p]==0)||(st[j]+1<r[i+p]))
r[i+p]=st[j]+1;
j++;
}
}
if((j<=vf)&&((i+p==t)||(s[st[vf]][p]<ans[i+p]))){
while(j<=vf){
ans[i+p]=s[st[vf]][p];
p++;
r[i+p]=0;
while((j<=vf)&&((int)s[st[j]].size()==p)){
if((r[i+p]==0)||(st[j]+1<r[i+p]))
r[i+p]=st[j]+1;
j++;
}
}
while(i+p<t){
p++;
r[i+p]=0;
}
t=i+p;
}
}
for(int i=0; i<k; i++)
cout << ans[i];
return 0;
}
|
a.cc:15:1: error: 'vector' does not name a type
15 | vector <int> u[MAXN+1];
| ^~~~~~
a.cc: In function 'int main()':
a.cc:71:17: error: 'u' was not declared in this scope
71 | u[b[j]].push_back(j), left=min(left, b[j]), right=max(right, b[j]);
| ^
a.cc:77:24: error: 'u' was not declared in this scope
77 | for(auto x:u[j])
| ^
a.cc:80:13: error: 'u' was not declared in this scope
80 | u[j].clear();
| ^
|
s489502134
|
p04042
|
C++
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long llu;
const llu B = 37ULL;
int best[10010];
int M[20000002], m;
vector<llu> h[2002];
string str[2002];
vector<int> acc_sz[20000002], nxt[20000002];
int last[20000002];
vector<llu> acc_hash[20000002];
llu pot[1000010];
void process(int idx, int t, int s) {
int i, sz = str[s].size();
acc_sz[idx].clear();
acc_hash[idx].clear();
nxt[idx].clear();
acc_sz[idx].push_back(sz); acc_hash[idx].push_back(h[s][str[s].size()]); nxt[idx].push_back(best[t-sz]);
for (i=1; nxt[idx][i-1]; i++) {
int p = min(i-1, last[nxt[idx][i-1]]);
/*acc_sz[idx][i] = acc_sz[idx][i-1] + acc_sz[nxt[idx][i-1]][p];
acc_hash[idx][i] = acc_hash[idx][i-1] * pot[acc_sz[nxt[idx][i-1]][p]] + acc_hash[nxt[idx][i-1]][p];
nxt[idx][i] = nxt[nxt[idx][i-1]][p];*/
acc_sz[idx].push_back(acc_sz[idx][i-1] + acc_sz[nxt[idx][i-1]][p]);
acc_hash[idx].push_back(acc_hash[idx][i-1] * pot[acc_sz[nxt[idx][i-1]][p]] + acc_hash[nxt[idx][i-1]][p]);
nxt[idx].push_back(nxt[nxt[idx][i-1]][p]);
}
last[idx] = i-1;
}
llu calc(int idx, int pos, int s, char &ch) {
llu hs = 0ULL;
while (1) {
int j = 0;
while (acc_sz[idx][j] < pos) j++;
if (acc_sz[idx][j] == pos) {
hs = hs * pot[acc_sz[idx][j]] + acc_hash[idx][j];
ch = str[M[nxt[idx][j]]][0];
break;
}
if (j == 0) {
hs = hs * pot[pos] + h[s][pos];
ch = str[s][pos];
break;
}
hs = hs * pot[acc_sz[idx][j-1]] + acc_hash[idx][j-1];
pos -= acc_sz[idx][j-1];
idx = nxt[idx][j-1];
s = M[idx];
}
return hs;
}
int main() {
int n,k;
cin>>n>>k;
pot[0] = 1ULL;
for (int i=1; i<1000010; i++)
pot[i] = pot[i-1] * B;
for (int i=0; i<n; i++) {
cin>>str[i];
h[i].resize(str[i].size()+1);
h[i][0] = 0ULL;
for (int j=0; j<int(str[i].size()); j++)
h[i][j+1] = h[i][j]*B + (llu)(str[i][j]-'a'+1);
}
memset(best, -1, sizeof(best));
best[0] = 0;
M[0] = 0; m = 1;
for (int i=n-1; i>=0; i--) {
for (int t=k; t-int(str[i].size())>=0; t--) {
int j = t - str[i].size();
if (best[j] == -1) continue;
if (best[t] == -1) {
process(m, t, i);
M[m] = i;
best[t] = m++;
continue;
}
process(m, t, i);
int hi=t,lo=1,mid,lcp=0;
int it = best[t];
char ch_old, ch_new;
bool is_better = str[i][0] < str[M[it]][0];
while (lo <= hi) {
mid = (lo+hi) >> 1;
if (calc(m, mid, i, ch_new) == calc(it, mid, M[it], ch_old)) {
lcp = mid;
lo = mid+1;
is_better = ch_new < ch_old;
} else {
hi = mid-1;
}
}
if (lcp != t && is_better) {
process(m, t, i);
M[m] = i;
best[t] = m++;
}
}
}
int idx = best[k];
while (idx) {
cout << str[M[idx]];
idx = nxt[idx][0];
}
cout << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:81:3: error: 'memset' was not declared in this scope
81 | memset(best, -1, sizeof(best));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <vector>
+++ |+#include <cstring>
4 |
|
s493661129
|
p04042
|
C++
|
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
#define eps 1e-5
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
const int maxn = 2e3+2;
const ll mod = 1e9+7;
const double PI = acos(-1.0);
ll po(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int n,k;
int vis[maxn];
string val[maxn];
bool get[maxn][10001];
bool dp[maxn][10001];
int loc[2][1000005][2];
void solve()
{
int i,j;
sa(n),sa(k);
repp(i,1,n)
{
cin>>val[i];
}
mem(dp,false);
dp[n+1][0] = false;
for(i=n;i>=1;i--)
{
for(j=0;j<=k;j++)
{
if(dp[i+1][j])
{
dp[i][j] = true;
}
if(dp[i+1][j] && j + val[i].length() <= k)
{
dp[i][j+val[i].length] = true;
}
}
}
int now=0,pre=1;
for(i=1;i<=n;i++)
{
if(dp[])
loc[now][]
}
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("/Users/2997ms/Desktop/eve/algorithm/algorithm/i.txt", "r", stdin);
//freopen("/Users/2997ms/Desktop/eve/algorithm/algorithm/o.txt", "w", stdout);
#endif
solve();
return 0;
}
|
a.cc: In function 'void solve()':
a.cc:68:48: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
68 | dp[i][j+val[i].length] = true;
| ~~~~~~~^~~~~~
| ()
a.cc:75:23: error: expected primary-expression before ']' token
75 | if(dp[])
| ^
a.cc:76:26: error: expected primary-expression before ']' token
76 | loc[now][]
| ^
|
s063445104
|
p04042
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int n, k;
const int maxn = 2005;
const int maxk = 10005;
const int maxc = 1e6 + 20;
int len[maxn];
int start[maxn];
bitset<maxk> can[maxn];
int ss[maxc];
int critical[maxc];
int loc[2][maxc];
int main(){
memset(critical, -1, sizeof(critical));
scanf("%d%d\n", &n, &k);
int tt = 0;
vector<bool> appr(26);
for(int i=0;i<n;i++){
//string s; getline(cin, s);
cin >> s;
len[i] = s.length();
start[i] = tt;
critical[tt] = i;
for(int e=0;e<s.length();e++){
int c = s[e] - 'a';
appr[c] = true;
ss[tt] = c;
tt++;
}
}
int numappr = 0;
for(int i=0;i<26;i++)if(appr[i]) numappr++;
if(numappr == 1){
for(int i=0;i<26;i++){
if(appr[i]){
cout << string(k, (i + 'a')) << "\n";
return 0;
}
}
}
can[n][0] = true;
for(int i=n-1;i>=0;i--){
can[i] = can[i+1] | (can[i+1]<<len[i]);
}
int q = 0;
int cnt = 0;
for(int i=0;i<n;i++){
if(can[i+1][k-len[i]]) loc[q][cnt++] = start[i];
}
string ans = "";
for(int eee = 0; eee < k; eee++){
int mn = 1e9;
for(int i=0;i<cnt;i++){
int x = loc[q][i];
mn = min(mn, ss[x]);
}
ans.push_back(mn + 'a');
int mnn = 1e9;
int ncnt = 0;
for(int i=0;i<cnt;i++){
int x = loc[q][i];
if(ss[x] != mn) continue;
if(critical[x+1] != -1){
mnn = min(mnn, critical[x+1]);
}
else{
loc[q ^ 1][ncnt++] = x + 1;
}
}
if(mnn != 1e9){
for(int i = mnn; i < n; i++){
if(k-eee-1-len[i]>=0 && can[i+1][k-eee-1-len[i]]) loc[q ^ 1][ncnt++] = start[i];
}
}
q ^= 1;
cnt = ncnt;
}
cout << ans << "\n";
}
|
a.cc: In function 'int main()':
a.cc:24:12: error: 's' was not declared in this scope
24 | cin >> s;
| ^
|
s685232754
|
p04042
|
C++
|
#include<stdio.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int R=10;
string s[2100];
char in[11000];
typedef unsigned long long wolf;
wolf rj[11000];
wolf ks=1000000007;
char rd[2010][10010];
char dp[2010][10010];
char st[2010][10010];
vector<wolf> Hash[2010];
wolf cur[10010];
int lc[10100];
int f[]={114,514,810,1919,893,364364,334,1000000007,31415926,1145141919};
inline bool eq(int a,int b,int c,int d){
int len=b-a;
// printf("%d %d %d: %llu %llu %llu %llu\n",a,b,c,cur[b]-cur[a],Hash[c][len],rj[a],Hash[c][len]*rj[a]);
if(cur[b]-cur[a]!=Hash[c][len]*rj[a])return false;
for(int i=0;i<R;i++){
int at=f[i]%len;
if(st[d][a+at]!=s[c][at])return false;
}
return true;
}
inline int calc(int a,int b){
if(eq(a,a+s[b].size(),b,b))return 9999999;
int left=a-1;
int right=a+s[b].size();
while(left+1<right){
int M=(left+right)/2;
if(eq(a,M+1,b,b)){
left=M;
}else right=M;
}
//printf("%d\n",right);
//if(right==a+s[b].size())return 0;
//if(s[b][right-a]<st[b][right])return 1;
//return -1;
return right;
}
int main(){
int a,b;
scanf("%d%d",&a,&b);
for(int i=0;i<a;i++){
scanf("%s",in);
s[i]=in;
}
rj[0]=1;
for(int i=1;i<11000;i++)rj[i]=rj[i-1]*ks;
rd[a][b]=1;
for(int i=a;i;i--){
for(int j=0;j<=b;j++){
if(rd[i][j]&&j>=s[i-1].size()){
rd[i-1][j-(int)(s[i-1].size())]=1;
}
if(rd[i][j])rd[i-1][j]=1;
}
}
for(int i=0;i<a;i++){
Hash[i]=vector<wolf>(s[i].size()+1);
wolf now=0;
wolf tt=1;
for(int j=0;j<s[i].size();j++){
now+=tt*s[i][j];
tt*=ks;
Hash[i][j+1]=now;
// printf("%llu ",now);
}
// printf("\n");
}
dp[0][0]=1;
for(int i=0;i<b;i++)st[0][i]='~';
for(int i=0;i<a;i++){
wolf now=0;
wolf tt=1;
for(int j=0;j<b;j++){
now+=tt*st[i][j];
tt*=ks;
cur[j+1]=now;
// printf("%llu ",now);
}
//printf("\n");
for(int j=0;j<=b;j++)st[i+1][j]=st[i][j];
//printf("%s\n",st[i]);
int lcp=b;
int bv=-1;
for(int j=0;j<=b;j++){
if(!dp[i][j])continue;
// printf("%d %d\n",i,j);
if(j+s[i].size()<=b&&rd[i+1][j+s[i].size()]){
int val=calc(j,i);
lc[j]=val;
if(bv==-1){
if(val<b&&s[i][val-j]<st[i][val]){
bv=j;
lcp=lc[j];
}
}else{
if((val<lc[bv]&&s[i][val-j]<st[i][val])||(val==lc[bv]&&s[i][val-j]<s[i][lc[bv]-bv])){
bv=j;
lcp=lc[j];
}
}
}
}
//printf("%d %d\n",bv,lcp);
if(bv!=-1){
for(int j=bv;j<bv+s[i].size();j++)st[i+1][j]=s[i][j-bv];
for(int j=bv+s[i].size();j<b;j++)st[i+1][j]='~';
}
//printf("%s\n",st[i+1]);
now=0;
tt=1;
for(int j=0;j<b;j++){
now+=tt*st[i+1][j];
tt*=ks;
cur[j+1]=now;
// printf("%llu ",now);
}
for(int j=0;j<=b;j++){
if(!dp[i][j])continue;
// printf("%d %d\n",i,j);
if(j+s[i].size()<=b&&lcp>=j&&rd[i+1][j+s[i].size()]){
if(eq(j,j+s[i].size(),i,i+1))dp[i+1][j+s[i].size()]=1;
}
if(rd[i+1][j]&&j<=lcp){
dp[i+1][j]=1;
}
}
}
if(strlen(st[a])!=b)return 1;
printf("%s\n",st[a]);
}
|
a.cc: In function 'int main()':
a.cc:136:12: error: 'strlen' was not declared in this scope
136 | if(strlen(st[a])!=b)return 1;
| ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<vector>
+++ |+#include <cstring>
5 | using namespace std;
|
s710402956
|
p04042
|
C++
|
#include<stdio.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int R=3;
string s[2100];
char in[11000];
typedef unsigned long long wolf;
wolf rj[11000];
wolf ks=1000000007;
char rd[2010][10010];
char dp[2010][10010];
char st[2010][10010];
vector<wolf> Hash[2010];
wolf cur[10010];
unsigned int st=114514;
inline bool eq(int a,int b,int c){
int len=b-a;
// printf("%d %d %d: %llu %llu %llu %llu\n",a,b,c,cur[b]-cur[a],Hash[c][len],rj[a],Hash[c][len]*rj[a]);
if(cur[b]-cur[a]!=Hash[c][len]*rj[a])return false;
for(int i=0;i<min(len,R);i++){
int at=i;
if(st[c][a+at]!=s[c][at])return false;
}
return true;
}
inline int cmp(int a,int b){
int left=a-1;
int right=a+s[b].size();
while(left+1<right){
int M=(left+right)/2;
if(eq(a,M+1,b)){
left=M;
}else right=M;
}
//printf("%d\n",right);
if(right==a+s[b].size())return 0;
if(s[b][right-a]<st[b][right])return 1;
return -1;
}
int main(){
int a,b;
scanf("%d%d",&a,&b);
for(int i=0;i<a;i++){
scanf("%s",in);
s[i]=in;
}
rj[0]=1;
for(int i=1;i<11000;i++)rj[i]=rj[i-1]*ks;
rd[a][b]=1;
for(int i=a;i;i--){
for(int j=0;j<=b;j++){
if(rd[i][j]&&j>=s[i-1].size()){
rd[i-1][j-(int)(s[i-1].size())]=1;
}
if(rd[i][j])rd[i-1][j]=1;
}
}
for(int i=0;i<a;i++){
Hash[i]=vector<wolf>(s[i].size()+1);
wolf now=0;
wolf tt=1;
for(int j=0;j<s[i].size();j++){
now+=tt*s[i][j];
tt*=ks;
Hash[i][j+1]=now;
// printf("%llu ",now);
}
// printf("\n");
}
dp[0][0]=1;
for(int i=0;i<b;i++)st[0][i]='z';
for(int i=0;i<a;i++){
wolf now=0;
wolf tt=1;
for(int j=0;j<b;j++){
now+=tt*st[i][j];
tt*=ks;
cur[j+1]=now;
// printf("%llu ",now);
}
//printf("\n");
for(int j=0;j<=b;j++)st[i+1][j]=st[i][j];
//printf("%s\n",st[i]);
for(int j=0;j<=b;j++){
if(!dp[i][j])continue;
// printf("%d %d\n",i,j);
if(rd[i+1][j])dp[i+1][j]=1;
if(j+s[i].size()<=b&&rd[i+1][j+s[i].size()]){
int tmp=cmp(j,i);
// printf("%d\n",tmp);
if(tmp>=0){
dp[i+1][j+s[i].size()]=1;
if(tmp){
bool flag=false;
for(int k=j;k<j+s[i].size();k++){
if(s[i][k-j]!=st[i+1][k])flag=true;
st[i+1][k]=s[i][k-j];
if(flag&&k!=j+s[i].size()-1)dp[i+1][k+1]=0;
}
for(int k=j+s[i].size();k<b;k++){
st[i+1][k]='z';
dp[i+1][k+1]=0;
}
break;
}
}
}
}
}
printf("%s\n",st[a]);
}
|
a.cc:17:14: error: conflicting declaration 'unsigned int st'
17 | unsigned int st=114514;
| ^~
a.cc:14:6: note: previous declaration as 'char st [2010][10010]'
14 | char st[2010][10010];
| ^~
|
s410807226
|
p04042
|
C++
|
#include<stdio.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int R=5;
string s[2100];
char in[11000];
typedef unsigned long long wolf;
wolf rj[11000];
wolf ks=1000000007;
char rd[2010][10010];
char dp[2010][10010];
char st[2010][10010];
vector<wolf> hash[2010];
wolf cur[10010];
inline bool eq(int a,int b,int c){
int len=b-a;
// printf("%d %d %d: %llu %llu %llu %llu\n",a,b,c,cur[b]-cur[a],hash[c][len],rj[a],hash[c][len]*rj[a]);
if(cur[b]-cur[a]!=hash[c][len]*rj[a])return false;
for(int i=0;i<R;i++){
int at=rand()%len;
if(st[c][a+at]!=s[c][at])return false;
}
return true;
}
inline int cmp(int a,int b){
int left=a-1;
int right=a+s[b].size();
while(left+1<right){
int M=(left+right)/2;
if(eq(a,M+1,b)){
left=M;
}else right=M;
}
//printf("%d\n",right);
if(right==a+s[b].size())return 0;
if(s[b][right-a]<st[b][right])return 1;
return -1;
}
int main(){
int a,b;
scanf("%d%d",&a,&b);
for(int i=0;i<a;i++){
scanf("%s",in);
s[i]=in;
}
rj[0]=1;
for(int i=1;i<11000;i++)rj[i]=rj[i-1]*ks;
rd[a][b]=1;
for(int i=a;i;i--){
for(int j=0;j<=b;j++){
if(rd[i][j]&&j>=s[i-1].size()){
rd[i-1][j-(int)(s[i-1].size())]=1;
}
if(rd[i][j])rd[i-1][j]=1;
}
}
for(int i=0;i<a;i++){
hash[i]=vector<wolf>(s[i].size()+1);
wolf now=0;
wolf tt=1;
for(int j=0;j<s[i].size();j++){
now+=tt*s[i][j];
tt*=ks;
hash[i][j+1]=now;
// printf("%llu ",now);
}
// printf("\n");
}
dp[0][0]=1;
for(int i=0;i<b;i++)st[0][i]='z';
for(int i=0;i<a;i++){
wolf now=0;
wolf tt=1;
for(int j=0;j<b;j++){
now+=tt*st[i][j];
tt*=ks;
cur[j+1]=now;
// printf("%llu ",now);
}
//printf("\n");
for(int j=0;j<=b;j++)st[i+1][j]=st[i][j];
//printf("%s\n",st[i]);
for(int j=0;j<=b;j++){
if(!dp[i][j])continue;
// printf("%d %d\n",i,j);
if(rd[i+1][j])dp[i+1][j]=1;
if(j+s[i].size()<=b&&rd[i+1][j+s[i].size()]){
int tmp=cmp(j,i);
// printf("%d\n",tmp);
if(tmp>=0){
dp[i+1][j+s[i].size()]=1;
if(tmp){
bool flag=false;
for(int k=j;k<j+s[i].size();k++){
if(s[i][k-j]!=st[i+1][k])flag=true;
st[i+1][k]=s[i][k-j];
if(flag&&k!=j+s[i].size()-1)dp[i+1][j+1]=0;
}
break;
}
}
}
}
}
printf("%s\n",st[a]);
}
|
a.cc: In function 'bool eq(int, int, int)':
a.cc:20:27: error: reference to 'hash' is ambiguous
20 | if(cur[b]-cur[a]!=hash[c][len]*rj[a])return false;
| ^~~~
In file included from /usr/include/c++/14/string_view:50,
from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from a.cc:3:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:15:14: note: 'std::vector<long long unsigned int> hash [2010]'
15 | vector<wolf> hash[2010];
| ^~~~
a.cc: In function 'int main()':
a.cc:60:17: error: reference to 'hash' is ambiguous
60 | hash[i]=vector<wolf>(s[i].size()+1);
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:15:14: note: 'std::vector<long long unsigned int> hash [2010]'
15 | vector<wolf> hash[2010];
| ^~~~
a.cc:66:25: error: reference to 'hash' is ambiguous
66 | hash[i][j+1]=now;
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:15:14: note: 'std::vector<long long unsigned int> hash [2010]'
15 | vector<wolf> hash[2010];
| ^~~~
|
s375182819
|
p04042
|
C++
|
#include <vector>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <cstring>
using namespace std;
#ifndef MDEBUG
#define NDEBUG
#endif
#define x first
#define y second
#define ll long long
#define d double
#define ld long double
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define pss pair<string,string>
#define psi pair<string,int>
#define pis pair<int,string>
#define psl pair<string,ll>
#define pls pair<ll,string>
#define wh(x) (x).begin(),(x).end()
#define ri(x) int x;cin>>x;
#define rii(x,y) int x,y;cin>>x>>y;
#define rl(x) ll x;cin>>x;
#define rv(v) for(auto&_cinv:v) cin>>_cinv;
#define wv(v) for(auto&_coutv:v) cout << _coutv << ' '; cout << endl;
#define ev(v) for(auto&_cerrv:v) cerr << _cerrv << ' '; cerr << endl;
#define MOD 1000000007
namespace std {
template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}};
}
// auto fraclt = [](auto&a,auto&b) { return (ll)a.x * b.y < (ll)b.x * a.y; };
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }
template<typename T> void fracn(pair<T,T>&a) {auto g=gcd(a.x,a.y);a.x/=g;a.y/=g;}
template<typename T> struct Index { int operator[](const T&t){auto i=m.find(t);return i!=m.end()?i->y:m[t]=m.size();}int s(){return m.size();} unordered_map<T,int> m; };
bool W[2001][10001];
char T[10000];
int N,K;
vector<string> S;
map<pii, string> M;
void build(int k, int n) {
if (M.find({k,n}) != M.end()) {
string &s = M[{k,n}];
memcpy(T+k, s.c_str(), K-k);
return;
}
if (k == K) return;
vector<pair<string,int>> O;
for (int i = n; i < N; i++) {
if (W[N-i][K-k] &&
((k + S[i].size() == K) ||
(k + S[i].size() < K && W[N-i-1][K-k-S[i].size()]))) {
O.push_back({S[i],i});
}
}
sort(wh(O));
string l;
for (auto & o: O) {
if (l == o) continue;
bool ok = true;
for (int i = 0; i < o.x.size(); i++) {
if (o.x[i] > T[k+i]) { ok = false; break; }
if (o.x[i] < T[k+i]) { ok = true; break; }
}
if (!ok) break;
for (int i = 0; i < o.x.size(); i++) {
T[k+i] = o.x[i];
}
build(k+o.x.size(), o.y+1);
}
string q; q.resize(K-k);
memcpy(const_cast<char*>(q.c_str()),T+k,K-k);
M[{k,n}] = q;
}
int main(int,char**) {
ios_base::sync_with_stdio(false);
cin >> N >> K;
for (int i = 0; i < K; i++) {
T[i] = 'z';
}
for (int i = 0; i <= N; i++) {
for (int k = 0; k <= K; k++) {
W[i][k] = 0;
}
}
W[0][0] = 1;
S.resize(N); rv(S);
for (int i = 1; i <= N; i++) {
for (int j = 0; j < K; j++) {
if (!W[i-1][j]) continue;
W[i][j] = true;
if (j+S[N-i].size() <= K) W[i][j+S[N-i].size()] = true;
}
}
build(0,0);
for (int i = 0; i < K; i++) {
cout << T[i];
}
cout << endl;
}
|
a.cc: In function 'void build(int, int)':
a.cc:77:15: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::pair<std::__cxx11::basic_string<char>, int>')
77 | if (l == o) continue;
| ~ ^~ ~
| | |
| | std::pair<std::__cxx11::basic_string<char>, int>
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
77 | if (l == o) continue;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
77 | if (l == o) continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
77 | if (l == o) continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
77 | if (l == o) continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
77 | if (l == o) continue;
| ^
In file included from /usr/include/c++/14/vector:63:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_Tp1>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_Tp1>'
77 | if (l == o) continue;
| ^
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:2050:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2050 | operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2050:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::vector<_Tp, _Alloc>'
77 | if (l == o) continue;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/vector:87:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>'
77 | if (l == o) continue;
| ^
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:2:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
77 | if (l == o) continue;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
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/string_view:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
77 | if (l == o) continue;
| ^
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
77 | if (l == o) continue;
| ^
/usr/include/c++/14/string_view:644: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>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::pair<std::__cxx11::basic_string<char>, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
77 | if (l == o) continue;
| ^
/usr/include/c++/14/bits/basic_string.h:3755: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>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: 'std::pair<std::__cxx11::basic_string<char>, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
77 | if (l == o) continue;
| ^
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: mismatched types 'const _CharT*' and 'std::pair<std::__cxx11::basic_string<char>, int>'
77 | if (l == o) continue;
| ^
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:77:18: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
77 | if (l == o) continue;
| ^
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c
|
s814206347
|
p04042
|
C++
|
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define SZ(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef unsigned long long ull;
#define PR(...) do{cerr << "line : " << __LINE__ << endl; pr(#__VA_ARGS__, __VA_ARGS__);}while(0);
template<class T>
void pr(const string& name, T t){
cerr << name << ": " << t << endl;
}
template<typename T, typename ... Types>
void pr(const string& names, T t, Types ... rest) {
auto comma_pos = names.find(',');
cerr << names.substr(0, comma_pos) << ": " << t << ", ";
auto next_name_pos = names.find_first_not_of(" \t\n", comma_pos + 1);
pr(string(names, next_name_pos), rest ...);
}
template<class T,class U> ostream& operator<< (ostream& o, const pair<T,U>& v){return o << "(" << v.F << ", " << v.S << ")";}
template<class T> ostream& operator<< (ostream& o, const vector<T>& v){o << "{";rep(i,SZ(v)) o << (i?", ":"") << v[i];return o << "}";}
template<class T> ostream& operator<< (ostream& o, const set<T> &v){o << "{";for(auto e : v) o << e << ", ";return o << "}";}
template<class T, class U> ostream& operator<< (ostream& o, const map<T,U> &v){o << "{";for(auto e : v) o << e.F << ": " << e.S << ", ";return o << "}";}
// < v > ^
const int dx[] = {0,1,0,-1, 1, 1, -1, -1};
const int dy[] = {-1,0,1,0, 1, -1, 1, -1};
#define endl '\n'
#include <sys/time.h>
double gett(){
struct timeval t;
gettimeofday(&t,NULL);
return t.tv_sec + t.tv_usec/1e6;
}
int n, k;
string s[2000];
vector<pair<string, int> > sos;
char memo[2001][10010];
bool can(int ne, int res) {
if (res < 0) return false;
if(res == 0) return true;
if(ne == n) return false;
if(memo[ne][res>=0)
return memo[ne][res];
for (int i = ne; i < n; ++i) {
if (can(i + 1, res - SZ(s[i])))
return memo[ne][res] = true;
}
return memo[ne][res] = false;
}
double start;
string ans;
int ach;
int gcnt = 0;
void dfs(const string& cur, int lastidx) {
// PR(cur, lastidx);
if(!ans.empty() && ans.substr(0, SZ(cur)) < cur)
return;
if (++gcnt % 100 == 0 &&
gett() - start > 4.7) {
cout << ans << endl;
exit(0);
}
if(!can(lastidx + 1, k - SZ(cur))) return;
if(SZ(cur) == k) {
ans = cur;
++ach;
return;
}
int bef = ach;
for(const auto& s : sos) {
if(s.second <= lastidx) continue;
if(!can(s.second + 1, k - SZ(cur) - SZ(s.first))) continue;
dfs(cur + s.first, s.second);
}
}
int main(int argc, char *argv[])
{
start = gett();
cin >> n >> k;
rep (i, n) cin >> s[i];
memset(memo, -1, sizeof(memo));
// for (int i = n - 1; i >= 0; --i) {
// for (int j = 0; j <= k; ++j) {
// if(j-SZ(s[i]) < 0)
// memo[i][j] = false;
// else if(j-SZ(s[i]) == 0)
// memo[i][j] = true;
// else if (i + 1 == n){
// memo[i][j] = false;
// }else if (memo[i + 1][j - SZ(s[i])]){
// memo[i][j] = true;
// }
// }
// }
rep (i, n) sos.emplace_back(s[i], i);
sort(ALL(sos));
for (int i = 0; i < sos.size(); ++i) {
dfs(sos[i].F, sos[i].S);
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'bool can(int, int)':
a.cc:60:21: error: expected ']' before ')' token
60 | if(memo[ne][res>=0)
| ^
| ]
|
s897638322
|
p04043
|
C++
|
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
#define P pair<int,int>
#define F first
#define S second
int main(){
vi input(3);
Srep(3) cin >> input[i];
Vsort(input);
if((input[0] == 5)&&(input[1] == 5)&&(input[2] == 7)) cout << "YES" << endl;
else cout << "NO" << endl;
}
|
a.cc: In function 'int main()':
a.cc:16:12: error: 'vector' was not declared in this scope
16 | #define vi vector<int>
| ^~~~~~
a.cc:25:3: note: in expansion of macro 'vi'
25 | vi input(3);
| ^~
a.cc:16:12: note: suggested alternatives:
16 | #define vi vector<int>
| ^~~~~~
a.cc:25:3: note: in expansion of macro 'vi'
25 | vi input(3);
| ^~
In file included from /usr/include/c++/14/vector:66,
from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:16:19: error: expected primary-expression before 'int'
16 | #define vi vector<int>
| ^~~
a.cc:25:3: note: in expansion of macro 'vi'
25 | vi input(3);
| ^~
a.cc:26:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
26 | Srep(3) cin >> input[i];
| ^~~
| std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:26:18: error: 'input' was not declared in this scope; did you mean 'int'?
26 | Srep(3) cin >> input[i];
| ^~~~~
| int
a.cc:27:9: error: 'input' was not declared in this scope; did you mean 'int'?
27 | Vsort(input);
| ^~~~~
a.cc:10:23: note: in definition of macro 'Vsort'
10 | #define Vsort(a) sort(a.begin(), a.end())
| ^
a.cc:10:18: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
10 | #define Vsort(a) sort(a.begin(), a.end())
| ^~~~
a.cc:27:3: note: in expansion of macro 'Vsort'
27 | Vsort(input);
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:6:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
a.cc:28:57: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
28 | if((input[0] == 5)&&(input[1] == 5)&&(input[2] == 7)) cout << "YES" << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:28:74: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
28 | if((input[0] == 5)&&(input[1] == 5)&&(input[2] == 7)) cout << "YES" << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:29:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
29 | else cout << "NO" << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:29:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
29 | else cout << "NO" << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s373421171
|
p04043
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if((a==5 && b==5) && c==7)
cout<<"YES";
else if((b==5 && c==5) && a==7)
cout<<YES";
else if((a==5 && c==5) && b==7)
cout<<"YES"
else
cout<<"NO";
return 0;
}
|
a.cc:10:10: warning: missing terminating " character
10 | cout<<YES";
| ^
a.cc:10:10: error: missing terminating " character
10 | cout<<YES";
| ^~
a.cc: In function 'int main()':
a.cc:10:7: error: 'YES' was not declared in this scope
10 | cout<<YES";
| ^~~
|
s038422632
|
p04043
|
Java
|
Scanner input = new Scanner (System.in);
int A,B,C;
A = input.nextInt();
B = input.nextInt();
C = input.nextInt();
if ((A==5&&B==5&& C== 7)|| (A==5&&B==7&& C== 5) || (A==7&&B==5&& C== 5) )
{ System.out.println("YES");}
else { System.out.println("NO");}
}
}
|
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
Scanner input = new Scanner (System.in);
^
(use --enable-preview to enable unnamed classes)
Main.java:2: error: class, interface, enum, or record expected
int A,B,C;
^
Main.java:3: error: class, interface, enum, or record expected
A = input.nextInt();
^
Main.java:4: error: class, interface, enum, or record expected
B = input.nextInt();
^
Main.java:5: error: class, interface, enum, or record expected
C = input.nextInt();
^
Main.java:6: error: class, interface, enum, or record expected
if ((A==5&&B==5&& C== 7)|| (A==5&&B==7&& C== 5) || (A==7&&B==5&& C== 5) )
^
Main.java:7: error: class, interface, enum, or record expected
{ System.out.println("YES");}
^
Main.java:8: error: class, interface, enum, or record expected
else { System.out.println("NO");}
^
8 errors
|
s847832565
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if(a == 5 && b == 5 && c == 7){
cout << "Yes" << endl;
}
else if(a == 5 && b == 7 && c == 5){
cout << "Yes" << endl;
}
else if(a == 7 && b == 5 && c == 5){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
|
a.cc: In function 'int main()':
a.cc:18:4: error: expected '}' at end of input
18 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s109858926
|
p04043
|
C++
|
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
class Solution{
public:
bool isHaiku(vector<int>& lines){
sort(lines.begin(), lines.end());
return lines[0] == 5 && lines[1] == 5 && lines[2] == 7;
}
};
int main() {
vector<int> lines(3);
for(int i = 0; i < 3; i ++)
scanf("%d", &lines[i]);
printf("%s\n", Solution().isHaiku(lines) ? "YES" : "NO");
return 0;
}
|
a.cc: In member function 'bool Solution::isHaiku(std::vector<int>&)':
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort(lines.begin(), lines.end());
| ^~~~
| short
|
s956991766
|
p04043
|
C++
|
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int arr[3];
cin>>arr[0]>>arr[1]>>arr[2];
sort(arr,arr+n)
if(arr[0]==5 && arr[1]==5 && arr[2]==7)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:16: error: 'n' was not declared in this scope; did you mean 'yn'?
11 | sort(arr,arr+n)
| ^
| yn
a.cc:16:3: error: 'else' without a previous 'if'
16 | else
| ^~~~
|
s649481920
|
p04043
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[3];
cin>>arr[0]>>arr[1]>>arr[2];
sort(arr,arr+3)
if(arr[0]==5 && arr[1]==5 & arr[2]==7)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:18: error: expected ';' before 'if'
7 | sort(arr,arr+3)
| ^
| ;
8 | if(arr[0]==5 && arr[1]==5 & arr[2]==7)
| ~~
a.cc:12:3: error: 'else' without a previous 'if'
12 | else
| ^~~~
|
s883221238
|
p04043
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[3];
cin>>arr[0]>>arr[1]>>arr[2];
sort(arr,arr+3);
if(arr[0]==5 && arr[1]=5 && arr[2]=7)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:32: error: lvalue required as left operand of assignment
8 | if(arr[0]==5 && arr[1]=5 && arr[2]=7)
| ~~^~~~~~~~~
|
s687626381
|
p04043
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[3];
cin>>arr[0]>>arr[1]>>arr[2];
sort(arr,arr+3);
if(arr[0]==5 && arr[1]=5 && arr[2]=7)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
|
a.cc: In function 'int main()':
a.cc:8:28: error: lvalue required as left operand of assignment
8 | if(arr[0]==5 && arr[1]=5 && arr[2]=7)
| ~~^~~~~~~~~
a.cc:15:4: error: expected '}' at end of input
15 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s758385658
|
p04043
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[3];
cin>>arr[0]>>arr[1]>>arr[2];
sort(arr,arr+3);
if(arr[0]==5 && arr[1]=5 && arr[c]=7)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:35: error: 'c' was not declared in this scope
8 | if(arr[0]==5 && arr[1]=5 && arr[c]=7)
| ^
|
s504482213
|
p04043
|
Java
|
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class AT042A {
static BufferedReader __in;
static PrintWriter __out;
static StringTokenizer input;
public static void main(String[] args) throws IOException {
__in = new BufferedReader(new InputStreamReader(System.in));
__out = new PrintWriter(new OutputStreamWriter(System.out));
int[] a = ria(3);
sort(a);
if(a[0] == 5 && a[1] == 5 && a[2] == 7) prY();
else prN();
close();
}
// references
// IBIG = 1e9 + 7
// IRAND ~= 3e8
// IMAX ~= 2e10
// LMAX ~= 9e18
// constants
static final int IBIG = 1000000007;
static final int IRAND = 327859546;
static final int IMAX = 2147483647;
static final int IMIN = -2147483648;
static final long LMAX = 9223372036854775807L;
static final long LMIN = -9223372036854775808L;
// util
static int minof(int a, int b, int c) {
return min(a, min(b, c));
}
static int minof(int... x) {
return x.length == 1 ? x[0] : x.length == 2 ? min(x[0], x[1]) : min(x[0], minstarting(1, x));
}
static int minstarting(int offset, int... x) {
assert x.length > 2;
return offset == x.length - 2 ? min(x[offset], x[offset + 1]) : min(x[offset], minstarting(offset + 1, x));
}
static long minof(long a, long b, long c) {
return min(a, min(b, c));
}
static long minof(long... x) {
return x.length == 1 ? x[0] : x.length == 2 ? min(x[0], x[1]) : min(x[0], minstarting(1, x));
}
static long minstarting(int offset, long... x) {
assert x.length > 2;
return offset == x.length - 2 ? min(x[offset], x[offset + 1]) : min(x[offset], minstarting(offset + 1, x));
}
static int maxof(int a, int b, int c) {
return max(a, max(b, c));
}
static int maxof(int... x) {
return x.length == 1 ? x[0] : x.length == 2 ? max(x[0], x[1]) : max(x[0], maxstarting(1, x));
}
static int maxstarting(int offset, int... x) {
assert x.length > 2;
return offset == x.length - 2 ? max(x[offset], x[offset + 1]) : max(x[offset], maxstarting(offset + 1, x));
}
static long maxof(long a, long b, long c) {
return max(a, max(b, c));
}
static long maxof(long... x) {
return x.length == 1 ? x[0] : x.length == 2 ? max(x[0], x[1]) : max(x[0], maxstarting(1, x));
}
static long maxstarting(int offset, long... x) {
assert x.length > 2;
return offset == x.length - 2 ? max(x[offset], x[offset + 1]) : max(x[offset], maxstarting(offset + 1, x));
}
static int powi(int a, int b) {
if (a == 0) return 0;
int ans = 1;
while (b > 0) {
if ((b & 1) > 0) ans *= a;
a *= a;
b >>= 1;
}
return ans;
}
static long powl(long a, int b) {
if (a == 0) return 0;
long ans = 1;
while (b > 0) {
if ((b & 1) > 0) ans *= a;
a *= a;
b >>= 1;
}
return ans;
}
static int floori(double d) {
return (int) d;
}
static int ceili(double d) {
return (int) ceil(d);
}
static long floorl(double d) {
return (long) d;
}
static long ceill(double d) {
return (long) ceil(d);
}
// input
static void r() throws IOException {
input = new StringTokenizer(__in.readLine());
}
static int ri() throws IOException {
return Integer.parseInt(__in.readLine());
}
static long rl() throws IOException {
return Long.parseLong(__in.readLine());
}
static int[] ria(int n) throws IOException {
int[] a = new int[n];
input = new StringTokenizer(__in.readLine());
for (int i = 0; i < n; ++i) a[i] = Integer.parseInt(input.nextToken());
return a;
}
static long[] rla(int n) throws IOException {
long[] a = new long[n];
input = new StringTokenizer(__in.readLine());
for (int i = 0; i < n; ++i) a[i] = Long.parseLong(input.nextToken());
return a;
}
static char[] rcha() throws IOException {
return __in.readLine().toCharArray();
}
static String rline() throws IOException {
return __in.readLine();
}
static int rni() throws IOException {
input = new StringTokenizer(__in.readLine());
return Integer.parseInt(input.nextToken());
}
static int ni() {
return Integer.parseInt(input.nextToken());
}
static long rnl() throws IOException {
input = new StringTokenizer(__in.readLine());
return Long.parseLong(input.nextToken());
}
static long nl() {
return Long.parseLong(input.nextToken());
}
// output
static void pr(int i) {
__out.print(i);
}
static void prln(int i) {
__out.println(i);
}
static void pr(long l) {
__out.print(l);
}
static void prln(long l) {
__out.println(l);
}
static void pr(double d) {
__out.print(d);
}
static void prln(double d) {
__out.println(d);
}
static void pr(char c) {
__out.print(c);
}
static void prln(char c) {
__out.println(c);
}
static void pr(char[] s) {
__out.print(new String(s));
}
static void prln(char[] s) {
__out.println(new String(s));
}
static void pr(String s) {
__out.print(s);
}
static void prln(String s) {
__out.println(s);
}
static void pr(Object o) {
__out.print(o);
}
static void prln(Object o) {
__out.println(o);
}
static void prln() {
__out.println();
}
static void pryes() {
__out.println("yes");
}
static void pry() {
__out.println("Yes");
}
static void prY() {
__out.println("YES");
}
static void prno() {
__out.println("no");
}
static void prn() {
__out.println("No");
}
static void prN() {
__out.println("NO");
}
static void pryesno(boolean b) {
__out.println(b ? "yes" : "no");
}
;
static void pryn(boolean b) {
__out.println(b ? "Yes" : "No");
}
static void prYN(boolean b) {
__out.println(b ? "YES" : "NO");
}
static void prln(int... a) {
for (int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i) ;
__out.println(a[a.length - 1]);
}
static void prln(long... a) {
for (int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i) ;
__out.println(a[a.length - 1]);
}
static <T> void prln(Collection<T> c) {
int n = c.size() - 1;
Iterator<T> iter = c.iterator();
for (int i = 0; i < n; __out.print(iter.next()), __out.print(' '), ++i) ;
__out.println(iter.next());
}
static void flush() {
__out.flush();
}
static void close() {
__out.close();
}
}
|
Main.java:7: error: class AT042A is public, should be declared in a file named AT042A.java
public class AT042A {
^
1 error
|
s127944571
|
p04043
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,l;
cin>>n>>l;
vector<string>s(n);
for(int i=0;i<n;i++)
{
cin>>s[i};
}
sort(s.begin(),s.end());
for(int i=0;i<n;i++)
{
cout<<s[i];
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:13: error: expected ']' before '}' token
12 | cin>>s[i};
| ^
| ]
a.cc:12:13: error: expected ';' before '}' token
12 | cin>>s[i};
| ^
| ;
a.cc: At global scope:
a.cc:14:9: error: expected constructor, destructor, or type conversion before '(' token
14 | sort(s.begin(),s.end());
| ^
a.cc:15:5: error: expected unqualified-id before 'for'
15 | for(int i=0;i<n;i++)
| ^~~
a.cc:15:17: error: 'i' does not name a type
15 | for(int i=0;i<n;i++)
| ^
a.cc:15:21: error: 'i' does not name a type
15 | for(int i=0;i<n;i++)
| ^
a.cc:19:5: error: expected unqualified-id before 'return'
19 | return 0;
| ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
20 | }
| ^
|
s226259037
|
p04043
|
C
|
#include<stdio.h>
int main()
{
int a,b,c
while(scanf("%d%d%d",&a,&b,&c)==3)
{
if(a==5&&b==5&&c==7)
printf("YES\n");
else if(a==5&&b==7&&c==5)
printf("YES\n");
else if(a==7&&b==5&&c==5)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
|
main.c: In function 'main':
main.c:5:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'while'
5 | while(scanf("%d%d%d",&a,&b,&c)==3)
| ^~~~~
|
s067720553
|
p04043
|
C++
|
#define LOCAL
#undef _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define LLINF 1e18
#define INF (int)1e9+1
// Copied from Gennady-Korotkevich's template
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) {
return '"' + s + '"';
}
string to_string(const char* s) {
return to_string((string)s);
}
string to_string(bool b) {
return (b ? "true" : "false");
}
string to_string(vector<bool> v) {
bool first = true;
string res = "{";
for (int i = 0; i < static_cast<int>(v.size()); i++) {
if (!first) {
res += ", ";
}
first = false;
res += to_string(v[i]);
}
res += "}\n";
return res;
}
template <size_t N>
string to_string(bitset<N> v) {
string res = "";
for (size_t i = 0; i < N; i++) {
res += static_cast<char>('0' + v[i]);
}
return res;
}
template <typename A>
string to_string(A v) {
bool first = true;
string res = "{";
for (const auto& x : v) {
if (!first) {
res += ", ";
}
first = false;
res += to_string(x);
}
res += "}\n";
return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
template <typename A, typename B, typename C, typename D, typename E>
string to_string(tuple<A, B, C, D, E> p) {
return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "," + to_string(get<4>(p)) + ")";
}
void debug_out() {
cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "\n[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// End of Gennady-Korotkevich's template
using llong = long long;
using PII = pair<int, int>;
const llong MOD = 998244353;
const double PI = acos(-1);
int main() {
IOS;
vector<int> aa(3);
for (int i = 0; i < 3; i++) cin >> a[i];
sort(a.begin(), a.end());
if (aa[0] == 5 && aa[1] == 5 && aa[2] == 7) {
cout << "YES";
}
else cout << "NO";
}
|
a.cc: In function 'int main()':
a.cc:123:44: error: 'a' was not declared in this scope
123 | for (int i = 0; i < 3; i++) cin >> a[i];
| ^
a.cc:124:14: error: 'a' was not declared in this scope; did you mean 'aa'?
124 | sort(a.begin(), a.end());
| ^
| aa
|
s233186811
|
p04043
|
C++
|
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
#include<cmath>
#include<string>
#include<iomanip>
#include <numeric>
#include <limits>
using namespace std;
int main()
{
int a,b,c; cin>>a>>b>>c;
if((a+b+c)==17)cout<<"YES";
{
if(a==7||b==7||c==7){
if(a==5||b==5||c==5)
cout<<"YES";
else cout<<"NO"; }
else cout<<"NO";
}
else cout<<"NO";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:22:1: error: 'else' without a previous 'if'
22 | else cout<<"NO";
| ^~~~
|
s929683782
|
p04043
|
C++
|
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
#include<cmath>
#include<string>
#include<iomanip>
#include <numeric>
#include <limits>
using namespace std;
int main()
{
string a,b,c; cin>>a>>b>>c;
if((a+b+c)==17)cout<<"YES";
{
if(a==7||b==7||c==7){
if(a==5||b==5||c==5)
cout<<"YES";
else cout<<"NO"; }
else cout<<"NO";
}
else cout<<"NO";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:11: error: no match for 'operator==' (operand types are 'std::__cxx11::basic_string<char>' and 'int')
14 | if((a+b+c)==17)cout<<"YES";
| ~~~~~~~^~~~
| | |
| | int
| std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::pair<_T1, _T2>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::fpos<_StateT>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::allocator<_CharT>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637
|
s632833403
|
p04043
|
C++
|
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
#include<cmath>
#include<string>
#include<iomanip>
#include <numeric>
#include <limits>
using namespace std;
int main()
{
int a,b,c; cin>>a>>b>>c;
if((a+b+c)==17)cout<<"YES";
{
if(a==7||b==7||c==7)
if(a==5||b==5||c==5)
cout<<"YES";
else cout<<"NO";
else cout<<"NO";
}
else cout<<"NO";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:22:1: error: 'else' without a previous 'if'
22 | else cout<<"NO";
| ^~~~
|
s127375949
|
p04043
|
C++
|
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
#include<cmath>
#include<string>
#include<iomanip>
#include <numeric>
#include <limits>
using namespace std;
int main()
{
string a,b,c; cin>>a>>b>>c;
if((a+b+c)==17)cout<<"YES";
{
if(a==7||b==7||c==7)
if(a==5||b==5||c==5)
cout<<"YES";
else cout<<"NO";
else cout<<"NO";
}
else cout<<"NO";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:11: error: no match for 'operator==' (operand types are 'std::__cxx11::basic_string<char>' and 'int')
14 | if((a+b+c)==17)cout<<"YES";
| ~~~~~~~^~~~
| | |
| | int
| std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::pair<_T1, _T2>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::fpos<_StateT>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::allocator<_CharT>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:14:13: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
14 | if((a+b+c)==17)cout<<"YES";
| ^~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637
|
s530420827
|
p04043
|
C++
|
#include<iostream>
using namespace std;
int main(){
vector<int> num(3);
for(int i=0;i<3;i++){
cin>>num[i];
int a=0;
int b=0;
if(num[i]==5){a++;}
if(num[i]==7){b++;}}
if(a==2 && b==1){cout<<"YES";}
else cout<<"NO";
return 0;}
|
a.cc: In function 'int main()':
a.cc:4:3: error: 'vector' was not declared in this scope
4 | vector<int> num(3);
| ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
1 | #include<iostream>
+++ |+#include <vector>
2 | using namespace std;
a.cc:4:10: error: expected primary-expression before 'int'
4 | vector<int> num(3);
| ^~~
a.cc:6:8: error: 'num' was not declared in this scope; did you mean 'enum'?
6 | cin>>num[i];
| ^~~
| enum
a.cc:11:6: error: 'a' was not declared in this scope
11 | if(a==2 && b==1){cout<<"YES";}
| ^
a.cc:11:14: error: 'b' was not declared in this scope
11 | if(a==2 && b==1){cout<<"YES";}
| ^
|
s922162600
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C;
cin >> A >> B >> C;
if(A*B*C==175){
cout << "YES" << endl;
}
if else{
cout << "NO" << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:11:4: error: expected '(' before 'else'
11 | if else{
| ^~~~
| (
|
s427488061
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(A,B,C) {
int A,B,C,r;
cin >> A >> B >> C;
r==A*B*C;
if(r==175){
cout << "YES" << endl;
}
if else{
cout << "NO" << endl;
}
}
|
a.cc:4:5: error: cannot declare '::main' to be a global variable
4 | int main(A,B,C) {
| ^~~~
a.cc:4:10: error: 'A' was not declared in this scope
4 | int main(A,B,C) {
| ^
a.cc:4:12: error: 'B' was not declared in this scope
4 | int main(A,B,C) {
| ^
a.cc:4:14: error: 'C' was not declared in this scope
4 | int main(A,B,C) {
| ^
a.cc:4:15: error: expression list treated as compound expression in initializer [-fpermissive]
4 | int main(A,B,C) {
| ^
|
s771032522
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C,r;
cin >> A >> B >> C;
r==A*B*C;
if(r==175){
cout << "YES" << endl;
}
if else{
cout << "NO" << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:11:4: error: expected '(' before 'else'
11 | if else{
| ^~~~
| (
|
s491402797
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C,r;
cin >> A >> B >> C;
r==A*B*C
if(r==175){
cout << "YES" << endl;
}
if else{
cout << "NO" << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:7:10: error: expected ';' before 'if'
7 | r==A*B*C
| ^
| ;
8 | if(r==175){
| ~~
a.cc:11:4: error: expected '(' before 'else'
11 | if else{
| ^~~~
| (
|
s425851451
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C;
cin >> A >> B >> C;
r==A*B*C
if(r==175){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:7:2: error: 'r' was not declared in this scope
7 | r==A*B*C
| ^
a.cc:11:1: error: 'else' without a previous 'if'
11 | else{
| ^~~~
|
s362859980
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C;
cin >> A >> B >> C;
r=A*B*C
if(r==175){
cout << "YES" << endl;
}
else {
cout << "NO" << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:7:2: error: 'r' was not declared in this scope
7 | r=A*B*C
| ^
a.cc:11:1: error: 'else' without a previous 'if'
11 | else {
| ^~~~
|
s966949941
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C;
cin >> A >> B >> C;
r=A*B*C
if(r=145){
cout << "YES" << endl;
}
else {cout << "NO" << endl;}
}
|
a.cc: In function 'int main()':
a.cc:7:2: error: 'r' was not declared in this scope
7 | r=A*B*C
| ^
a.cc:11:1: error: 'else' without a previous 'if'
11 | else {cout << "NO" << endl;}
| ^~~~
|
s347867516
|
p04043
|
Java
|
pbulic boolean canMake575(String str){
String[] strArray = str.split(" ");
int countFive = 0;
int countSeven = 0;
for (int i = 0; i < strArray.length, i++) {
if (strArray.equals("5")) {
countFive++;
} else if (strArray.equals("7")) {
countSeven++;
}
}
if (countFive == 2 && countSeven == 1) {
return true;
}
return false;
}
|
Main.java:1: error: class, interface, enum, or record expected
pbulic boolean canMake575(String str){
^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
int countFive = 0;
^
(use --enable-preview to enable unnamed classes)
Main.java:5: error: class, interface, enum, or record expected
for (int i = 0; i < strArray.length, i++) {
^
Main.java:5: error: class, interface, enum, or record expected
for (int i = 0; i < strArray.length, i++) {
^
Main.java:8: error: class, interface, enum, or record expected
} else if (strArray.equals("7")) {
^
Main.java:10: error: class, interface, enum, or record expected
}
^
Main.java:15: error: class, interface, enum, or record expected
}
^
Main.java:17: error: class, interface, enum, or record expected
}
^
8 errors
|
s436497386
|
p04043
|
Java
|
// Created By Jefferson Samuel on 02/09/20 at 1:02 AM
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
public class C {
static ArrayList<String> lis = new ArrayList<>();
static void spacing(String sofar , String orig)
{
if(orig.length() ==0){
lis.add(sofar.trim());
}
else
{
sofar += orig.charAt(0);
spacing(sofar + " ", orig.substring(1));
spacing(sofar, orig.substring(1));
sofar = "";
}
}
static void solve() throws Exception {
int fc = 0 ,sc = 0;
for(int i = 0 ; i < 3;i++)
{
int f = scanInt();
if(f == 5) fc++;
else if(f == 7) sc ++;
}
out.println(fc == 2 && sc == 1 ? "YES":"NO");
}
//Dont touch this side
static int scanInt() throws IOException {
return parseInt(scanString());
}
static long scanLong() throws IOException {
return parseLong(scanString());
}
static String scanFullString() throws IOException{
return in.readLine();
}
static String scanString() throws IOException {
while (tok == null || !tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine());
}
return tok.nextToken();
}
static long pow(int a, int b)
{
if(b == 0) return 1;
long tmp = pow(a,b/2);
return tmp*tmp * (b%2 == 0 ? 1 : a);
}
static BufferedReader in;
static PrintWriter out;
static StringTokenizer tok;
public static void main(String[] args) {
try {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
solve();
in.close();
out.close();
} catch (Throwable e) {
e.printStackTrace();
exit(1);
}
}
}
|
Main.java:13: error: class C is public, should be declared in a file named C.java
public class C {
^
1 error
|
s896147128
|
p04043
|
C++
|
#include<iostream>
using namespace std;
int main(){
int a[3];
int d=0,e=0;
for(int i=0;i<3;i++){
cin>>a[i];
if(a[i]==5)
d++;
else
e++;
}
if(d==2&&e==1)
cout<<"YES";
eles
cout<<"NO";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:3: error: 'eles' was not declared in this scope
16 | eles
| ^~~~
|
s169406472
|
p04043
|
C++
|
#include <iostream>
using namespace std;
int main() {
int a;
int c5, c7 = 0;
for (int i=0;i<3;++i) {
cin >> a;
a == 5 ? c5++ : a == 7 ? c7++ : 0;
}
cout << (a5 == 2 && a7 == 1 ? "YES" : "NO") << endl;
}
|
a.cc: In function 'int main()':
a.cc:11:12: error: 'a5' was not declared in this scope; did you mean 'c5'?
11 | cout << (a5 == 2 && a7 == 1 ? "YES" : "NO") << endl;
| ^~
| c5
a.cc:11:23: error: 'a7' was not declared in this scope; did you mean 'c7'?
11 | cout << (a5 == 2 && a7 == 1 ? "YES" : "NO") << endl;
| ^~
| c7
|
s678287801
|
p04043
|
C++
|
#include <iostream>
using namespace std;
int main() {
int a;
int c5, c7 = 0;
for (int i=0;i<3;++i) {
cin >> a;
a == 5 ? ++c5 : a == 7 ? ++c7 : 0;
}
cout << (a5 == 2 && a7 == 1 ? "YES" : "NO") << endl;
}
|
a.cc: In function 'int main()':
a.cc:11:12: error: 'a5' was not declared in this scope; did you mean 'c5'?
11 | cout << (a5 == 2 && a7 == 1 ? "YES" : "NO") << endl;
| ^~
| c5
a.cc:11:23: error: 'a7' was not declared in this scope; did you mean 'c7'?
11 | cout << (a5 == 2 && a7 == 1 ? "YES" : "NO") << endl;
| ^~
| c7
|
s503508474
|
p04043
|
C++
|
#include <iostream>
using namespace std;
int main() {
int a;
int c5, c7 = 0;
for (int i=0;i<3;++i) {
cin >> a;
a == 5 ? ++c5 : a == 7 ? ++c7 : 0;
}
cout << a5 == 2 && a7 == 1 ? "YES" : "NO" << endl;
}
|
a.cc: In function 'int main()':
a.cc:11:11: error: 'a5' was not declared in this scope; did you mean 'c5'?
11 | cout << a5 == 2 && a7 == 1 ? "YES" : "NO" << endl;
| ^~
| c5
a.cc:11:22: error: 'a7' was not declared in this scope; did you mean 'c7'?
11 | cout << a5 == 2 && a7 == 1 ? "YES" : "NO" << endl;
| ^~
| c7
a.cc:11:45: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
11 | cout << a5 == 2 && a7 == 1 ? "YES" : "NO" << endl;
| ~~~~~^~~~~~~
|
s940305273
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
char a,b,c;
cin >> a >> b >> c;
string s = a+b+c;
if(s=="557" || s=="575" || s=="755")
cout << "YES" << endl;
else
cout << "NO" <<endl;
}
|
a.cc: In function 'int main()':
a.cc:7:17: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
7 | string s = a+b+c;
| ~~~^~
|
s161041421
|
p04043
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
char a,b,c;
cin >> a >> b >> c;
string s = a+b+c;
if(s=="557" || s=="575" || s=="755")
cout << "YES" << endl;
else
cout << "NO" <<endl;
}
|
a.cc: In function 'int main()':
a.cc:7:17: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
7 | string s = a+b+c;
| ~~~^~
|
s834948486
|
p04043
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,d=0, e=0;
for(int i=0; i<3; i++){
cin>>a;
if(a==5)d++;
if(a==7)e++;}
if(a==2 and e=1)cout<<"YES";
else cout<<"NO";}
|
a.cc: In function 'int main()':
a.cc:9:11: error: lvalue required as left operand of assignment
9 | if(a==2 and e=1)cout<<"YES";
| ~~~~~^~~~~
|
s830709686
|
p04043
|
Java
|
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String [] args)
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String [] anArray = reader.readLine().split(" ");
int counterFor7 = 0;
int counterFor5 = 0;
for(int i = 0; i < anArray.length; i++)
{
if(Integer.parseInt(anArray[i]) == 7)
{
counterFor7++;
}
else if(Integer.parseInt(anArray[i]) == 5)
{
counterFor5++;
}
}
if(counterFor7 == 2 && counterFor5 == 1)
{
System.out.println("Yes");
}
else
{
System.out.println("No");
}
}
}
|
Main.java:9: error: unreported exception IOException; must be caught or declared to be thrown
String [] anArray = reader.readLine().split(" ");
^
1 error
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.