submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s651179176
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = uint64_t;
using uint = uint32_t;
using pcc = pair<char, char>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using tuplis = array<ll, 3>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
const ll LINF=0x1fffffffffffffff;
const ll MINF=0x7fffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
const int MODD=998244353;
const ld DINF=numeric_limits<ld>::infinity();
const ld EPS=1e-9;
const ld PI=3.1415926535897932;
const ll dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
const ll dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
#define overload4(_1,_2,_3,_4,name,...) name
#define overload3(_1,_2,_3,name,...) name
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i=(n);i--;)
#define rrep2(i,n) for(ll i=(n);i--;)
#define rrep3(i,a,b) for(ll i=(b);i-->(a);)
#define rrep4(i,a,b,c) for(ll i=a+(b-a-1)/c*c;i>=a;i-=c)
#define rrep(...) overload4(__VA_ARGS__,rrep4,rrep3,rrep2,rrep1)(__VA_ARGS__)
#define each(i,a) for(auto&& i:a)
#define all1(i) begin(i),end(i)
#define all2(i,a) begin(i),begin(i)+a
#define all3(i,a,b) begin(i)+a,begin(i)+b
#define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__)
#define rall1(i) (i).rbegin(),(i).rend()
#define rall2(i,k) (i).rbegin(),(i).rbegin()+k
#define rall3(i,a,b) (i).rbegin()+a,(i).rbegin()+b
#define rall(...) overload3(__VA_ARGS__,rall3,rall2,rall1)(__VA_ARGS__)
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define elif else if
#define unless(a) if(!(a))
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
#define Sort(a) sort(all(a))
#define Rev(a) reverse(all(a))
#define Uniq(a) sort(all(a));a.erase(unique(all(a)),end(a))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }
inline ll popcnt(ull a){ return __builtin_popcountll(a); }
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
template<class T, class U> bool chmin(T& a, const U& b){ if(a > b){ a = b; return 1; } return 0; }
template<class T, class U> bool chmax(T& a, const U& b){ if(a < b){ a = b; return 1; } return 0; }
vector<ll> iota(ll n){ vector<ll> a(n); iota(a.begin(), a.end(), 0); return a; }
vector<pll> factor(ull x){ vector<pll> ans; for(ll i = 2; i * i <= x; i++) if(x % i == 0){ ans.push_back({i, 1}); while((x /= i) % i == 0) ans.back().second++; } if(x != 1) ans.push_back({x, 1}); return ans; }
map<ll,ll> factor_map(ull x){ map<ll,ll> ans; for(ll i = 2; i * i <= x; i++) if(x % i == 0){ ans[i] = 1; while((x /= i) % i == 0) ans[i]++; } if(x != 1) ans[x] = 1; return ans; }
vector<uint> divisor(uint x){ vector<uint> ans; for(uint i = 1; i * i <= x; i++) if(x % i == 0) ans.push_back(i); rrep(ans.size() - (ans.back() * ans.back() == x)) ans.push_back(x / ans[i]); return ans; }
template<class T> unordered_map<T, ll> press(vector<T>& a){ auto b = a; sort(all(b)); b.erase(unique(all(b)), b.end()); unordered_map<T, ll> ans; rep(b.size()) ans[b[i]] = i; each(i, a) i = ans[i]; return ans; }
template<class T> map<T, ll> press_map(vector<T>& a){ auto b = a; sort(all(b)); b.erase(unique(all(b)), b.end()); map<T, ll> ans; rep(b.size()) ans[b[i]] = i; each(i, a) i = ans[i]; return ans; }
int scan(){ return getchar(); }
void scan(int& a){ scanf("%d", &a); }
void scan(unsigned& a){ scanf("%u", &a); }
void scan(long& a){ scanf("%ld", &a); }
void scan(long long& a){ scanf("%lld", &a); }
void scan(unsigned long long& a){ scanf("%llu", &a); }
void scan(char& a){ do{ a = getchar(); }while(a == ' ' || a == '\n'); }
void scan(float& a){ scanf("%f", &a); }
void scan(double& a){ scanf("%lf", &a); }
void scan(long double& a){ scanf("%Lf", &a); }
void scan(vector<bool>& a){ for(unsigned i = 0; i < a.size(); i++){ int b; scan(b); a[i] = b; } }
void scan(char a[]){ scanf("%s", a); }
void scan(string& a){ cin >> a; }
template<class T> void scan(vector<T>&);
template<class T, size_t size> void scan(array<T, size>&);
template<class T, class L> void scan(pair<T, L>&);
template<class T, size_t size> void scan(T(&)[size]);
template<class T> void scan(vector<T>& a){ for(auto&& i : a) scan(i); }
template<class T> void scan(deque<T>& a){ for(auto&& i : a) scan(i); }
template<class T, size_t size> void scan(array<T, size>& a){ for(auto&& i : a) scan(i); }
template<class T, class L> void scan(pair<T, L>& p){ scan(p.first); scan(p.second); }
template<class T, size_t size> void scan(T (&a)[size]){ for(auto&& i : a) scan(i); }
template<class T> void scan(T& a){ cin >> a; }
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){ scan(head); in(tail...); }
void print(){ putchar(' '); }
void print(bool a){ printf("%d", a); }
void print(int a){ printf("%d", a); }
void print(unsigned a){ printf("%u", a); }
void print(long a){ printf("%ld", a); }
void print(long long a){ printf("%lld", a); }
void print(unsigned long long a){ printf("%llu", a); }
void print(char a){ printf("%c", a); }
void print(char a[]){ printf("%s", a); }
void print(const char a[]){ printf("%s", a); }
void print(float a){ printf("%.15f", a); }
void print(double a){ printf("%.15f", a); }
void print(long double a){ printf("%.15Lf", a); }
void print(const string& a){ for(auto&& i : a) print(i); }
template<class T> void print(const vector<T>&);
template<class T, size_t size> void print(const array<T, size>&);
template<class T, class L> void print(const pair<T, L>& p);
template<class T, size_t size> void print(const T (&)[size]);
template<class T> void print(const vector<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T> void print(const deque<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T, size_t size> void print(const array<T, size>& a){ print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T, class L> void print(const pair<T, L>& p){ print(p.first); putchar(' '); print(p.second); }
template<class T, size_t size> void print(const T (&a)[size]){ print(a[0]); for(auto i = a; ++i != end(a); ){ putchar(' '); print(*i); } }
template<class T> void print(const T& a){ cout << a; }
int out(){ putchar('\n'); return 0; }
template<class T> int out(const T& t){ print(t); putchar('\n'); return 0; }
template<class Head, class... Tail> int out(const Head& head, const Tail&... tail){ print(head); putchar(' '); out(tail...); return 0; }
#ifdef DEBUG
inline int __lg(int __n){ return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
#define debug(...) { print(#__VA_ARGS__); print(":"); out(__VA_ARGS__); }
#else
#define debug(...) void(0)
#endif
int first(bool i = true){ return out(i?"first":"second"); }
int yes(bool i = true){ return out(i?"yes":"no"); }
int Yes(bool i = true){ return out(i?"Yes":"No"); }
int No(){ return out("No"); }
int YES(bool i = true){ return out(i?"YES":"NO"); }
int NO(){ return out("NO"); }
int Yay(bool i = true){ return out(i?"Yay!":":("); }
int possible(bool i = true){ return out(i?"possible":"impossible"); }
int Possible(bool i = true){ return out(i?"Possible":"Impossible"); }
int POSSIBLE(bool i = true){ return out(i?"POSSIBLE":"IMPOSSIBLE"); }
void Case(ll i){ printf("Case #%lld: ", i); }
constexpr uint mod = MOD;
struct Modint{
uint num = 0;
constexpr Modint() noexcept {}
constexpr Modint(const Modint &x) noexcept : num(x.num){}
inline constexpr operator ll() const noexcept { return num; }
inline constexpr Modint& operator+=(Modint x) noexcept { num += x.num; if(num >= mod) num -= mod; return *this; }
inline constexpr Modint& operator++() noexcept { if(num == mod - 1) num = 0; else num++; return *this; }
inline constexpr Modint operator++(int) noexcept { Modint ans(*this); operator++(); return ans; }
inline constexpr Modint operator-() const noexcept { return Modint(0) -= *this; }
inline constexpr Modint operator-(Modint x) const noexcept { return Modint(*this) -= x; }
inline constexpr Modint& operator-=(Modint x) noexcept { if(num < x.num) num += mod; num -= x.num; return *this; }
inline constexpr Modint& operator--() noexcept { if(num == 0) num = mod - 1; else num--; return *this; }
inline constexpr Modint operator--(int) noexcept { Modint ans(*this); operator--(); return ans; }
inline constexpr Modint& operator*=(Modint x) noexcept { num = ull(num) * x.num % mod; return *this; }
inline constexpr Modint& operator/=(Modint x) noexcept { return operator*=(x.inv()); }
template<class T> constexpr Modint(T x) noexcept {
using U = typename conditional<sizeof(T) >= 4, T, int>::type;
U y = x; y %= U(mod); if(y < 0) y += mod; num = uint(y);
}
template<class T> inline constexpr Modint operator+(T x) const noexcept { return Modint(*this) += x; }
template<class T> inline constexpr Modint& operator+=(T x) noexcept { return operator+=(Modint(x)); }
template<class T> inline constexpr Modint operator-(T x) const noexcept { return Modint(*this) -= x; }
template<class T> inline constexpr Modint& operator-=(T x) noexcept { return operator-=(Modint(x)); }
template<class T> inline constexpr Modint operator*(T x) const noexcept { return Modint(*this) *= x; }
template<class T> inline constexpr Modint& operator*=(T x) noexcept { return operator*=(Modint(x)); }
template<class T> inline constexpr Modint operator/(T x) const noexcept { return Modint(*this) /= x; }
template<class T> inline constexpr Modint& operator/=(T x) noexcept { return operator/=(Modint(x)); }
inline constexpr Modint inv() const noexcept { ll x = 0, y = 0; extgcd(num, mod, x, y); return x; }
static inline constexpr ll extgcd(ll a, ll b, ll &x, ll &y) noexcept { ll g = a; x = 1; y = 0; if(b){ g = extgcd(b, a % b, y, x); y -= a / b * x; } return g; }
inline constexpr Modint pow(ull x) const noexcept { Modint ans = 1, cnt = *this; while(x){ if(x & 1) ans *= cnt; cnt *= cnt; x /= 2; } return ans; }
};
std::istream& operator>>(std::istream& is, Modint& x){ ll a; in(a); x = a; return is; }
inline constexpr Modint operator""_M(ull x) noexcept { return Modint(x); }
std::vector<Modint> fac(1, 1), inv(1, 1);
inline void reserve(ll a){
if(fac.size() >= a) return;
if(a < fac.size() * 2) a = fac.size() * 2;
if(a >= mod) a = mod;
while(fac.size() < a) fac.push_back(fac.back() * Modint(fac.size()));
inv.resize(fac.size());
inv.back() = fac.back().inv();
for(ll i = inv.size() - 1; !inv[i - 1]; i--) inv[i - 1] = inv[i] * i;
}
inline Modint fact(ll n){ if(n < 0) return 0; reserve(n + 1); return fac[n]; }
inline Modint perm(ll n, ll r){
if(r < 0 || n < r) return 0;
if(n >> 24){ Modint ans = 1; for(ll i = 0; i < r; i++) ans *= n--; return ans; }
reserve(n + 1); return fac[n] * inv[n - r];
}
inline Modint comb(ll n, ll r){ if(r < 0 || n < r) return 0; reserve(r + 1); return perm(n, r) * inv[r]; }
inline Modint Mcomb(ll n, ll r){ return comb(n + r - 1, n - 1); } // r balls into n boxes
inline Modint catalan(ll n){ reserve(n * 2 + 1); return fac[n * 2] * inv[n] * inv[n + 1]; }
signed main(){
LL(h,w,a,b);
Modint ans=0;
rep(h-a){
ans+=comb(i+b-1,b-1)*comb(w-b-1+h-i-1,w-b-1);
}
out(ans);
}
|
a.cc:185:25: error: 'constexpr Modint operator""_M(ull)' has invalid argument list
185 | inline constexpr Modint operator""_M(ull x) noexcept { return Modint(x); }
| ^~~~~~~~
|
s230458927
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
using ull = uint64_t;
using uint = uint32_t;
using pcc = pair<char, char>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using tuplis = array<ll, 3>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
const ll LINF=0x1fffffffffffffff;
const ll MINF=0x7fffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
const int MODD=998244353;
const ld DINF=numeric_limits<ld>::infinity();
const ld EPS=1e-9;
const ld PI=3.1415926535897932;
const ll dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
const ll dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
#define overload4(_1,_2,_3,_4,name,...) name
#define overload3(_1,_2,_3,name,...) name
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i=(n);i--;)
#define rrep2(i,n) for(ll i=(n);i--;)
#define rrep3(i,a,b) for(ll i=(b);i-->(a);)
#define rrep4(i,a,b,c) for(ll i=a+(b-a-1)/c*c;i>=a;i-=c)
#define rrep(...) overload4(__VA_ARGS__,rrep4,rrep3,rrep2,rrep1)(__VA_ARGS__)
#define each(i,a) for(auto&& i:a)
#define all1(i) begin(i),end(i)
#define all2(i,a) begin(i),begin(i)+a
#define all3(i,a,b) begin(i)+a,begin(i)+b
#define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__)
#define rall1(i) (i).rbegin(),(i).rend()
#define rall2(i,k) (i).rbegin(),(i).rbegin()+k
#define rall3(i,a,b) (i).rbegin()+a,(i).rbegin()+b
#define rall(...) overload3(__VA_ARGS__,rall3,rall2,rall1)(__VA_ARGS__)
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define elif else if
#define unless(a) if(!(a))
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
#define Sort(a) sort(all(a))
#define Rev(a) reverse(all(a))
#define Uniq(a) sort(all(a));a.erase(unique(all(a)),end(a))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }
inline ll popcnt(ull a){ return __builtin_popcountll(a); }
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
template<class T, class U> bool chmin(T& a, const U& b){ if(a > b){ a = b; return 1; } return 0; }
template<class T, class U> bool chmax(T& a, const U& b){ if(a < b){ a = b; return 1; } return 0; }
vector<ll> iota(ll n){ vector<ll> a(n); iota(a.begin(), a.end(), 0); return a; }
vector<pll> factor(ull x){ vector<pll> ans; for(ll i = 2; i * i <= x; i++) if(x % i == 0){ ans.push_back({i, 1}); while((x /= i) % i == 0) ans.back().second++; } if(x != 1) ans.push_back({x, 1}); return ans; }
map<ll,ll> factor_map(ull x){ map<ll,ll> ans; for(ll i = 2; i * i <= x; i++) if(x % i == 0){ ans[i] = 1; while((x /= i) % i == 0) ans[i]++; } if(x != 1) ans[x] = 1; return ans; }
vector<uint> divisor(uint x){ vector<uint> ans; for(uint i = 1; i * i <= x; i++) if(x % i == 0) ans.push_back(i); rrep(ans.size() - (ans.back() * ans.back() == x)) ans.push_back(x / ans[i]); return ans; }
template<class T> unordered_map<T, ll> press(vector<T>& a){ auto b = a; sort(all(b)); b.erase(unique(all(b)), b.end()); unordered_map<T, ll> ans; rep(b.size()) ans[b[i]] = i; each(i, a) i = ans[i]; return ans; }
template<class T> map<T, ll> press_map(vector<T>& a){ auto b = a; sort(all(b)); b.erase(unique(all(b)), b.end()); map<T, ll> ans; rep(b.size()) ans[b[i]] = i; each(i, a) i = ans[i]; return ans; }
int scan(){ return getchar(); }
void scan(int& a){ scanf("%d", &a); }
void scan(unsigned& a){ scanf("%u", &a); }
void scan(long& a){ scanf("%ld", &a); }
void scan(long long& a){ scanf("%lld", &a); }
void scan(unsigned long long& a){ scanf("%llu", &a); }
void scan(char& a){ do{ a = getchar(); }while(a == ' ' || a == '\n'); }
void scan(float& a){ scanf("%f", &a); }
void scan(double& a){ scanf("%lf", &a); }
void scan(long double& a){ scanf("%Lf", &a); }
void scan(vector<bool>& a){ for(unsigned i = 0; i < a.size(); i++){ int b; scan(b); a[i] = b; } }
void scan(char a[]){ scanf("%s", a); }
void scan(string& a){ cin >> a; }
template<class T> void scan(vector<T>&);
template<class T, size_t size> void scan(array<T, size>&);
template<class T, class L> void scan(pair<T, L>&);
template<class T, size_t size> void scan(T(&)[size]);
template<class T> void scan(vector<T>& a){ for(auto&& i : a) scan(i); }
template<class T> void scan(deque<T>& a){ for(auto&& i : a) scan(i); }
template<class T, size_t size> void scan(array<T, size>& a){ for(auto&& i : a) scan(i); }
template<class T, class L> void scan(pair<T, L>& p){ scan(p.first); scan(p.second); }
template<class T, size_t size> void scan(T (&a)[size]){ for(auto&& i : a) scan(i); }
template<class T> void scan(T& a){ cin >> a; }
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){ scan(head); in(tail...); }
void print(){ putchar(' '); }
void print(bool a){ printf("%d", a); }
void print(int a){ printf("%d", a); }
void print(unsigned a){ printf("%u", a); }
void print(long a){ printf("%ld", a); }
void print(long long a){ printf("%lld", a); }
void print(unsigned long long a){ printf("%llu", a); }
void print(char a){ printf("%c", a); }
void print(char a[]){ printf("%s", a); }
void print(const char a[]){ printf("%s", a); }
void print(float a){ printf("%.15f", a); }
void print(double a){ printf("%.15f", a); }
void print(long double a){ printf("%.15Lf", a); }
void print(const string& a){ for(auto&& i : a) print(i); }
template<class T> void print(const vector<T>&);
template<class T, size_t size> void print(const array<T, size>&);
template<class T, class L> void print(const pair<T, L>& p);
template<class T, size_t size> void print(const T (&)[size]);
template<class T> void print(const vector<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T> void print(const deque<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T, size_t size> void print(const array<T, size>& a){ print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T, class L> void print(const pair<T, L>& p){ print(p.first); putchar(' '); print(p.second); }
template<class T, size_t size> void print(const T (&a)[size]){ print(a[0]); for(auto i = a; ++i != end(a); ){ putchar(' '); print(*i); } }
template<class T> void print(const T& a){ cout << a; }
int out(){ putchar('\n'); return 0; }
template<class T> int out(const T& t){ print(t); putchar('\n'); return 0; }
template<class Head, class... Tail> int out(const Head& head, const Tail&... tail){ print(head); putchar(' '); out(tail...); return 0; }
#ifdef DEBUG
inline int __lg(int __n){ return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
#define debug(...) { print(#__VA_ARGS__); print(":"); out(__VA_ARGS__); }
#else
#define debug(...) void(0)
#endif
int first(bool i = true){ return out(i?"first":"second"); }
int yes(bool i = true){ return out(i?"yes":"no"); }
int Yes(bool i = true){ return out(i?"Yes":"No"); }
int No(){ return out("No"); }
int YES(bool i = true){ return out(i?"YES":"NO"); }
int NO(){ return out("NO"); }
int Yay(bool i = true){ return out(i?"Yay!":":("); }
int possible(bool i = true){ return out(i?"possible":"impossible"); }
int Possible(bool i = true){ return out(i?"Possible":"Impossible"); }
int POSSIBLE(bool i = true){ return out(i?"POSSIBLE":"IMPOSSIBLE"); }
void Case(ll i){ printf("Case #%lld: ", i); }
constexpr uint mod = MOD;
struct Modint{
uint num = 0;
constexpr Modint() noexcept {}
constexpr Modint(const Modint &x) noexcept : num(x.num){}
inline constexpr operator ll() const noexcept { return num; }
inline constexpr Modint& operator+=(Modint x) noexcept { num += x.num; if(num >= mod) num -= mod; return *this; }
inline constexpr Modint& operator++() noexcept { if(num == mod - 1) num = 0; else num++; return *this; }
inline constexpr Modint operator++(int) noexcept { Modint ans(*this); operator++(); return ans; }
inline constexpr Modint operator-() const noexcept { return Modint(0) -= *this; }
inline constexpr Modint operator-(Modint x) const noexcept { return Modint(*this) -= x; }
inline constexpr Modint& operator-=(Modint x) noexcept { if(num < x.num) num += mod; num -= x.num; return *this; }
inline constexpr Modint& operator--() noexcept { if(num == 0) num = mod - 1; else num--; return *this; }
inline constexpr Modint operator--(int) noexcept { Modint ans(*this); operator--(); return ans; }
inline constexpr Modint& operator*=(Modint x) noexcept { num = ull(num) * x.num % mod; return *this; }
inline constexpr Modint& operator/=(Modint x) noexcept { return operator*=(x.inv()); }
template<class T> constexpr Modint(T x) noexcept {
using U = typename conditional<sizeof(T) >= 4, T, int>::type;
U y = x; y %= U(mod); if(y < 0) y += mod; num = uint(y);
}
template<class T> inline constexpr Modint operator+(T x) const noexcept { return Modint(*this) += x; }
template<class T> inline constexpr Modint& operator+=(T x) noexcept { return operator+=(Modint(x)); }
template<class T> inline constexpr Modint operator-(T x) const noexcept { return Modint(*this) -= x; }
template<class T> inline constexpr Modint& operator-=(T x) noexcept { return operator-=(Modint(x)); }
template<class T> inline constexpr Modint operator*(T x) const noexcept { return Modint(*this) *= x; }
template<class T> inline constexpr Modint& operator*=(T x) noexcept { return operator*=(Modint(x)); }
template<class T> inline constexpr Modint operator/(T x) const noexcept { return Modint(*this) /= x; }
template<class T> inline constexpr Modint& operator/=(T x) noexcept { return operator/=(Modint(x)); }
inline constexpr Modint inv() const noexcept { ll x = 0, y = 0; extgcd(num, mod, x, y); return x; }
static inline constexpr ll extgcd(ll a, ll b, ll &x, ll &y) noexcept { ll g = a; x = 1; y = 0; if(b){ g = extgcd(b, a % b, y, x); y -= a / b * x; } return g; }
inline constexpr Modint pow(ull x) const noexcept { Modint ans = 1, cnt = *this; while(x){ if(x & 1) ans *= cnt; cnt *= cnt; x /= 2; } return ans; }
};
std::istream& operator>>(std::istream& is, Modint& x){ ll a; in(a); x = a; return is; }
inline constexpr Modint operator""_M(ull x) noexcept { return Modint(x); }
std::vector<Modint> fac(1, 1), inv(1, 1);
inline void reserve(ll a){
if(fac.size() >= a) return;
if(a < fac.size() * 2) a = fac.size() * 2;
if(a >= mod) a = mod;
while(fac.size() < a) fac.push_back(fac.back() * Modint(fac.size()));
inv.resize(fac.size());
inv.back() = fac.back().inv();
for(ll i = inv.size() - 1; !inv[i - 1]; i--) inv[i - 1] = inv[i] * i;
}
inline Modint fact(ll n){ if(n < 0) return 0; reserve(n + 1); return fac[n]; }
inline Modint perm(ll n, ll r){
if(r < 0 || n < r) return 0;
if(n >> 24){ Modint ans = 1; for(ll i = 0; i < r; i++) ans *= n--; return ans; }
reserve(n + 1); return fac[n] * inv[n - r];
}
inline Modint comb(ll n, ll r){ if(r < 0 || n < r) return 0; reserve(r + 1); return perm(n, r) * inv[r]; }
inline Modint Mcomb(ll n, ll r){ return comb(n + r - 1, n - 1); } // r balls into n boxes
inline Modint catalan(ll n){ reserve(n * 2 + 1); return fac[n * 2] * inv[n] * inv[n + 1]; }
signed main(){
LL(h,w,a,b);
Modint ans=0;
rep(h-a){
ans+=comb(i+b-1,b-1)*comb(w-b-1+h-i-1,w-b-1);
}
out(ans);
}
|
a.cc:185:25: error: 'constexpr Modint operator""_M(ull)' has invalid argument list
185 | inline constexpr Modint operator""_M(ull x) noexcept { return Modint(x); }
| ^~~~~~~~
|
s087850185
|
p04046
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define mod 1e9+7
int main()
{
int h,w,a,b;
cin>>h>>w>>a>>b;
int dp[h][w];
memset(dp,-1,sizeof(dp));
for (int i=h-a;i<h;i++)
{
for (int j=0;j<b;j++)
{
dp[i][j]=0;
}
}
for (int i=0;i<h;i++)
{
if (dp[i][0]==-1)
{
dp[i][0]=1;
}
}
for (int i=0;i<w;i++)
{
dp[0][i]=1;
}
for (int i=1;i<h;i++)
{
for (int j=1;j<w;j++)
{
if (dp[i][j]!=0)
{
dp[i][j]=((dp[i-1][j]%mod)+(dp[i][j-1]%mod))%mod;
}
}
}
cout<<dp[h-1][w-1];
}
|
a.cc: In function 'int main()':
a.cc:35:30: error: invalid operands of types 'int' and 'double' to binary 'operator%'
35 | dp[i][j]=((dp[i-1][j]%mod)+(dp[i][j-1]%mod))%mod;
| ~~~~~~~~~~^
| |
| int
a.cc:35:47: error: invalid operands of types 'int' and 'double' to binary 'operator%'
35 | dp[i][j]=((dp[i-1][j]%mod)+(dp[i][j-1]%mod))%mod;
| ~~~~~~~~~~^
| |
| int
|
s863362045
|
p04046
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
int h,w,a,b;
int dp[h][w];
memset(dp,-1,sizeof(dp));
for (int i=h-a;i<h;i++)
{
for (int j=0;j<b;j++)
{
dp[i][j]=0;
}
}
for (int i=0;i<h;i++)
{
if (dp[i][0]==-1)
{
dp[i][0]=1;
}
}
for (int i=0;i<w;i++)
{
dp[0][i]=1;
}
for (int i=1;i<h;i++)
{
for (int j=1;j<w;j++)
{
if (dp[i][j]!=0)
{
dp[i][j]=dp[i-1][j]+dp[i][j-1];
}
}
}
cout<<dp[h-1][w-1];
|
a.cc: In function 'int main()':
a.cc:36:22: error: expected '}' at end of input
36 | cout<<dp[h-1][w-1];
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s649583159
|
p04046
|
C
|
#include<cstdio>
int maze[42][42];
bool flag[42][42];
int main()
{
int h,w,a,b;
scanf("%d %d %d %d",&h,&w,&a,&b);
if(h==a) // If you can not go and end points coincide, it outputs 0
{
printf("0\n");
return 0;
}
flag[1][1]=1;// End Marker, that they can not go
for(int i=h-a+1;i<=h;i++)
{
for(int j=1;j<=b;j++) // will not go area assigned to 1
{
flag[i][j]=1;
}
}
for(int i=1;i<=h;i++)
{
for(int j=1;j<=w;j++)
{
if(flag[i][j]==1) // If this point can not go, this point will be assigned to the program number 0
maze[i][j]=0;
else if(i==1||j==1) // consider boundary
maze[i][j]=1;
else
maze[i][j]=(maze[i-1][j]+maze[i][j-1])%1000000007;
// recursive walked the walk each point, then modulo
}
}
printf("%d\n",maze[h][w]%1000000007);
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s993990003
|
p04046
|
C++
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoder.Tool;
using static AtCoder.CalcL;
namespace AtCoder
{
class AC
{
const int MOD = 1000000007;
//const int MOD = 998244353;
const int INF = int.MaxValue / 2;
const long SINF = long.MaxValue / 2;
const double EPS = 1e-8;
static readonly int[] dI = { 0, 1, 0, -1 };
static readonly int[] dJ = { 1, 0, -1, 0 };
//static List<List<int>> G = new List<List<int>>();
//static List<List<Edge>>G = new List<List<Edge>>();
//static List<Edge> E = new List<Edge>();
static void Main(string[] args)
{
//var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
//Console.SetOut(sw);
var cin = new Scanner();
var input = cin.ReadSplitInt();
int H = input[0];
int W = input[1];
int A = input[2];
int B = input[3];
long ans = 0;
long prev = 0;
var md = new Modulo(200010);
for(var i = 0; i < H - A; i++)
{
ans += md.Mul(((md.Ncr(i + B, i) - prev + MOD) % MOD), md.Ncr(W - 1 - B + (H - 1 - i), (H - 1 - i)));
ans %= MOD;
prev = md.Ncr(i + B, i);
}
Console.WriteLine(ans);
//Console.Out.Flush();
}
struct Edge
{
public int from;
public int to;
public long dist;
public Edge(int t, long c)
{
from = -1;
to = t;
dist = c;
}
public Edge(int f, int t, long c)
{
from = f;
to = t;
dist = c;
}
}
}
public class Scanner
{
public int[] ReadSplitInt()
{
return ConvertAll(Console.ReadLine().Split(), int.Parse);
}
public long[] ReadSplitLong()
{
return ConvertAll(Console.ReadLine().Split(), long.Parse);
}
public double[] ReadSplit_Double()
{
return ConvertAll(Console.ReadLine().Split(), double.Parse);
}
}
public static class Tool
{
static public void Initialize<T>(ref T[] array, T initialvalue)
{
for (var i = 0; i < array.Length; i++)
{
array[i] = initialvalue;
}
}
static public void Swap<T>(ref T a, ref T b)
{
T keep = a;
a = b;
b = keep;
}
static public void Display<T>(T[,] array2d, int n, int m)
{
for (var i = 0; i < n; i++)
{
for (var j = 0; j < m; j++)
{
Console.Write($"{array2d[i, j]} ");
}
Console.WriteLine();
}
}
static public long LPow(int a, int b)
{
return (long)Pow(a, b);
}
}
static public class CalcI
{
public static int Gcd(int a, int b)
{
if (a * b == 0) { return Max(a, b); }
return a % b == 0 ? b : Gcd(b, a % b);
}
public static int Lcm(int a, int b)
{
int g = Gcd(a, b);
return a / g * b;
}
public static int Ceil(int n, int div)
{
return (n + div - 1) / div;
}
}
static public class CalcL
{
public static long Gcd(long a, long b)
{
if (a * b == 0) { return Max(a, b); }
return a % b == 0 ? b : Gcd(b, a % b);
}
public static long Lcm(long a, long b)
{
long g = Gcd(a, b);
return a / g * b;
}
public static long Ceil(long n, long div)
{
return (n + div - 1) / div;
}
}
class Modulo
{
private const long M = 1000000007;
//private const int M = 998244353;
private readonly long[] m_facs;
public long Mul(long a, long b)
{
return ((a * b) % M);
}
public Modulo(long n)
{
m_facs = new long[n + 1];
m_facs[0] = 1;
for (long i = 1; i <= n; ++i)
{
m_facs[i] = Mul(m_facs[i - 1], i);
}
}
public long Fac(long n)
{
return m_facs[n];
}
public long Pow(long a, long m)
{
switch (m)
{
case 0:
return 1L;
case 1:
return a;
default:
long p1 = Pow(a, m / 2);
long p2 = Mul(p1, p1);
return ((m % 2) == 0) ? p2 : Mul(p2, a);
}
}
public long Div(long a, long b)
{
return Mul(a, Pow(b, M - 2));
}
public long Ncr(long n, long r)
{
if (n < r) { return 0; }
if (n == r) { return 1; }
long res = Fac(n);
res = Div(res, Fac(r));
res = Div(res, Fac(n - r));
return res;
}
public Modulo() { }
}
}
|
a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.IO;
| ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
5 | using System.Text;
| ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'static'
6 | using static System.Math;
| ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'static'
7 | using static System.Array;
| ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'static'
8 | using static AtCoder.Tool;
| ^~~~~~
a.cc:9:7: error: expected nested-name-specifier before 'static'
9 | using static AtCoder.CalcL;
| ^~~~~~
a.cc:19:16: error: 'readonly' does not name a type
19 | static readonly int[] dI = { 0, 1, 0, -1 };
| ^~~~~~~~
a.cc:20:16: error: 'readonly' does not name a type
20 | static readonly int[] dJ = { 1, 0, -1, 0 };
| ^~~~~~~~
a.cc:24:26: error: 'string' has not been declared
24 | static void Main(string[] args)
| ^~~~~~
a.cc:24:35: error: expected ',' or '...' before 'args'
24 | static void Main(string[] args)
| ^~~~
a.cc:50:19: error: expected ':' before 'int'
50 | public int from;
| ^~~~
| :
a.cc:52:19: error: expected ':' before 'int'
52 | public int to;
| ^~~~
| :
a.cc:53:19: error: expected ':' before 'long'
53 | public long dist;
| ^~~~~
| :
a.cc:54:19: error: expected ':' before 'Edge'
54 | public Edge(int t, long c)
| ^~~~~
| :
a.cc:60:19: error: expected ':' before 'Edge'
60 | public Edge(int f, int t, long c)
| ^~~~~
| :
a.cc:67:10: error: expected ';' after struct definition
67 | }
| ^
| ;
a.cc:68:6: error: expected ';' after class definition
68 | }
| ^
| ;
a.cc:16:25: error: expected primary-expression before 'int'
16 | const int INF = int.MaxValue / 2;
| ^~~
a.cc:17:27: error: expected primary-expression before 'long'
17 | const long SINF = long.MaxValue / 2;
| ^~~~
a.cc: In static member function 'static void AtCoder::AC::Main(int*)':
a.cc:28:13: error: 'var' was not declared in this scope
28 | var cin = new Scanner();
| ^~~
a.cc:30:17: error: expected ';' before 'input'
30 | var input = cin.ReadSplitInt();
| ^~~~~
a.cc:31:21: error: 'input' was not declared in this scope; did you mean 'int'?
31 | int H = input[0];
| ^~~~~
| int
a.cc:37:17: error: expected ';' before 'md'
37 | var md = new Modulo(200010);
| ^~
a.cc:38:21: error: expected ';' before 'i'
38 | for(var i = 0; i < H - A; i++)
| ^
a.cc:38:28: error: 'i' was not declared in this scope
38 | for(var i = 0; i < H - A; i++)
| ^
a.cc:40:24: error: 'md' was not declared in this scope
40 | ans += md.Mul(((md.Ncr(i + B, i) - prev + MOD) % MOD), md.Ncr(W - 1 - B + (H - 1 - i), (H - 1 - i)));
| ^~
a.cc:40:59: error: invalid use of member 'AtCoder::AC::MOD' in static member function
40 | ans += md.Mul(((md.Ncr(i + B, i) - prev + MOD) % MOD), md.Ncr(W - 1 - B + (H - 1 - i), (H - 1 - i)));
| ^~~
a.cc:14:19: note: declared here
14 | const int MOD = 1000000007;
| ^~~
a.cc:40:66: error: invalid use of member 'AtCoder::AC::MOD' in static member function
40 | ans += md.Mul(((md.Ncr(i + B, i) - prev + MOD) % MOD), md.Ncr(W - 1 - B + (H - 1 - i), (H - 1 - i)));
| ^~~
a.cc:14:19: note: declared here
14 | const int MOD = 1000000007;
| ^~~
a.cc:41:24: error: invalid use of member 'AtCoder::AC::MOD' in static member function
41 | ans %= MOD;
| ^~~
a.cc:14:19: note: declared here
14 | const int MOD = 1000000007;
| ^~~
a.cc:44:13: error: 'Console' was not declared in this scope
44 | Console.WriteLine(ans);
| ^~~~~~~
a.cc: At global scope:
a.cc:69:5: error: expected unqualified-id before 'public'
69 | public class Scanner
| ^~~~~~
a.cc:84:5: error: expected unqualified-id before 'public'
84 | public static class Tool
| ^~~~~~
a.cc:117:12: error: expected unqualified-id before 'public'
117 | static public class CalcI
| ^~~~~~
a.cc:134:12: error: expected unqualified-id before 'public'
134 | static public class CalcL
| ^~~~~~
a.cc:153:16: error: expected ':' before 'const'
153 | private const long M = 1000000007;
| ^~~~~~
| :
a.cc:155:16: error: expected ':' before 'readonly'
155 | private readonly long[] m_facs;
| ^~~~~~~~~
| :
a.cc:155:17: error: 'readonly' does not name a type
155 | private readonly long[] m_facs;
| ^~~~~~~~
a.cc:156:15: error: expected ':' before 'long'
156 | public long Mul(long a, long b)
| ^~~~~
| :
a.cc:160:15: error: expected ':' before 'Modulo'
160 | public Modulo(long n)
| ^~~~~~~
| :
a.cc:169:15: error: expected ':' before 'long'
169 | public long Fac(long n)
| ^~~~~
| :
a.cc:173:15: error: expected ':' before 'long'
173 | public long Pow(long a, long m)
| ^~~~~
| :
a.cc:187:15: error: expected ':' before 'long'
187 | public long Div(long a, long b)
| ^~~~~
| :
a.cc:191:15: error: expected ':' before 'long'
191 | public long Ncr(long n, long r)
| ^~~~~
| :
a.cc:200:15: error: expected ':' before 'Modulo'
200 | public Modulo() { }
| ^~~~~~~
| :
a.cc:201:6: error: expected ';' after class definition
201 | }
| ^
| ;
a.cc: In constructor 'AtCoder::Modulo::Modulo(long int)':
a.cc:162:13: error: 'm_facs' was not declared in this scope
162 | m_facs = new long[n + 1];
| ^~~~~~
a.cc: In member function 'long int AtCoder::Modulo::Fac(long int)':
a.cc:171:20: error: 'm_facs' was not declared in this scope
171 | return m_facs[n];
| ^~~~~~
|
s533377819
|
p04046
|
C++
|
#include "iostream"
using namespace std;
long long modfact(long long a) {
long long res = 1;
while (a-- > 0) {
res = (res + a) % (10e9+7)
}
return res;
}
int main() {
long long w, h, a, b;
cin >> h >> w >> a >> b;
long long total = modfact(w+h) / (modfact(w) * modfact(h)) % (10e9+7);
long long remov = modfact(a+b) / (modfact(a) * modfact(b)) % (10e9+7);
cout << (total-remov+10e9+7) % (10e9+7) << endl;
}
|
a.cc: In function 'long long int modfact(long long int)':
a.cc:7:25: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
7 | res = (res + a) % (10e9+7)
| ~~~~~~~~~ ^ ~~~~~~~~
| | |
| | double
| long long int
a.cc: In function 'int main()':
a.cc:17:68: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
17 | long long total = modfact(w+h) / (modfact(w) * modfact(h)) % (10e9+7);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
| | |
| long long int double
a.cc:18:68: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
18 | long long remov = modfact(a+b) / (modfact(a) * modfact(b)) % (10e9+7);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
| | |
| long long int double
a.cc:19:38: error: invalid operands of types 'double' and 'double' to binary 'operator%'
19 | cout << (total-remov+10e9+7) % (10e9+7) << endl;
| ~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
| | |
| double double
|
s980547440
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll f[1000010],revf[1000010];
ll qpow(ll a,ll b)
{
ll ret=1;
while(b)
{
if(b&1) ret=(ret*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return ret;
}
void init()
{
f[0]=1; revf[0]=qpow(f[0],mod-2);
for(ll i=1; i<1000010; i++)
{
f[i]=i*f[i-1]%mod;
revf[i]=qpow(f[i],mod-2);
}
}
ll C(ll n,ll m)
{
return (f[n]*revf[m])%mod*revf[n-m]%mod;
}
ll count_ways(ll a,ll b,ll c,ll d)
{
ll tot=(c-a)+(d-b);
ll down=(c-a);
ll ret=C(tot,down);
return ret;
}
int main()
{
init();
ll h,w,a,b;
cin>>h>>w>>a>>b;
ll tot=count_ways(1,1,h,w);
for(ll i=1; i<=b; i++)
{
ll tmp=count_ways(1,1,h-a,i)*count_ways(h-a+1,i,h,w)%mod;
while(tot<tmp)
tot+=mod;
tot=(tot-tmp)%mod;
}
cout<<tot<<endl;
return 0;
}
|
a.cc: In function 'll qpow(ll, ll)':
a.cc:13:37: error: 'mod' was not declared in this scope; did you mean 'modf'?
13 | if(b&1) ret=(ret*a)%mod;
| ^~~
| modf
a.cc:14:25: error: 'mod' was not declared in this scope; did you mean 'modf'?
14 | a=(a*a)%mod;
| ^~~
| modf
a.cc: In function 'void init()':
a.cc:23:35: error: 'mod' was not declared in this scope; did you mean 'modf'?
23 | f[0]=1; revf[0]=qpow(f[0],mod-2);
| ^~~
| modf
a.cc: In function 'll C(ll, ll)':
a.cc:33:31: error: 'mod' was not declared in this scope; did you mean 'modf'?
33 | return (f[n]*revf[m])%mod*revf[n-m]%mod;
| ^~~
| modf
a.cc: In function 'int main()':
a.cc:53:70: error: 'mod' was not declared in this scope; did you mean 'modf'?
53 | ll tmp=count_ways(1,1,h-a,i)*count_ways(h-a+1,i,h,w)%mod;
| ^~~
| modf
|
s738915193
|
p04046
|
C++
|
#include <iostream>
int main(){
std::cout << "a" << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:4:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
4 | std::cout << "a" << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s065798799
|
p04046
|
C++
|
ll H, W, A, B;
ll calcpat(ll hp, ll wp){
if((hp == 1) && (wp == 1)){
return 1;
} else{
if(hp == 1){
ll ret = calcpat(hp, wp - 1) % MOD;
return ret;
} else if((wp == 1) || ((hp > H - A) && (wp == B + 1))){
ll ret = calcpat(hp - 1, wp) % MOD;
return ret;
} else{
ll ret = ((calcpat(hp - 1, wp) % MOD) + (calcpat(hp, wp - 1) % MOD)) % MOD;
return ret;
}
}
return 0;
}
int main(){
cin >> H >> W >> A >> B;
ll ans = calcpat(H, W);
cout << ans << endl;
return 0;
}
|
a.cc:2:1: error: 'll' does not name a type
2 | ll H, W, A, B;
| ^~
a.cc:4:1: error: 'll' does not name a type
4 | ll calcpat(ll hp, ll wp){
| ^~
a.cc: In function 'int main()':
a.cc:24:3: error: 'cin' was not declared in this scope
24 | cin >> H >> W >> A >> B;
| ^~~
a.cc:24:10: error: 'H' was not declared in this scope
24 | cin >> H >> W >> A >> B;
| ^
a.cc:24:15: error: 'W' was not declared in this scope
24 | cin >> H >> W >> A >> B;
| ^
a.cc:24:20: error: 'A' was not declared in this scope
24 | cin >> H >> W >> A >> B;
| ^
a.cc:24:25: error: 'B' was not declared in this scope
24 | cin >> H >> W >> A >> B;
| ^
a.cc:26:3: error: 'll' was not declared in this scope
26 | ll ans = calcpat(H, W);
| ^~
a.cc:28:3: error: 'cout' was not declared in this scope
28 | cout << ans << endl;
| ^~~~
a.cc:28:11: error: 'ans' was not declared in this scope
28 | cout << ans << endl;
| ^~~
a.cc:28:18: error: 'endl' was not declared in this scope
28 | cout << ans << endl;
| ^~~~
|
s871451583
|
p04046
|
C++
|
// D - いろはちゃんとマス目
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
const int MOD = 1e9 + 7;
class Comb {
private:
int MOD;
long long* fac;
long long* finv;
long long* inv;
public:
// 事前にテーブルを作成
Comb(int MAX, int MOD) {
this->MOD = MOD;
fac = new long long[MAX + 1];
finv = new long long[MAX + 1];
inv = new long long[MAX + 1];
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i <= MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
~Comb() {
delete[] fac, finv, inv;
}
// 二項係数計算
long long calc(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
};
ll get_n_paths(int from_h, int from_w, int to_h, int to_w, Comb& comb) {
int dh = to_h - from_h;
int dw = to_w - from_w;
return comb.calc(dh + dw, dh);
}
int main() {
int H, W, A, B;
cin >> H >> W >> A >> B;
Comb comb = Comb(H + W;, MOD);
ll ans = 0;
for (int i=B; i<W; i++) {
ans += get_n_paths(0, 0, H - A - 1, i, comb) * get_n_paths(H - A, i, H - 1, W - 1, comb);
ans %= MOD;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:58:21: error: expected primary-expression before '(' token
58 | Comb comb = Comb(H + W;, MOD);
| ^
a.cc:58:27: error: expected ')' before ';' token
58 | Comb comb = Comb(H + W;, MOD);
| ~ ^
| )
a.cc:58:28: error: expected primary-expression before ',' token
58 | Comb comb = Comb(H + W;, MOD);
| ^
|
s124201353
|
p04046
|
C++
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void){
int H,W,A,B
cin >> H >> W >> A >> B;
vector<vector<unsigned long long>> ans(H, vector<unsigned long long>(W));
for(int i = 0;i < H -A; ++i){
ans[i][0] = 1;
}
for(int i = H-A;i < H;++i){
ans[i][0] = 0;
}
for(int i = 0; i < W-B; ++i){
ans[0][i] = 1;
}
for(int i = W-B; i < W; ++i){
ans[0][i] = 1;
}
for(int i = 1;i< W; ++i){
for(int j = 1; j < H; ++j){
if(i > W-B && j > H-A){
ans[i][j] = 0;
}else{
ans[i][j] = ans[i-1][j] + ans[i][j-1];
}
}
}
cout << ans[H-1][W-1] % (1000000000 + 7);
}
|
a.cc: In function 'int main()':
a.cc:8:9: error: expected initializer before 'cin'
8 | cin >> H >> W >> A >> B;
| ^~~
a.cc:16:30: error: 'B' was not declared in this scope
16 | for(int i = 0; i < W-B; ++i){
| ^
a.cc:19:23: error: 'B' was not declared in this scope
19 | for(int i = W-B; i < W; ++i){
| ^
a.cc:24:34: error: 'B' was not declared in this scope
24 | if(i > W-B && j > H-A){
| ^
|
s303980711
|
p04046
|
C++
|
#include<iostream>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7, fac[1000000005], v[1000000005];
ll modRec(ll a, ll b) {
if (b == 0)return 1;
if (b % 2 == 0)return modRec((a * a) % mod, b / 2);
return ((a % mod) * modRec((a * a) % mod, b / 2));
}
int main() {
fac[0] = 1, v[0] = 1;
for (int i = 1; i <= 1000000; i++) {
fac[i] = (i * fac[i - 1]) % mod;
v[i] = modRec(fac[i], mod - 2);
}
ll h, w, a, b, ans = 0; cin >> h >> w >> a >> b;
for (ll i = b; i < w; i++) {
ll p = i, q = h - a - 1, r = w - i - 1, s = a - 1;
ll x = (((fac[p + q] * v[p]) % mod) * v[q]) % mod;
x *= (((fac[r + s] * v[r]) % mod) * v[s]) % mod;
ans = (ans + x) % mod;
}
cout << ans << endl;
return 0;
}
|
/tmp/cc7xQJ3J.o: in function `main':
a.cc:(.text+0xd2): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc7xQJ3J.o
a.cc:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc7xQJ3J.o
a.cc:(.text+0x24f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc7xQJ3J.o
a.cc:(.text+0x279): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc7xQJ3J.o
a.cc:(.text+0x2c2): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc7xQJ3J.o
a.cc:(.text+0x2ec): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc7xQJ3J.o
collect2: error: ld returned 1 exit status
|
s539550132
|
p04046
|
Java
|
package main.java.tasks;
import java.util.Scanner;
import java.io.PrintWriter;
public class ABC042DIrohaandaGrid {
public void solve(int testNumber, Scanner in, PrintWriter out) {
int h = in.nextInt();
int w = in.nextInt();
int a = in.nextInt();
int b = in.nextInt();
ModComb mc = new ModComb(200005);
mc.makeFac();
ModInt res = new ModInt(0);
for (int i = 0; i < h - a; i++) {
res = res.add(mc.combFac(b - 1 + i, i).mul(mc.combFac(w - b - 1 + h - 1 - i, h - 1 - i)));
}
out.println(res.toString());
}
}
|
Main.java:6: error: class ABC042DIrohaandaGrid is public, should be declared in a file named ABC042DIrohaandaGrid.java
public class ABC042DIrohaandaGrid {
^
Main.java:13: error: cannot find symbol
ModComb mc = new ModComb(200005);
^
symbol: class ModComb
location: class ABC042DIrohaandaGrid
Main.java:13: error: cannot find symbol
ModComb mc = new ModComb(200005);
^
symbol: class ModComb
location: class ABC042DIrohaandaGrid
Main.java:15: error: cannot find symbol
ModInt res = new ModInt(0);
^
symbol: class ModInt
location: class ABC042DIrohaandaGrid
Main.java:15: error: cannot find symbol
ModInt res = new ModInt(0);
^
symbol: class ModInt
location: class ABC042DIrohaandaGrid
5 errors
|
s472456288
|
p04046
|
C++
|
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
struct combination {
vector<mint> fact, ifact;
combination(int n): fact(n+1), ifact(n+1) {
fact[0] = 1;
for(int i=1; i<=n; i++) fact[i] = fact[i-1] * i;
ifact[n] = fact[n].inv();
for(int i=n-1; i>=1; i--) ifact[i-1] = ifact[i] * i;
}
mint operator()(int n, int k){
if (k<0 or k>n) return 0;
return fact[n]*ifact[k]*ifact[n-k];
}
};
struct mint {
ll x; // typedef long long ll;
mint(ll x=0):x((x%mod+mod)%mod){}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
// for prime mod
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
combination comb = combination(100005);
int main(){
int h, w, a, b;
cin >> h >> w >> a >> b;
mint ans = 0;
rep(i, w-b){
ans += (comb(h+b-a-1+i, b+i) * comb(w-b+1-i, a-1));
}
cout << ans << endl;
return 0;
}
|
a.cc:14:12: error: 'mint' was not declared in this scope; did you mean 'uint'?
14 | vector<mint> fact, ifact;
| ^~~~
| uint
a.cc:14:16: error: template argument 1 is invalid
14 | vector<mint> fact, ifact;
| ^
a.cc:14:16: error: template argument 2 is invalid
a.cc:21:5: error: 'mint' does not name a type; did you mean 'uint'?
21 | mint operator()(int n, int k){
| ^~~~
| uint
a.cc: In constructor 'combination::combination(int)':
a.cc:16:13: error: invalid types 'int[int]' for array subscript
16 | fact[0] = 1;
| ^
a.cc:17:37: error: invalid types 'int[int]' for array subscript
17 | for(int i=1; i<=n; i++) fact[i] = fact[i-1] * i;
| ^
a.cc:17:47: error: invalid types 'int[int]' for array subscript
17 | for(int i=1; i<=n; i++) fact[i] = fact[i-1] * i;
| ^
a.cc:18:14: error: invalid types 'int[int]' for array subscript
18 | ifact[n] = fact[n].inv();
| ^
a.cc:18:24: error: invalid types 'int[int]' for array subscript
18 | ifact[n] = fact[n].inv();
| ^
a.cc:19:40: error: invalid types 'int[int]' for array subscript
19 | for(int i=n-1; i>=1; i--) ifact[i-1] = ifact[i] * i;
| ^
a.cc:19:53: error: invalid types 'int[int]' for array subscript
19 | for(int i=n-1; i>=1; i--) ifact[i-1] = ifact[i] * i;
| ^
a.cc: In function 'int main()':
a.cc:82:21: error: no match for call to '(combination) (int, int)'
82 | ans += (comb(h+b-a-1+i, b+i) * comb(w-b+1-i, a-1));
| ~~~~^~~~~~~~~~~~~~~~
a.cc:82:44: error: no match for call to '(combination) (int, int)'
82 | ans += (comb(h+b-a-1+i, b+i) * comb(w-b+1-i, a-1));
| ~~~~^~~~~~~~~~~~~~
a.cc:85:10: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'mint')
85 | cout << ans << endl;
| ~~~~ ^~ ~~~
| | |
| | mint
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'mint' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'mint' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'mint' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'mint' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'mint' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'mint' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'mint' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'mint' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'mint' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'mint' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'mint' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'mint' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'mint' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235
|
s171962418
|
p04046
|
C++
|
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;
const ll MAX_N = 100010;
// aのn乗を求める。計算量はO(logn)
ll modpow(ll a, ll n) {
if(n == 0) {
return 1;
}
if(n%2 == 1) {
return (a * modpow(a, n-1))%mod;
}
return (modpow(a, n/2) * modpow(a, n/2))%mod;
}
ll inv(ll a) {
return modpow(a, mod-2);
}
ll fact[MAX_N];
ll invfact[MAX_N];
// main関数でinit()を呼び出してからComb()を使用する
void init() {
fact[0] = 1;
invfact[0] = 1;
for(ll i = 1; i < MAX_N; i++) {
fact[i] = (i*fact[i-1])%mod;
invfact[i] = inv(fact[i]);
}
}
ll Comb(ll n, ll r) {
if(r < 0 || n < 0 || n < r) {
return 0;
}
ll res = fact[n];
res = (res * invfact[r])%mod;
res = (res * invfact[n-r])%mod;
return res;
}
int main() {
ll h, w, a, b;
cin >> h >> w >> a >> b;
init();
ll ans = 0;
for(ll i = b; i < w; i++) {
ans += (Comb(h-a-1+i, h-a-1) * Comb(w+a-2-i, w-1-i))%mod;
ans %= mod;
}
out(ans);
re0;
}
|
a.cc:39:9: warning: "rep" redefined
39 | #define rep(i, n) for(int i = 0; i < n; i++)
| ^~~
a.cc:17:9: note: this is the location of the previous definition
17 | #define rep(i, n) for(ll i = 0; i < n; i++)
| ^~~
a.cc:42:4: error: conflicting declaration 'll mod'
42 | ll mod = 1000000007;
| ^~~
a.cc:27:10: note: previous declaration as 'const ll mod'
27 | const ll mod = 1000000007;
| ^~~
a.cc:43:10: error: redefinition of 'const ll MAX_N'
43 | const ll MAX_N = 100010;
| ^~~~~
a.cc:29:10: note: 'const ll MAX_N' previously defined here
29 | const ll MAX_N = 100010;
| ^~~~~
|
s970117893
|
p04046
|
C++
|
#include<bits/stdc++.h>
using namespace std;
//#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>PII;
typedef vector<PII>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>MP;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
const int mod=1e9+7;
const int sze=1e5+2;
int matrix[sze][sze];
int R,C,A,B;
int recur(int i,int j){
if(i==R && j==C)return 1;
else if(i>R || j>C)return 0;
int sum1=0,sum2=0;
if(matrix[i+1][j]==1)sum1+=recur(i+1,j);
if(matrix[i][j+1]==1)sum2+=recur(i,j+1);
return sum1+sum2;
}
signed main(){
sl(R);sl(C);sl(A);sl(B);
ms(matrix,0);
for(int i=1;i<=R;i++)
for(int j=1;j<=C;j++)matrix[i][j]=1;
for(int i=R-A+1;i<=R;i++)
for(int j=1;j<=B;j++)matrix[i][j]=0;
cout<<recur(1,1)<<endl;
return 0;
}
|
/tmp/cckeV4re.o: in function `recur(long long, long long)':
a.cc:(.text+0x13): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x44): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cckeV4re.o
/tmp/cckeV4re.o: in function `main':
a.cc:(.text+0x114): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x150): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x16e): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x201): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cckeV4re.o
a.cc:(.text+0x20e): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s863641111
|
p04046
|
C++
|
factorial.resize(h + w, -1);
|
a.cc:1:5: error: 'factorial' does not name a type
1 | factorial.resize(h + w, -1);
| ^~~~~~~~~
|
s087494609
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
ll INF = 100000000000000;
double PI = 3.1415926535;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
vector.erase(vector.begin() + index);
}
using Graph = vector<vector<ll>>;
ll minv[100100];
ll modpow(ll a,ll n,ll m){//modpow(a,n,m) := a ^ n (mod m)
ll res = 1;
while(n > 0){
if(n & 1)res = res * a % m;
a = a * a % m;
n >>= 1;
}
return res;
}
ll modinv(ll a,ll p){//modinv(a,p) := pを法とするaの逆元(※pは素数でなければならない)
if(minv[a] != -1){
return minv[a];
}
ll res = modpow(a,p-2,p);
minv[a] = res;
return res;
}
ll modCON(ll n,ll r,ll m){
ll res = 1;
for(int i = 1;i <= n;i++){
res *= i;
res %= m;
}
for(int i = 1;i <= r;i++){
res *= modinv(i,m);
res %= m;
}
for(int i = 1;i <= n-r;i++){
res *= modinv(i,m);
res %= m;
}
return res;
}
|
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s119638711
|
p04046
|
C++
|
#include<iostream>
using namespace std;
#define MODE 1000000007
int factorial(int start, int end){
int answer = 1;
if (end < start) return 1;
for(int i=start; i <= end; i++){
answer *= i%MODE;
answer = answer%MODE;
}
//cout << "answer =" << answer << endl;
return answer;
}
int my_course(int h, int w){
int answer;
answer = (factorial(h+1, h+w)/factorial(1,w))%MODE;
return answer;
}
int main(){
int h,w,a,b,total,colision;
cin >> h >> w >> a >> b;
total = my_course(h-1,w-1);
colision = 0;
for(int i=0; i < b; i++ ){
colision += my_course(i, h-1-a) * my_course(w-1-i, a-1);
colisoion = colision%MODE;
}
cout << total - colision;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:34:5: error: 'colisoion' was not declared in this scope; did you mean 'colision'?
34 | colisoion = colision%MODE;
| ^~~~~~~~~
| colision
|
s711429083
|
p04046
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool path(vector<vector<int> > v, int a, int b)
{
vector<vector<bool> > vis( a , vector<int> (b, false));
queue<pair<int, int> > q;
q.push(make_pair(0, 0));
int r[2] = {0, 1};
int c[2] = {1, 0};
int count = 0;
while(!q.empty())
{
pair<int, int> t = q.front();
q.pop();
int curx = t.first;
int cury = t.second;
vis[curx][cury] == true;
if(curx == a-1 && cury == b-1)
count++;
for(int i = 0; i < 2; i++)
{
int nextx = curx + r[i];
int nexty = cury + c[i];
if((nextx >= 0 && nextx < a) && (nexty >= 0 && nexty < b) && !vis[nextx][nexty] && v[nextx][nexty] == 0)
{
vis[nextx][nexty] = true;
q.push(make_pair(nextx, nexty));
}
}
}
return (count % (10e9 + 7));
}
int main()
{
int a, b, c, d;
cin>>a>>b>>c>>d;
vector<vector<int> > v( a , vector<int> (b, 0));
int rs = a-c, rf = a-1, cs = 0, cf = b-d;
for(int i = rs; i <= rf; i++)
for(int j = cs; j <= cf; j++)
v[i][j] = 1;
ll res = path(v, a, b);
cout<<res<<"\n";
return 0;
}
|
a.cc: In function 'bool path(std::vector<std::vector<int> >, int, int)':
a.cc:8:62: error: no matching function for call to 'std::vector<std::vector<bool> >::vector(int&, std::vector<int>)'
8 | vector<vector<bool> > vis( a , vector<int> (b, false));
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
a.cc:8:62: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>')
8 | vector<vector<bool> > vis( a , vector<int> (b, false));
| ^
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<bool> >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<bool> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<bool> >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<bool> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<bool> >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; size_type = long unsigned int; value_type = std::vector<bool>; allocator_type = std::allocator<std::vector<bool> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<bool> >::value_type&' {aka 'const std::vector<bool>&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<bool> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<bool> >::allocator_type&' {aka 'const std::allocator<std::vector<bool> >&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
a.cc:34:23: error: invalid operands of types 'int' and 'double' to binary 'operator%'
34 | return (count % (10e9 + 7));
| ~~~~~ ^ ~~~~~~~~~~
| | |
| int double
|
s649732888
|
p04046
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool path(vector<vector<int> > v, a, b)
{
vector<vector<bool> > vis( a , vector<int> (b, false));
queue<pair<int, int> > q;
q.push(make_pair(0, 0));
int r[2] = {0, 1};
int c[2] = {1, 0};
int count = 0;
while(!q.empty())
{
pair<int, int> t = q.front();
q.pop();
int curx = t.first;
int cury = t.second;
vis[curx][cury] == true;
if(curx == a-1 && cury == b-1)
count++;
for(int i = 0; i < 2; i++)
{
int nextx = curx + r[i];
int nexty = cury + c[i];
if((nextx >= 0 && nextx < a) && (nexty >= 0 && nexty < b) && !vis[nextx][nexty] && v[nextx][nexty] == 0)
{
vis[nextx][nexty] = true;
q.push(make_pair(nextx, nexty));
}
}
}
return (count % (10e9 + 7));
}
int main()
{
int a, b, c, d;
cin>>a>>b>>c>>d;
vector<vector<int> > v( a , vector<int> (b, 0));
int rs = a-c, rf = a-1, cs = 0, cf = b-d;
for(int i = rs; i <= rf; i++)
for(int j = cs; j <= cf; j++)
v[i][j] = 1;
ll res = path(v, a, b);
cout<<res<<"\n";
return 0;
}
|
a.cc:6:35: error: 'a' has not been declared
6 | bool path(vector<vector<int> > v, a, b)
| ^
a.cc:6:38: error: 'b' has not been declared
6 | bool path(vector<vector<int> > v, a, b)
| ^
a.cc: In function 'bool path(std::vector<std::vector<int> >, int, int)':
a.cc:8:36: error: 'a' was not declared in this scope
8 | vector<vector<bool> > vis( a , vector<int> (b, false));
| ^
a.cc:8:53: error: 'b' was not declared in this scope
8 | vector<vector<bool> > vis( a , vector<int> (b, false));
| ^
a.cc:34:23: error: invalid operands of types 'int' and 'double' to binary 'operator%'
34 | return (count % (10e9 + 7));
| ~~~~~ ^ ~~~~~~~~~~
| | |
| int double
|
s783879460
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int kaijo(int x){
if (x>0) return x*kaijo(x-1);
else return 1;
}
int main(){
int h,w,a,b;
cin >> h >> w >> a >> b;
vector<int>vec(100000)
int ans;
for(int i=0;i<w-b;i++){
vec.at(i) = kaijo(h-a+b+i)/kaijo(h-a-1)/kaijo(b+i+1);
vec.at(i) = vec.at(i)*kaijo(w+a-b-2-i)/kaijo(w-b-1-i)/kaijo(a-1);
ans += vec.at(i);
}
cout << ans % 1000000007 << endl;
}
|
a.cc: In function 'int main()':
a.cc:11:5: error: expected ',' or ';' before 'int'
11 | int ans;
| ^~~
a.cc:15:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
15 | ans += vec.at(i);
| ^~~
| abs
a.cc:17:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | cout << ans % 1000000007 << endl;
| ^~~
| abs
|
s142254836
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int !(int x){
if (x>0) return x*!(x-1);
else return 1;
}
int main(){
cin >> h >> w >> a >> b;
vector<int>vec(100000)
int ans;
for(int i=0;i<w-b;i++){
vec.at(i) = !(h-a+b+i)/!(h-a-1)/!(b+i+1);
vec.at(i) = vec.at(i)*!(w+a-b-2-i)/!(w-b-1-i)/!(a-1);
ans += vec.at(i);
}
cout << ans % 1000000007 << endl;
}
|
a.cc:3:5: error: expected unqualified-id before '!' token
3 | int !(int x){
| ^
a.cc: In function 'int main()':
a.cc:8:10: error: 'h' was not declared in this scope
8 | cin >> h >> w >> a >> b;
| ^
a.cc:8:15: error: 'w' was not declared in this scope
8 | cin >> h >> w >> a >> b;
| ^
a.cc:8:20: error: 'a' was not declared in this scope
8 | cin >> h >> w >> a >> b;
| ^
a.cc:8:25: error: 'b' was not declared in this scope
8 | cin >> h >> w >> a >> b;
| ^
a.cc:10:5: error: expected ',' or ';' before 'int'
10 | int ans;
| ^~~
a.cc:14:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
14 | ans += vec.at(i);
| ^~~
| abs
a.cc:16:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
16 | cout << ans % 1000000007 << endl;
| ^~~
| abs
|
s074160440
|
p04046
|
C++
|
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
ll H, W, A, B;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for(int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if(n < k)
return 0;
if(n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
cin >> H >> W >> A >> B;
// H times W
// 右か下しかない
// 下からA個いないかつ
// 左からB個いないへは移動することができない
ll ans = 0LL;
ll bf = 0LL;
COMinit() for(int x = 0; x < W - B; x++) {
ll tmp = COM(H - A - 1 + B + x, B + x);
ll diff = tmp - bf;
diff %= MOD;
ans += diff * COM(A + W - 1 - B - x, A);
bf = tmp;
ans %= MOD;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:68:14: error: expected ';' before 'for'
68 | COMinit() for(int x = 0; x < W - B; x++) {
| ^~~~
| ;
a.cc:68:30: error: 'x' was not declared in this scope
68 | COMinit() for(int x = 0; x < W - B; x++) {
| ^
|
s249275972
|
p04046
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
unsigned long long int D;
int main(){
D = 1000000007LL;
unsigned long long int W, H, A, B;
cin >> W >> H >> A >> B;
unsigned long long int G[H][W]// = {{0LL}};
for(long long int y = 0; y < H; y++){
for(long long int x = 0; x < W; x++){
if(x == 0 && y == 0) G[y][x] = 1LL;
else if(x < B && y >= H - A) G[y][x] = 0LL;
else if(x == B && y >= H - A && y >= 1) G[y][x] = G[y-1][x];
else if(x == 0 || y == 0) G[y][x] = 1LL;
else if(x >= 1 && y >= 1) G[y][x] = G[y-1][x] + G[y][x-1] % D;
}
}
cout << G[H-1][W-1];
//for(int y = 0; y < H; y++){
// for(int x = 0; x < W; x++){
// cout << G[y][x];
// }
// cout << endl;
//}
}
|
a.cc: In function 'int main()':
a.cc:14:3: error: expected initializer before 'for'
14 | for(long long int y = 0; y < H; y++){
| ^~~
a.cc:14:28: error: 'y' was not declared in this scope
14 | for(long long int y = 0; y < H; y++){
| ^
a.cc:23:11: error: 'G' was not declared in this scope
23 | cout << G[H-1][W-1];
| ^
|
s678652906
|
p04046
|
C++
|
#include <iosteam>
#include <vector>
using namespace std;
long long int D;
int main(){
D = 1000000007LL
int W, H, A, B;
cin >> W >> H >> A >> B;
long long int G[H][W] = {0};
for(int y = 0; y < H; y++){
for(int x = 0; x < W; x++){
if(x == 0 || y == 0) G[y][x] = 1LL;
else if(x + 1 + A > W || y + 1 + B > H) continue;
else if(x >= 1 && y >= 1) G[y][x] = (G[y][x-1] + G[y-1][x]) % D;
}
}
cout << G[H-1][W-1];
}
|
a.cc:1:10: fatal error: iosteam: No such file or directory
1 | #include <iosteam>
| ^~~~~~~~~
compilation terminated.
|
s774206518
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int H, W, A, B;
template<int MOD = 1000000007>
struct ModInt {
int val;
ModInt(long long val_ = 0) : val(val_ >= 0 ? val_ % MOD : (MOD - (-val_) % MOD) % MOD) {}
bool operator==(const ModInt &rhs) const { return val == rhs.val; }
bool operator!=(const ModInt &rhs) const { return val != rhs.val; }
ModInt &operator+=(const ModInt &rhs) {
if ((val += rhs.val) >= MOD) { val -= MOD; }
return *this;
}
ModInt &operator-=(const ModInt &rhs) {
if ((val += MOD - rhs.val) >= MOD) { val -= MOD; }
return *this;
}
ModInt &operator*=(const ModInt &rhs) {
val = (int) ((long long) val * rhs.val % MOD);
return *this;
}
ModInt &operator/=(const ModInt &rhs) { return *this *= rhs.inv(); }
ModInt operator+() const { return *this; }
ModInt operator-() const { return ModInt(-val); }
ModInt operator++() { return *this += 1; }
ModInt operator--() { return *this -= 1; }
ModInt operator++(signed) {
const ModInt ret(*this);
++*this;
return ret;
}
ModInt operator--(signed) {
const ModInt ret(*this);
--*this;
return ret;
}
ModInt operator+(const ModInt &rhs) const { return ModInt(*this) += rhs; }
ModInt operator-(const ModInt &rhs) const { return ModInt(*this) -= rhs; }
ModInt operator*(const ModInt &rhs) const { return ModInt(*this) *= rhs; }
ModInt operator/(const ModInt &rhs) const { return ModInt(*this) /= rhs; }
ModInt inv() const {
int a = MOD, b = val, u = 0, v = 1;
while (b > 0) {
int t = a / b;
std::swap(a -= t * b, b);
std::swap(u -= t * v, v);
}
return ModInt(u);
}
ModInt pow(long long n) const {
ModInt ret = 1, mul = *this;
if (n < 0) { n = -n, mul = mul.inv(); }
while (n > 0) {
if (n & 1) { ret *= mul; }
mul *= mul;
n >>= 1;
}
return ret;
}
friend std::istream &operator>>(std::istream &is, ModInt &rhs) {
long long v;
is >> v;
rhs = v;
return is;
}
friend std::ostream &operator<<(std::ostream &os, const ModInt &rhs) { return os << rhs.val; }
struct Combination {
std::vector<ModInt> fact{1, 1}, fInv{1, 1}, inv{0, 1};
void calc(int n) {
while (fact.size() <= n) {
int i = fact.size();
fact.push_back(fact[i - 1] * i);
inv.push_back(-inv[MOD % i] * (MOD / i));
fInv.push_back(fInv[i - 1] * inv[i]);
}
}
ModInt P(int n, int r) { return r < 0 || n < r ? 0 : (calc(n), fact[n] * fInv[n - r]); }
ModInt C(int n, int r) { return r < 0 || n < r ? 0 : (calc(n), fact[n] * fInv[r] * fInv[n - r]); }
ModInt H(int n, int r) { return C(n + r - 1, r); }
};
};
signed main() {
cin >> H >> W >> A >> B;
using Mint=ModInt<>;
using Comb=Mint::Combination;
Mint ans = 0;
for (int i = 1; i <= H - A; i++) {
ans += Comb.C(i + B - 2, B - 1) * Comb.C(H + W - B - i - 1, W - B - 1);
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:91:20: error: expected primary-expression before '.' token
91 | ans += Comb.C(i + B - 2, B - 1) * Comb.C(H + W - B - i - 1, W - B - 1);
| ^
a.cc:91:47: error: expected primary-expression before '.' token
91 | ans += Comb.C(i + B - 2, B - 1) * Comb.C(H + W - B - i - 1, W - B - 1);
| ^
|
s536042311
|
p04046
|
C++
|
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
ll H, W, A, B;
ll modpow(ll a, ll p) {
if(p == 0)
return 1;
if(p % 2 == 0) {
ll halfp = p / 2;
ll half = modpow(a, halfp);
return half * half % MOD;
} else {
return a * modpow(a, p - 1) % MOD;
}
}
ll calcComb(ll a, ll b) {
if(b < 0) {
return 0;
}
if(a < 0) {
return 0;
}
if(a < b) {
return 0;
}
if(b > a - b) {
return calcComb(a, a - b);
}
ll ansMul = 1;
ll ansDiv = 1;
REP(i, b) {
ansMul *= (a - i);
ansDiv *= (i + 1);
ansMul %= MOD;
ansDiv %= MOD;
}
ll ans = ansMul * modpow(ansDiv, MOD - 2);
ans %= MOD;
return ans;
}
int main() {
cin >> H >> W >> A >> B;
// H times W
// 右か下しかない
// 下からA個いないかつ
// 左からB個いないへは移動することができない
ll ans = 0LL;
ll bf = 0LL;
for(int x = 0; x < W - B; x++) {
ll tmp = calcComb(H - A - 1 + B + x, B + x);
ans += (tmp - bf) * calcComb(A + W - 1 - B - x, A);
}
bf = tmp;
ans %= MOD;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:86:10: error: 'tmp' was not declared in this scope; did you mean 'tm'?
86 | bf = tmp;
| ^~~
| tm
a.cc: At global scope:
a.cc:90:1: error: 'cout' does not name a type
90 | cout << ans << endl;
| ^~~~
a.cc:91:1: error: expected unqualified-id before 'return'
91 | return 0;
| ^~~~~~
a.cc:92:1: error: expected declaration before '}' token
92 | }
| ^
|
s874550786
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define MOD 1000000007
int main()
{
int M,N,P,_i,_j;
//Take input the number of rows, columns and blocked cells
cin>>M>>N>>A>>B;
int p=A*B;
//declaring a Grid array which stores the number of paths
ll Grid[M+1][N+1];
//Note that we'll be using 1-based indexing here.
//initialize all paths initially as 0
memset(Grid, 0, sizeof(Grid));
F(i,0,P-1)
{
//Take in the blocked cells and mark them with a special value(-1 here)
cin>>_i>>_j;
Grid[_i][_j] = -1;
}
// If the initial cell is blocked, there is no way of moving anywhere
if(Grid[1][1] == -1)
{
printf("0");
return 0;
}
// Initializing the leftmost column
//Here, If we encounter a blocked cell, there is no way of visiting any cell
//directly below it.(therefore the break)
F(i,1,M)
{
if(Grid[i][1] == 0) Grid[i][1] = 1LL;
else break;
}
//Similarly initialize the topmost row.
F(i,2,N)
{
if(Grid[1][i] == 0) Grid[1][i] = 1LL;
else break;
}
//Now the recurrence part
//The only difference is that if a cell has been marked as -1,
//simply ignore it and continue to the next iteration.
F(i,2,M)
{
F(j,2,N)
{
if(Grid[i][j] == -1) continue;
//While adding the number of ways from the left and top cells,
//check that they are reachable,i.e. they aren't blocked
if(Grid[i-1][j] > 0) Grid[i][j] = (Grid[i][j] + Grid[i-1][j] + MOD)%MOD;
if(Grid[i][j-1] > 0) Grid[i][j] = (Grid[i][j] + Grid[i][j-1] + MOD)%MOD;
}
}
//If the final cell is blocked, output 0, otherwise the answer
printf("%lld",(Grid[M][N] >= 0 ? Grid[M][N] : 0));
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:16: error: 'A' was not declared in this scope
12 | cin>>M>>N>>A>>B;
| ^
a.cc:12:19: error: 'B' was not declared in this scope
12 | cin>>M>>N>>A>>B;
| ^
|
s097517497
|
p04046
|
C++
|
h, w, a, b = map(int, input().split())
res = 0
kai = min(w - b, h - a)
mod = 10 ** 9 + 7
kaijo = [0] * (h + w + 1)
kaijo[0] = 1
for i in range(1, h + w + 1):
kaijo[i] = (kaijo[i - 1] * i) % mod
gyaku = [0] * (h + w + 1)
gyaku[h + w] = pow(kaijo[h + w], mod - 2, mod)
for i in range(h + w, 0, -1):
gyaku[i - 1] = (gyaku[i] * i) % mod
def conb(x, k):
return (kaijo[x] * gyaku[k] * gyaku[x - k]) % mod
conb1 = conb(h - a - 1 + b, b)
conb2 = conb(a + w - b - 1, a)
combi = conb1 * conb2
res = combi
for i in range(1, kai):
res += conb(h - a - 1 + b, b + i) * conb(a + w - b - 1, a + i)
res %= mod
print(int(res))
|
a.cc:1:1: error: 'h' does not name a type
1 | h, w, a, b = map(int, input().split())
| ^
|
s351147914
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;
ll dp[100010][100010];
const ll MAX=100010;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
ll COM(ll n, ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void solve(){
ll h,w,a,b;
cin >> h >> w >> a >> b;
/*
...........
...........
...........
###........
###........
dp[i][j](i=h-a~h-1,j=0~b-1)
*/
/*
dp[0][0]=1;
rep(i,h){
rep(j,w){
if(i==0&&j==0) dp[i][j]=1;
else if(h-a<=i&&i<=h-1&&0<=j&&j<=b-1){
dp[i][j]=0;
}
else if(i==0){
dp[i][j]=dp[i][j-1];
}
else if(j==0){
dp[i][j]=dp[i-1][j];
}
else{
dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
}
}
}
cout << dp[h-1][w-1] << endl;
*/
COMinit();
/*
i=b〜w-1について、
(h-a-1+i)C(h-a)*(w-i)C(a)
....
....
#...
h=3 w=4 a=1 b=1
2C1*3C1 + 3C2*2C1 + 4C3*1C1
...
#..
*/
ll ans = 0;
for(ll i=b; i<w; i++){
ans += (COM(h-a-1+i, i)*COM(w-i+a-2,a-1)) % MOD;
ans = ans % MOD;
}
cout << ans << endl;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
|
/tmp/cclKbk9y.o: in function `COMinit()':
a.cc:(.text+0x7): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0x8c): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/cclKbk9y.o
a.cc:(.text+0xf6): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s363736017
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;
ll dp[100010][100010];
const ll MAX=100010;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
ll COM(ll n, ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void solve(){
ll h,w,a,b;
cin >> h >> w >> a >> b;
/*
...........
...........
...........
###........
###........
dp[i][j](i=h-a~h-1,j=0~b-1)
*/
/*
dp[0][0]=1;
rep(i,h){
rep(j,w){
if(i==0&&j==0) dp[i][j]=1;
else if(h-a<=i&&i<=h-1&&0<=j&&j<=b-1){
dp[i][j]=0;
}
else if(i==0){
dp[i][j]=dp[i][j-1];
}
else if(j==0){
dp[i][j]=dp[i-1][j];
}
else{
dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
}
}
}
cout << dp[h-1][w-1] << endl;
*/
COMinit();
/*
i=b〜w-1について、
(h-a-1+i)C(h-a)*(w-i)C(a)
....
....
#...
h=3 w=4 a=1 b=1
2C1*3C1 + 3C2*2C1 + 4C3*1C1
...
#..
*/
ll ans = 0;
for(ll i=b; i<w; i++){
ans += (COM(h-a-1+i, i)*COM(w-i+a-2,a-1)) % MOD;
ans = ans % MOD;
}
cout << ans << endl;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
|
/tmp/ccW99FZw.o: in function `COMinit()':
a.cc:(.text+0x7): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0x8c): relocation truncated to fit: R_X86_64_PC32 against symbol `fac' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccW99FZw.o
a.cc:(.text+0xf6): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s377265203
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;
ll dp[h+10][w+10];
void solve(){
int h,w,a,b;
cin >> h >> w >> a >> b;
/*
...........
...........
...........
###........
###........
dp[i][j](i=h-a~h-1,j=0~b-1)
*/
dp[0][0]=1;
rep(i,h){
rep(j,w){
if(h-a<=i&&i<=h-1&&0<=j&&j<=b-1){
dp[i][j]=0;
}
else{
dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
}
}
}
cout << dp[h-1][w-1] << endl;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
|
a.cc:9:7: error: 'h' was not declared in this scope
9 | ll dp[h+10][w+10];
| ^
a.cc:9:13: error: 'w' was not declared in this scope
9 | ll dp[h+10][w+10];
| ^
a.cc: In function 'void solve()':
a.cc:22:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
22 | dp[0][0]=1;
| ^~
| dup
|
s192087530
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef ll long long;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
ll h,w,a,b;
bool Main(){
cin>>h>>w>>a>>b;
ll vec[100000][100000];
for(int i=0;i<h-a;i++){
vec[i][0]=1;
}
for(int i=h-a;i<h;i++){
vec[i][0]=0;
}
for(int j=0;j<w;j++){
vec[0][j]=1;
}
for(int i=1;i<h;i++){
for(int j=1;j<w;j++){
if(i<h-a||j>=b){
vec[i][j]=(vec[i-1][j]+vec[i][j-1])%1000000007;
}
else{
vec[i][j]=0;
}
}
}
cout<<vec[h-1][w-1]<<endl;
}
int main(){
Main();
return 0;
}
|
a.cc:3:9: error: 'll' does not name a type
3 | typedef ll long long;
| ^~
a.cc:5:1: error: 'll' does not name a type
5 | ll h,w,a,b;
| ^~
a.cc: In function 'bool Main()':
a.cc:7:10: error: 'h' was not declared in this scope
7 | cin>>h>>w>>a>>b;
| ^
a.cc:7:13: error: 'w' was not declared in this scope
7 | cin>>h>>w>>a>>b;
| ^
a.cc:7:16: error: 'a' was not declared in this scope
7 | cin>>h>>w>>a>>b;
| ^
a.cc:7:19: error: 'b' was not declared in this scope
7 | cin>>h>>w>>a>>b;
| ^
a.cc:8:5: error: 'll' was not declared in this scope
8 | ll vec[100000][100000];
| ^~
a.cc:10:9: error: 'vec' was not declared in this scope
10 | vec[i][0]=1;
| ^~~
a.cc:13:9: error: 'vec' was not declared in this scope
13 | vec[i][0]=0;
| ^~~
a.cc:16:9: error: 'vec' was not declared in this scope
16 | vec[0][j]=1;
| ^~~
a.cc:21:17: error: 'vec' was not declared in this scope
21 | vec[i][j]=(vec[i-1][j]+vec[i][j-1])%1000000007;
| ^~~
a.cc:24:17: error: 'vec' was not declared in this scope
24 | vec[i][j]=0;
| ^~~
a.cc:28:9: error: 'vec' was not declared in this scope
28 | cout<<vec[h-1][w-1]<<endl;
| ^~~
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
29 | }
| ^
|
s270715785
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define REP(i, n) for(LL i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;
LL add(LL x, LL y) {
return (x%mod) + (y%mod);
}
LL sub(LL x, LL y) {
return ((x%mod) - (y%mod) + mod)%mod;
}
LL mul(LL x, LL y) {
return ((x%mod)*(y%mod))%mod;
}
LL pw(LL x, LL y) {
LL res = 1;
while(y != 0) {
if(y%2) {
res = mul(x, res);
y--;
}else{
x = mul(x, x);
y /= 2;
}
}
return res;
}
LL inv(LL x) {
return pw(x, mod - 2);
}
int main() {
LL H, W, A, B;
cin >> H >> W >> A >> B;
assert(false);
cout << res << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:42:13: error: 'res' was not declared in this scope
42 | cout << res << endl;
| ^~~
|
s097398382
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define REP(i, n) for(LL i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;
LL add(LL x, LL y) {
return (x%mod) + (y%mod);
}
LL sub(LL x, LL y) {
return ((x%mod) - (y%mod) + mod)%mod;
}
LL mul(LL x, LL y) {
return ((x%mod)*(y%mod))%mod;
}
LL pw(LL x, LL y) {
LL res = 1;
while(y != 0) {
if(y%2) {
res = mul(x, res);
y--;
}else{
x = mul(x, x);
y /= 2;
}
}
return res;
}
LL inv(LL x) {
return pw(x, mod - 2);
}
int main() {
LL H, W, A, B;
cin >> H >> W >> A >> B;
vector<LL> fact(H + W + 1, 1);
FOR(i, 1, H + W + 1) {
fact[i] = mul(i, fact[i - 1]);
}
LL res = 0;
REP(i, H - A) {
LL d1 = mul(mul(fact[i + B - 1], inv(fact[i])), inv(fact[B - 1]));
LL d2 = mul(mul(fact[H - i - 1 + d], inv(fact[H - i - 1])), inv(fact[W - B - 1]));
res = add(res, mul(d1, d2));
}
cout << res << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:50:42: error: 'd' was not declared in this scope; did you mean 'd2'?
50 | LL d2 = mul(mul(fact[H - i - 1 + d], inv(fact[H - i - 1])), inv(fact[W - B - 1]));
| ^
| d2
|
s486307987
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;
LL md_add(LL x, LL y) {
return (x%mod) + (y%mod);
}
LL md_sub(LL x, LL y) {
return ((x%mod) - (y%mod) + mod)%mod;
}
LL md_mul(LL x, LL y) {
return ((x%mod)*(y%mod))%mod;
}
LL md_pw(LL x, LL y) {
LL res = 1;
while(y != 0) {
if(y%2) {
res = md_mul(x, res);
y--;
}else{
x = md_mul(x, x);
y /= 2;
}
}
return res;
}
LL md_div(LL x, LL y) {
return md_mul(x, md_pw(y, mod - 2));
}
LL md_fact(LL n) {
LL res = 1;
FOR(i, 1, n + 1)
res = md_mul(res, i);
return res;
}
LL md_combi(LL n, LL r) {
if(n < r)
return 0;
return md_div(md_fact(n), md_mul(md_fact(r), md_fact(n - r)));
}
int main() {
LL H, W, A, B;
cin >> H >> W >> A >> B;
vector<LL> fact;
vector<LL> factinv;
fact.resize(H + W - 1);
factinv.resize(H + W - 1);
fact[0] = 1;
factinv[0] = 1;
FOR(i, 1, H + W - 1) {
fact[i] = md_mul(fact[i - 1], i);
factinv[i] = md_div(1, fact[i]);
}
LL res = 0;
for(LL i = 1;i <= H - A;i++) {
LL d1 = md_div(fact[i + B - 2], md_mul(fact[i - 1], fact[B - 1]));
LL d2 = md_div(fact[W - B - 1 + H - i], md_mul(fact[H - i], fact[W - B - 1]));
res = md_add(res, md_mul(d1, d2));
}
cout << res << endl;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;
LL md_add(LL x, LL y) {
return (x%mod) + (y%mod);
}
LL md_sub(LL x, LL y) {
return ((x%mod) - (y%mod) + mod)%mod;
}
LL md_mul(LL x, LL y) {
return ((x%mod)*(y%mod))%mod;
}
LL md_pw(LL x, LL y) {
LL res = 1;
while(y != 0) {
if(y%2) {
res = md_mul(x, res);
y--;
}else{
x = md_mul(x, x);
y /= 2;
}
}
return res;
}
LL md_div(LL x, LL y) {
return md_mul(x, md_pw(y, mod - 2));
}
LL md_fact(LL n) {
LL res = 1;
FOR(i, 1, n + 1)
res = md_mul(res, i);
return res;
}
LL md_combi(LL n, LL r) {
if(n < r)
return 0;
return md_div(md_fact(n), md_mul(md_fact(r), md_fact(n - r)));
}
int main() {
LL H, W, A, B;
cin >> H >> W >> A >> B;
vector<LL> fact;
vector<LL> factinv;
fact.resize(H + W - 1);
factinv.resize(H + W - 1);
fact[0] = 1;
factinv[0] = 1;
FOR(i, 1, H + W - 1) {
fact[i] = md_mul(fact[i - 1], i);
factinv[i] = md_div(1, fact[i]);
}
LL res = 0;
for(LL i = 1;i <= H - A;i++) {
LL d1 = md_div(fact[i + B - 2], md_mul(fact[i - 1], fact[B - 1]));
LL d2 = md_div(fact[W - B - 1 + H - i], md_mul(fact[H - i], fact[W - B - 1]));
res = md_add(res, md_mul(d1, d2));
}
cout << res << endl;
return 0;
}
|
a.cc:81:11: error: redefinition of 'const int IINF'
81 | const int IINF = 1e9;
| ^~~~
a.cc:8:11: note: 'const int IINF' previously defined here
8 | const int IINF = 1e9;
| ^~~~
a.cc:82:10: error: redefinition of 'const long long int LINF'
82 | const LL LINF = 1e18;
| ^~~~
a.cc:9:10: note: 'const long long int LINF' previously defined here
9 | const LL LINF = 1e18;
| ^~~~
a.cc:83:10: error: redefinition of 'const long long int mod'
83 | const LL mod = 1e9+7;
| ^~~
a.cc:10:10: note: 'const long long int mod' previously defined here
10 | const LL mod = 1e9+7;
| ^~~
a.cc:85:4: error: redefinition of 'long long int md_add(long long int, long long int)'
85 | LL md_add(LL x, LL y) {
| ^~~~~~
a.cc:12:4: note: 'long long int md_add(long long int, long long int)' previously defined here
12 | LL md_add(LL x, LL y) {
| ^~~~~~
a.cc:88:4: error: redefinition of 'long long int md_sub(long long int, long long int)'
88 | LL md_sub(LL x, LL y) {
| ^~~~~~
a.cc:15:4: note: 'long long int md_sub(long long int, long long int)' previously defined here
15 | LL md_sub(LL x, LL y) {
| ^~~~~~
a.cc:91:4: error: redefinition of 'long long int md_mul(long long int, long long int)'
91 | LL md_mul(LL x, LL y) {
| ^~~~~~
a.cc:18:4: note: 'long long int md_mul(long long int, long long int)' previously defined here
18 | LL md_mul(LL x, LL y) {
| ^~~~~~
a.cc:94:4: error: redefinition of 'long long int md_pw(long long int, long long int)'
94 | LL md_pw(LL x, LL y) {
| ^~~~~
a.cc:21:4: note: 'long long int md_pw(long long int, long long int)' previously defined here
21 | LL md_pw(LL x, LL y) {
| ^~~~~
a.cc:107:4: error: redefinition of 'long long int md_div(long long int, long long int)'
107 | LL md_div(LL x, LL y) {
| ^~~~~~
a.cc:34:4: note: 'long long int md_div(long long int, long long int)' previously defined here
34 | LL md_div(LL x, LL y) {
| ^~~~~~
a.cc:110:4: error: redefinition of 'long long int md_fact(long long int)'
110 | LL md_fact(LL n) {
| ^~~~~~~
a.cc:37:4: note: 'long long int md_fact(long long int)' previously defined here
37 | LL md_fact(LL n) {
| ^~~~~~~
a.cc:116:4: error: redefinition of 'long long int md_combi(long long int, long long int)'
116 | LL md_combi(LL n, LL r) {
| ^~~~~~~~
a.cc:43:4: note: 'long long int md_combi(long long int, long long int)' previously defined here
43 | LL md_combi(LL n, LL r) {
| ^~~~~~~~
a.cc:122:5: error: redefinition of 'int main()'
122 | int main() {
| ^~~~
a.cc:49:5: note: 'int main()' previously defined here
49 | int main() {
| ^~~~
|
s391597827
|
p04046
|
C++
|
#include<bits/stdc++.h>
#define mode 1e9+7
using namespace std;
int main(){
int n, m, a, b;
cin >> n >> m >> a >> b;
ll dp[n][m];
dp[0][0] = 0;
for(int i=0; i<=n; i++) dp[i][0] = 0;
for(int j=0; j<=m; j++) dp[0][j] = 0;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(i > (n - a) && j <= b) dp[i][j] = 0;
else{
dp[i][j] = dp[i-1][j]+dp[i][j-1];
dp[i][j] %= mod;}
}
}
cout << (int)dp[n][m] << endl;
}
|
a.cc: In function 'int main()':
a.cc:8:3: error: 'll' was not declared in this scope
8 | ll dp[n][m];
| ^~
a.cc:9:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
9 | dp[0][0] = 0;
| ^~
| dup
a.cc:17:19: error: 'mod' was not declared in this scope; did you mean 'modf'?
17 | dp[i][j] %= mod;}
| ^~~
| modf
|
s711548774
|
p04046
|
C++
|
#include<bits/stdc++.h>
#define mode 1e9+7
using namespace std;
int main(){
int n, m, a, b;
cin >> n >> m >> a >> b;
int dp[n][m];
dp[0][0] = 0;
for(int i=0; i<=n; i++) dp[i][0] = 0;
for(int j=0; j<=m; j++) dp[0][j] = 0;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(i > (n - a) && j <= b) dp[i][j] = 0;
else{
dp[i][j] = dp[i-1][j]+dp[i][j-1];
dp[i][j] %= mode;}
}
}
cout << dp[n][m] << endl;
}
|
a.cc: In function 'int main()':
a.cc:17:16: error: invalid operands of types 'int' and 'double' to binary 'operator%'
17 | dp[i][j] %= mode;}
| ^
a.cc:17:16: note: in evaluation of 'operator%=(int, double)'
|
s266748682
|
p04046
|
C++
|
#include<bits/stdc++.h>
#define mode 1e9+7
using namespace std;
int main(){
int n, m, a, b;
cin >> n >> m >> a >> b;
int dp[n][m];
dp[0][0] = 0;
for(int i=0; i<=n; i++) dp[i][0] = 0;
for(int j=0; j<=m; j++) dp[0][j] = 0;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(i > (n - a) && j <= b) dp[i][j] = 0;
else{
dp[i][j] = dp[i-1][j]+dp[i][j-1];
dp[i][j] %= mod;}
}
}
cout << dp[n][m] << endl;
}
|
a.cc: In function 'int main()':
a.cc:17:19: error: 'mod' was not declared in this scope; did you mean 'modf'?
17 | dp[i][j] %= mod;}
| ^~~
| modf
|
s889116773
|
p04046
|
C++
|
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
if (v.empty())return out;
constexpr bool is_vector_v = is_vector<T>::value;
if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr),out << ((++itr != v.end()) ? "\n" : "");
else for (auto itr = v.begin(); itr != v.end();)out << (*itr),out << ((++itr != v.end()) ? " " : "");
return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first; printf("\n"); }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first; printf(" "); put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first; printf("\n"); putn(rest...); }
template<typename T, typename U>
inline T pow(T x, U exp) {
if (exp <= 0) {
return 1;
}
if (exp % 2 == 0) {
T d = pow(x, exp / 2);
return d * d;
}
else {
return (x * pow(x, exp - 1));
}
}
template<typename T>
inline T fact(T n, vector<T>& table) {
if (n >= (int)table.size()) {
uint_fast32_t s = table.size();
for (T i = s; i < n + 1; ++i) {
table.push_back(table.back() * i);
}
}
if (n < 0) return 1;
else return table[n.a];
}
template<typename T>
inline T comb(T n, T m, vector<T>& table) {//nCm
if (n < m)return 0;
if (n - m < m)return comb(n, n - m, table);
else return fact(n, table) / fact(m, table) / fact(n - m, table);
}
template<constexpr uint_fast64_t Mod>
class ModInt {
using lint = int_fast64_t;
public:
lint a;
ModInt(lint val = 0){if(val >= Mod){val %= Mod;}a=val;}
ModInt operator-() {return ModInt(Mod - a);}//単項-演算子(-a)のオーバーロード
ModInt operator=(const ModInt& n) { a = n.a; return a; }
ModInt operator+(const ModInt& n) { if ((a + n.a) >= Mod) { return a + n.a - Mod; } else { return a + n.a; } }
ModInt operator-(const ModInt& n) {return a+(Mod-n.a);}
ModInt operator*(const ModInt& n) { return a * n.a; }
ModInt operator/(const ModInt& n) { return (*this) * pow(n, Mod - 2); }
ModInt& operator+=(const ModInt& n) { (*this) = (*this) + n; return *this; }
ModInt& operator-=(const ModInt& n) { (*this) = (*this) + (Mod-n.a); return *this; }
ModInt& operator*=(const ModInt& n) { (*this) = (*this) * n; return *this; }
ModInt& operator/=(const ModInt& n) { (*this) = (*this) / n; return *this; }
ModInt& operator++(int) { (*this) = (*this) + 1; return *this; }//前置インクリメントs(++a)のオーバーロード
ModInt& operator++() { (*this) = (*this) + 1; return *this; }//後置インクリメント(a++)のオーバーロード
ModInt& operator--(int) { (*this) = (*this) + (Mod-1); return *this; }//前置デクリメント(--a)のオーバーロード
ModInt& operator--() { (*this) = (*this) + (Mod-1); return *this; }//後置デクリメント(a--)のオーバーロード
ModInt inv() { ModInt temp(1); return temp / (*this); }//逆数を返す関数 return (*this)/(*this)/(*this);でもいい
bool operator<(const ModInt& n) { return a < n.a; }
bool operator<=(const ModInt& n) { return a <= n.a; }
bool operator>(const ModInt& n) { return a > n.a; }
bool operator>=(const ModInt& n) { return a >= n.a; }
bool operator==(const ModInt& n) { return a == n.a; }
bool operator!=(const ModInt& n) { return a != n.a; }
//下の関係演算子はpow関数で要請される
bool operator<(const int& n) { return a < n; }
bool operator<=(const int& n) { return a <= n; }
bool operator>(const int& n) { return a > n; }
bool operator>=(const int& n) { return a >= n; }
bool operator==(const int& n) { return a == n; }
ModInt operator%(const int& n) { return a % n; }
};
template<uint_fast64_t Mod> inline ostream& operator <<(ostream& o, const ModInt<Mod>& t) {o << t.a;return o;}
template<uint_fast64_t Mod> inline istream& operator >>(istream& i, ModInt<Mod>& t) {i >> t.a;return i;}
int main(){
constexpr uint_fast64_t mod = 1e9+7;
ModInt<mod> h,w,a,b;
cin >> h >> w >> a >> b;
vector<ModInt<mod>> table(1,1);
ModInt<mod> res;
for(ModInt<mod> i=1;i<h-a+1;++i){
res += comb(b+i-2,i-1,table)*comb(w-b+h-i-1,h-i,table);
}
put(res);
return 0;
}
|
a.cc:66:10: error: a parameter cannot be declared 'constexpr'
66 | template<constexpr uint_fast64_t Mod>
| ^~~~~~~~~
|
s456654103
|
p04046
|
C++
|
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int MAX = 200010;
ll factorialTable[MAX];
ll inverseFactorialTable[MAX];
//Aのp乗を求めるアルゴリズム。計算量はO(logp)
ll modpow(ll A, int p) {
if(p == 0) {
return 1;
}
if(p%2 == 0) {
//pが偶数の時
int halfP = p/2;
ll half = modpow(A, halfP);
//a^(p/2)をhalfとして、half*halfを計算
return half * half % mod;
}
else {
//pが奇数の時は、pを偶数にするために1減らす
return A * modpow(A, p-1) % mod;
}
}
void makeFactorialTable() {
ll x = 1LL;
factorialTable[0] = x;
for(int i = 1; i < MAX; i++) {
x *= i;
x %= mod;
factorialTable[i] = x;
}
}
void makeInverseFactorialTable() {
inverseFactorialTable[0] = 1LL;
for(int i = 1; i < MAX; i++) {
inverseFactorialTable[i] = modpow(factorialTable[i], mod-2);
}
}
ll Comb(int n, int r) {
ll bunbo = inverseFactorialTable[r]*inverseFactorialTable[n-r]%mod;
return factorialTable[n]*bunbo%mod;
}
int main() {
int h, w, a, b;
ll ans = 0;
cin >> h >> w >> a >> b;
for(int i = b; i < w; i++) {
ll k = Comb(h-a-1+i, h-a-1)*Comb(w+a-2-i, w-1-i)%mod;
ans += k;
ans %= mod;
}
cout << ans << endl;
return 0;
}
|
a.cc:15:19: error: size of array 'factorialTable' is not an integral constant-expression
15 | ll factorialTable[MAX];
| ^~~
a.cc:16:26: error: size of array 'inverseFactorialTable' is not an integral constant-expression
16 | ll inverseFactorialTable[MAX];
| ^~~
|
s597831244
|
p04046
|
C
|
#include <stdio.h>
int x, y, W, H, a, b;
long long dp[100000][100001];
long long dfs(int x, int y){
if(x > W || y < 1 || (x <= a && y <= B)) return 0;
if(x == W, y == 1) return 1;
if(dp[x][y] != 0) return dp[x][y];
dp[x][y] = dfs(x+1, y) + dfs(x,y+1);
return dfs(x+1, y) + dfs(x,y+1);
}
int main(void){
scanf("%d %d %d %d", &H, &W, &a, &b);
printf("%lld", dfs(1,1) % (1000000000+7));
}
|
main.c: In function 'dfs':
main.c:5:40: error: 'B' undeclared (first use in this function)
5 | if(x > W || y < 1 || (x <= a && y <= B)) return 0;
| ^
main.c:5:40: note: each undeclared identifier is reported only once for each function it appears in
|
s698862414
|
p04046
|
C++
|
#include <iostream>
#include <string.h>
using namespace std;
#define int long long
int N = 2e5+5, MOD = 1e9 + 7;
int h, w, a, b;
int fac[N], invFac[N + 1], inv[N + 1];
void calcInv()
{
inv[0] = inv[1] = 1;
for (int i = 2; i <= N; i++)
{
inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
}
}
void calcInvFac()
{
invFac[0] = invFac[1] = 1;
for (int i = 2; i <= N; i++)
{
invFac[i] = (invFac[i-1] * inv[i])%MOD;
}
}
void calcFac()
{
fac[0] = 1;
for (int i = 1; i <= N; i++)
{
fac[i] = (fac[i-1]*i % MOD)%MOD;
}
}
int nCrMOD(int n, int k)
{
if (k > n || n <= 0 || k <= 0) return 1;
return (fac[n] * invFac[k] % MOD * invFac[n-k]) % MOD;
}
signed main()
{
int ans = 0;
cin >> h >> w >> a >> b;
calcInv();
calcInvFac();
calcFac();
// cout << fac[3] << ' ' << invFac[3] << ' ' << invFac[0] << endl;
for (int i = 1; i <= h-a; i++)
{
ans = (ans + (nCrMOD(b+i-2,b-1)*nCrMOD(w-b+h-i-1,w-b-1))%MOD)%MOD;
// cout << b+i-2 << ' ' << b-1 << ' ' << nCrMOD(b+i-2,b-1) << ' ' << nCrMOD(w-b+h-i-1,w-b-1) << endl;
}
cout << ans;
}
|
a.cc:8:9: error: size of array 'fac' is not an integral constant-expression
8 | int fac[N], invFac[N + 1], inv[N + 1];
| ^
a.cc:8:22: error: size of array 'invFac' is not an integral constant-expression
8 | int fac[N], invFac[N + 1], inv[N + 1];
| ~~^~~
a.cc:8:34: error: size of array 'inv' is not an integral constant-expression
8 | int fac[N], invFac[N + 1], inv[N + 1];
| ~~^~~
|
s136923896
|
p04046
|
C++
|
#include<bits/stdc++.h>
using namespace std;
// Shortcut
//#define int long long
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)
// I/O & Debug
#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
cout << *it << " = " << a << endl;
DEB(++it, args...);
}
*/
// Functions
//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a));
#define mmset(a) memset(a, 0x3f, sizeof(a));
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());
// Data Structure
#define pque priority_queue
#define mts multiset
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;
const int N = 2e5 + 5, mod = 1e9 + 7, inf = 1e9 + 7;
int n, m, a, b;
int fac[N], inv[N];
int binpow(int a, int m){
int res = 1, now = a;
for (; m; m >>= 1, now = (now * now) % mod){
if (m & 1){
res = (res * now) % mod;
}
}
return res;
}
int C(int n, int k){
return (((fact[n] * inv[k]) % mod) * inv[n - k]) % mod;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m >> a >> b;
fac[0] = 1;
for (int i = 1; i < N; i++){
fac[i] = (fac[i - 1] * i) % mod;
}
for (int i = 0; i < N; i++){
inv[i] = binpow(fac[i], mod - 2);
}
int ans = 0, t;
int x = n - a - 1, y = b;
while (x >= 0 && y <= m - 1){
t = C(x + y, y);
t = t * C(n + m - x - y - 2, m - y - 1);
ans = (ans + t) % mod;
x--;
y++;
}
cout << ans;
}
/*
==================================+
INPUT: |
------------------------------ |
------------------------------ |
==================================+
OUTPUT: |
------------------------------ |
------------------------------ |
==================================+
*/
|
a.cc: In function 'int C(int, int)':
a.cc:83:19: error: 'fact' was not declared in this scope; did you mean 'fac'?
83 | return (((fact[n] * inv[k]) % mod) * inv[n - k]) % mod;
| ^~~~
| fac
|
s352375688
|
p04046
|
C++
|
#include "pch.h"
#include <cstdio>
typedef long long ll;
const ll MOD = 1e9 + 7;
ll fac[200001] = { 1 };
ll invfac[200001] = { 1 };
ll qpow(ll b, ll e) {
ll c = 1;
while (e) {
if (e & 1LL)
c = (c * b) % MOD;
b = (b * b) % MOD;
e /= 2LL;
}
return c;
}
ll comb(int n, int k) {
ll tmp = fac[n] * invfac[k] % MOD;
return tmp * invfac[n - k] % MOD;
}
int main()
{
int h, w, a, b;
scanf("%d%d%d%d", &h, &w, &a, &b);
for (int i = 1; i <= h + w; ++i) {
fac[i] = (fac[i - 1] * i) % MOD;
invfac[i] = qpow(fac[i], MOD - 2LL);
}
ll ans = 0;
for (int i = 1; i <= h - a; ++i) {
ans = (ans + ((comb(i - 1 + b - 1, i - 1) * comb(h + w - b - i - 1, h - i)) % MOD)) % MOD;
}
printf("%lld", ans);
}
|
a.cc:1:10: fatal error: pch.h: No such file or directory
1 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s201237064
|
p04046
|
C++
|
#include<bits/stdc++.h>
using namespace std;
const long N=2e5+5,M=1e9+7;
register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
inline long C(long n,long m){return fac[n]*ifac[m]%M*ifac[n-m]%M;}
int main(){
cin>>h>>w>>a>>b,up=max(w,h),fac[0]=fac[1]=ifac[0]=ifac[1]=1;
for(i=2;i<=up<<1;++i)fac[i]=fac[i-1]*i%M,ifac[i]=ifac[M%i]*(M-M/i)%M;
for(i=2;i<=up<<1;++i)ifac[i]=ifac[i]*ifac[i-1]%M;
for(i=1;i<=h-a;++i)(ans+=C(b+i-2,b-1)*C(h+w-b-i-1,w-b-1)%M)%=M;
cout<<ans;
}
|
a.cc:4:15: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~
a.cc:4:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~~
a.cc:4:38: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~
a.cc:4:44: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~
a.cc:4:47: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:15: error: register name not specified for 'h'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:17: error: register name not specified for 'w'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:19: error: register name not specified for 'a'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:21: error: register name not specified for 'b'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:23: error: register name not specified for 'fac'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~
a.cc:4:30: error: register name not specified for 'ifac'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~~
a.cc:4:38: error: register name not specified for 'ans'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~
a.cc:4:44: error: register name not specified for 'up'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~
a.cc:4:47: error: register name not specified for 'i'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
|
s152055688
|
p04046
|
C++
|
#include<bits/stdc++.h>
using namespace std;
const long N=2e5+5,M=1e9+7;
register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
inline long C(long n,long m){return fac[n]*ifac[m]%M*ifac[n-m]%M;}
int main(){
scanf("%d%d%d%d",&h,&w,&a,&b),up=max(w,h),fac[0]=fac[1]=ifac[0]=ifac[1]=1;
for(i=2;i<=up<<1;++i)fac[i]=fac[i-1]*i%M,ifac[i]=ifac[M%i]*(M-M/i)%M;
for(i=2;i<=up<<1;++i)ifac[i]=ifac[i]*ifac[i-1]%M;
for(i=1;i<=h-a;++i)(ans+=C(b+i-2,b-1)*C(h+w-b-i-1,w-b-1)%M)%=M;
cout<<ans;
}
|
a.cc:4:15: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~
a.cc:4:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~~
a.cc:4:38: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~
a.cc:4:44: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~
a.cc:4:47: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:15: error: register name not specified for 'h'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:17: error: register name not specified for 'w'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:19: error: register name not specified for 'a'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:21: error: register name not specified for 'b'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
a.cc:4:23: error: register name not specified for 'fac'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~
a.cc:4:30: error: register name not specified for 'ifac'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~~
a.cc:4:38: error: register name not specified for 'ans'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~~
a.cc:4:44: error: register name not specified for 'up'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^~
a.cc:4:47: error: register name not specified for 'i'
4 | register long h,w,a,b,fac[N],ifac[N],ans=0,up,i;
| ^
|
s983034382
|
p04046
|
C++
|
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
//typedef long long ll;
long long po(long a, long b){
if(b==0){
return 1;
}
long long z = po(a,b/2);
z = mod(z*z);
if(b%2!=0){
z = mod(a*z);
}
return z;
}
//配列のSIZEは問題ごとに定義する必要がある。
const int SIZE=200010;
const int MOD=i_7;
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
void invinit(){//上の配列を初期化する関数。
inv[1]=1;
for(int i=2;i<=SIZE;i++){
inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
}
kai[0]=invkai[0]=1;
for(int i=1;i<=SIZE;i++){
kai[i]=(kai[i-1]*i)%MOD;
invkai[i]=(invkai[i-1]*inv[i])%MOD;
}
}
long long comb(long long a, long long b){
if(b<0 || a<b){
return 0;
}
return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}
int main(){
int h,w,a,b;
cin>>h>>w>>a>>b;
long long ans=0;
invinit();
REP(i,h-a+1){
ans += mod(comb(b+i,b)*comb(h-i+w-b));
}
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:53:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
53 | cin>>h>>w>>a>>b;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:58:32: error: too few arguments to function 'long long int comb(long long int, long long int)'
58 | ans += mod(comb(b+i,b)*comb(h-i+w-b));
| ~~~~^~~~~~~~~
a.cc:44:11: note: declared here
44 | long long comb(long long a, long long b){
| ^~~~
a.cc:60:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
60 | cout<<ans<<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:60:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
60 | cout<<ans<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s287510661
|
p04046
|
C++
|
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
//typedef long long ll;
long long po(long a, long b){
if(b==0){
return 1;
}
long long z = po(a,b/2);
z = mod(z*z);
if(b%2!=0){
z = mod(a*z);
}
return z;
}
//配列のSIZEは問題ごとに定義する必要がある。
SIZE=200010;
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
inv[1]=1;
for(int i=2;i<=SIZE;i++){
inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
}
kai[0]=invkai[0]=1;
for(int i=1;i<=SIZE;i++){
kai[i]=(kai[i-1]*i)%MOD;
invkai[i]=(invkai[i-1]*inv[i])%MOD;
}
}
long long comb(long long a, long long b){
if(b<0 || a<b){
return 0;
}
return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}
int main(){
int h,w,a,b;
cin>>h>>w>>a>>b;
long long ans=0;
invinit();
REP(i,h-a+1){
ans += mod(comb(b+i,b)*comb(h-i+w-b));
}
cout<<ans<<endl;
return 0;
}
|
a.cc:26:1: error: 'SIZE' does not name a type
26 | SIZE=200010;
| ^~~~
a.cc:27:15: error: 'SIZE' was not declared in this scope
27 | long long inv[SIZE+1];//各iの逆元を格納する配列。
| ^~~~
a.cc:28:15: error: 'SIZE' was not declared in this scope
28 | long long kai[SIZE+1];//i!のmodを格納する配列。
| ^~~~
a.cc:29:18: error: 'SIZE' was not declared in this scope
29 | long long invkai[SIZE+1];//各i!の逆元を格納する配列。
| ^~~~
a.cc: In function 'void invinit()':
a.cc:32:5: error: 'inv' was not declared in this scope; did you mean 'int'?
32 | inv[1]=1;
| ^~~
| int
a.cc:33:20: error: 'SIZE' was not declared in this scope
33 | for(int i=2;i<=SIZE;i++){
| ^~~~
a.cc:37:5: error: 'kai' was not declared in this scope
37 | kai[0]=invkai[0]=1;
| ^~~
a.cc:37:12: error: 'invkai' was not declared in this scope
37 | kai[0]=invkai[0]=1;
| ^~~~~~
a.cc:38:20: error: 'SIZE' was not declared in this scope
38 | for(int i=1;i<=SIZE;i++){
| ^~~~
a.cc: In function 'long long int comb(long long int, long long int)':
a.cc:48:16: error: 'kai' was not declared in this scope
48 | return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
| ^~~
a.cc:48:27: error: 'invkai' was not declared in this scope
48 | return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
| ^~~~~~
a.cc: In function 'int main()':
a.cc:53:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
53 | cin>>h>>w>>a>>b;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:58:32: error: too few arguments to function 'long long int comb(long long int, long long int)'
58 | ans += mod(comb(b+i,b)*comb(h-i+w-b));
| ~~~~^~~~~~~~~
a.cc:44:11: note: declared here
44 | long long comb(long long a, long long b){
| ^~~~
a.cc:60:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
60 | cout<<ans<<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:60:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
60 | cout<<ans<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s806902558
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
long long int par(int p){
long long int output = 1;
while(p > 0){
output *= p;
p--;
}
return output;
}
const int mod = 1e9+7;
int main(){
int H, W, A, B;
cin >> H >> W >> A >> B;
long long long long long int all_c = (par(H + W - 2) / (par(H - 1) * par(W - 1))) % mod;
long long long long long int elim_c = 0;
int originalB = B;
while(B > 0){
int delB = originalB - B;
long long long long long int toroot = par(H - A - 1 + delB) / (par(H - A - 1) * par(delB));
long long long long long int fromroot = par(W - delB + A - 2) / (par(W - delB - 1) * par(A - 1));
elim_c += (toroot * fromroot) % mod;
B--;
}
elim_c = elim_c % mod;
if(all_c - elim_c > 0){
cout << (all_c - elim_c) % mod << endl;
}else{
cout << (all_c + mod - elim_c) % mod << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:18:15: error: 'long long long' is too long for GCC
18 | long long long long long int all_c = (par(H + W - 2) / (par(H - 1) * par(W - 1))) % mod;
| ^~~~
a.cc:18:20: error: 'long long long' is too long for GCC
18 | long long long long long int all_c = (par(H + W - 2) / (par(H - 1) * par(W - 1))) % mod;
| ^~~~
a.cc:18:25: error: 'long long long' is too long for GCC
18 | long long long long long int all_c = (par(H + W - 2) / (par(H - 1) * par(W - 1))) % mod;
| ^~~~
a.cc:19:15: error: 'long long long' is too long for GCC
19 | long long long long long int elim_c = 0;
| ^~~~
a.cc:19:20: error: 'long long long' is too long for GCC
19 | long long long long long int elim_c = 0;
| ^~~~
a.cc:19:25: error: 'long long long' is too long for GCC
19 | long long long long long int elim_c = 0;
| ^~~~
a.cc:23:19: error: 'long long long' is too long for GCC
23 | long long long long long int toroot = par(H - A - 1 + delB) / (par(H - A - 1) * par(delB));
| ^~~~
a.cc:23:24: error: 'long long long' is too long for GCC
23 | long long long long long int toroot = par(H - A - 1 + delB) / (par(H - A - 1) * par(delB));
| ^~~~
a.cc:23:29: error: 'long long long' is too long for GCC
23 | long long long long long int toroot = par(H - A - 1 + delB) / (par(H - A - 1) * par(delB));
| ^~~~
a.cc:24:19: error: 'long long long' is too long for GCC
24 | long long long long long int fromroot = par(W - delB + A - 2) / (par(W - delB - 1) * par(A - 1));
| ^~~~
a.cc:24:24: error: 'long long long' is too long for GCC
24 | long long long long long int fromroot = par(W - delB + A - 2) / (par(W - delB - 1) * par(A - 1));
| ^~~~
a.cc:24:29: error: 'long long long' is too long for GCC
24 | long long long long long int fromroot = par(W - delB + A - 2) / (par(W - delB - 1) * par(A - 1));
| ^~~~
|
s254448480
|
p04046
|
C++
|
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<stack>
#include<queue>
#define ll long long
using namespace std;
const int maxn=1e5+7;
const int mod=1e9+7;
ll fac[maxn],inv_fac[maxn];
ll quick(ll a,ll n){
ll res=1,t=a;
while(n){
if(n&1) res=(res*t)%mod;
t=(t*t)%mod;
n/=2;
}
return res;
}
void init(){
fac[0]=1;
for(int i=1;i<=maxn;i++) fac[i]=(fac[i-1]*i)%mod;
//inv_fac[maxn]=quick(fac[maxn],mod-2);
//for(int i=maxn-1;i>=0;i--) inv_fac[i]=(inv_fac[i+1]*(i+1))%mod;
for(int i=0;i<=maxn;i++){
inv_fac[i]=quick(fac[i],mod-2);
}
}
ll C(int n,int m){
if(n<0||m<0||m>n) return 0;
if(m==0||m==n) return 1;
return fac[n]*inv_fac[n-m]%mod*inv_fac[m]%mod;
}
int main(){
init();
//cout<<C(5,2)<<endl;
int n,m,a,b;
cin>>n>>m>>a>>b;
ll ans=0;
for(int i=b+1;i<=m1;i++) ans=(ans+(C(n-a-1+i-1,i-1)%mod*C(a-1+m-i,m-i)%mod)%mod)%mod;
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:44:22: error: 'm1' was not declared in this scope; did you mean 'm'?
44 | for(int i=b+1;i<=m1;i++) ans=(ans+(C(n-a-1+i-1,i-1)%mod*C(a-1+m-i,m-i)%mod)%mod)%mod;
| ^~
| m
|
s629294608
|
p04046
|
C++
|
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+7;
const int mod=1e9+7;
ll fac[maxn],inv_fac[maxn];
ll quick(ll a,ll n){
ll res=1,t=a;
while(n){
if(n&1) res=(res*t)%mod;
t=(t*t)%mod;
n/=2;
}
return res;
}
void init(){
fac[0]=1;
for(int i=1;i<=maxn;i++) fac[i]=(fac[i-1]*i)%mod;
//inv_fac[maxn]=quick(fac[maxn],mod-2);
//for(int i=maxn-1;i>=0;i--) inv_fac[i]=(inv_fac[i+1]*(i+1))%mod;
for(int i=0;i<=maxn;i++){
inv_fac[i]=quick(fac[i],mod-2);
}
}
ll C(int n,int m){
if(n<0||m<0||m>n) return 0;
if(m==0||m==n) return 1;
return fac[n]*inv_fac[n-m]%mod*inv_fac[m]%mod;
}
int main(){
init();
//cout<<C(5,2)<<endl;
int n,m,a,b;
cin>>n>>m>>a>>b;
ll ans=0;
for(int i=b+1;i<=m1;i++) ans=(ans+(C(n-a-1+i-1,i-1)%mod*C(a-1+m-i,m-i)%mod)%mod)%mod;
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:36:22: error: 'm1' was not declared in this scope; did you mean 'm'?
36 | for(int i=b+1;i<=m1;i++) ans=(ans+(C(n-a-1+i-1,i-1)%mod*C(a-1+m-i,m-i)%mod)%mod)%mod;
| ^~
| m
|
s482853824
|
p04046
|
C++
|
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+7;
const int mod=1e9+7;
ll fac[maxn],inv_fac[maxn];
ll quick(ll a,ll n){
ll res=1,t=a;
while(n){
if(n&1) res=(res*t)%mod;
t=(t*t)%mod;
n/=2;
}
return res;
}
void init(){
fac[0]=1;
for(int i=1;i<=maxn;i++) fac[i]=(fac[i-1]*i)%mod;
//inv_fac[maxn]=quick(fac[maxn],mod-2);
//for(int i=maxn-1;i>=0;i--) inv_fac[i]=(inv_fac[i+1]*(i+1))%mod;
for(int i=0;i<=maxn;i++){
inv_fac[i]=quick(fac[i],mod-2);
}
}
ll C(int n,int m){
if(n<0||m<0||m>n) return 0;
if(m==0||m==n) return 1;
return fac[n]*inv_fac[n-m]%mod*inv_fac[m]%mod;
}
int main(){
init();
//cout<<C(5,2)<<endl;
int n,m,a,b;
cin>>n>>m>>a>>b;
ll ans=0;
for(int i=b+1;i<=m1;i++) ans=(ans+(C(n-a-1+i-1,i-1)%mod*C(a-1+m-i,m-i)%mod)%mod)%mod;
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:36:22: error: 'm1' was not declared in this scope; did you mean 'm'?
36 | for(int i=b+1;i<=m1;i++) ans=(ans+(C(n-a-1+i-1,i-1)%mod*C(a-1+m-i,m-i)%mod)%mod)%mod;
| ^~
| m
|
s465144551
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll MOD = 1e9+7;
//Thanks for @zaki_joho
//繰り返し二乗法:a^b O(log b)
template<typename T>
T mypow(T a, T b)
{
if (b == 0)
return 1;
T tmp = mypow(a, b / 2);
if (b % 2)
return (((tmp * tmp) % MOD) * a) % MOD;
else
return (tmp * tmp) % MOD;
}
int main(){
ll h, w, a, b;
cin >> h >> w >> a >> b;
//nCk mod Mの計算テーブルを構築
vll pw(2 * 1e5 + 10), inv(2 * 1e5 + 10);
pw[0] = 1, inv[0] = 1;
REP(i, 2 * 1e5 + 5){
pw[i + 1] = (pw[i] * (i + 1)) % MOD;
inv[i + 1] = mypow(pw[i + 1], MOD - 2);
}
auto comb = [&] (ll n, ll k){
if(n == k || k == 0) return 1;
else return (((pw[n] * inv[k]) % MOD) * inv[n - k]) % MOD;
};
ll sum = comb(h + w - 2, h - 1);
ll x = b, y = h - a + 1, p, q;
while(1){
if(y > h || x < 1) break;
p = w - x + 1, q = h - y + 1;
sum = (MOD + sum - comb(x + y - 2, x - 1) * comb(p + q - 2, p - 1)) % MOD;
x--;
y++;
}
cout << sum << endl;
return 0;
}
|
a.cc: In lambda function:
a.cc:45:61: error: inconsistent types 'int' and 'long long int' deduced for lambda return type
45 | else return (((pw[n] * inv[k]) % MOD) * inv[n - k]) % MOD;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
|
s982288162
|
p04046
|
C++
|
maxn+10];
void init(){
fac[0]=1;
for(int i=1;i<=maxn;i++) fac[i]=(fac[i-1]*i)%mod;
inv_fac[maxn]=ksm(fac[maxn],mod-2);
for(int i=maxn-1;i>=0;i--) inv_fac[i]=(inv_fac[i+1]*(i+1))%mod;
}
ll C(int n,int m){
if(n < 0 || m < 0 || m > n) return 0;
if(m == 0 || m == n) return 1;
return fac[n]*inv_fac[n-m]%mod*inv_fac[m]%mod;
}
}
const ll mod = 1e9+7;
int main (){
model::init();
//cout<<model::C(5,2)<<endl;
int a,b,h,w;cin>>h>>w>>a>>b;
ll ans=0;
for(int i=b+1;i<=w;i++) ans+=(model::C(h-a-1+i-1,i-1)*model::C(a-1+w-i,a-1))%mod,ans%=mod;
cout<<ans<<endl;
return 0;
}
|
a.cc:1:1: error: 'maxn' does not name a type
1 | maxn+10];
| ^~~~
a.cc: In function 'void init()':
a.cc:4:9: error: 'fac' was not declared in this scope
4 | fac[0]=1;
| ^~~
a.cc:5:24: error: 'maxn' was not declared in this scope
5 | for(int i=1;i<=maxn;i++) fac[i]=(fac[i-1]*i)%mod;
| ^~~~
a.cc:5:54: error: 'mod' was not declared in this scope
5 | for(int i=1;i<=maxn;i++) fac[i]=(fac[i-1]*i)%mod;
| ^~~
a.cc:6:9: error: 'inv_fac' was not declared in this scope
6 | inv_fac[maxn]=ksm(fac[maxn],mod-2);
| ^~~~~~~
a.cc:6:17: error: 'maxn' was not declared in this scope
6 | inv_fac[maxn]=ksm(fac[maxn],mod-2);
| ^~~~
a.cc:6:37: error: 'mod' was not declared in this scope
6 | inv_fac[maxn]=ksm(fac[maxn],mod-2);
| ^~~
a.cc:6:23: error: 'ksm' was not declared in this scope
6 | inv_fac[maxn]=ksm(fac[maxn],mod-2);
| ^~~
a.cc: At global scope:
a.cc:10:5: error: 'll' does not name a type
10 | ll C(int n,int m){
| ^~
a.cc:15:1: error: expected declaration before '}' token
15 | }
| ^
a.cc:17:7: error: 'll' does not name a type
17 | const ll mod = 1e9+7;
| ^~
a.cc: In function 'int main()':
a.cc:20:5: error: 'model' has not been declared
20 | model::init();
| ^~~~~
a.cc:22:21: error: 'cin' was not declared in this scope
22 | int a,b,h,w;cin>>h>>w>>a>>b;
| ^~~
a.cc:23:9: error: 'll' was not declared in this scope
23 | ll ans=0;
| ^~
a.cc:24:33: error: 'ans' was not declared in this scope
24 | for(int i=b+1;i<=w;i++) ans+=(model::C(h-a-1+i-1,i-1)*model::C(a-1+w-i,a-1))%mod,ans%=mod;
| ^~~
a.cc:24:39: error: 'model' has not been declared
24 | for(int i=b+1;i<=w;i++) ans+=(model::C(h-a-1+i-1,i-1)*model::C(a-1+w-i,a-1))%mod,ans%=mod;
| ^~~~~
a.cc:24:63: error: 'model' has not been declared
24 | for(int i=b+1;i<=w;i++) ans+=(model::C(h-a-1+i-1,i-1)*model::C(a-1+w-i,a-1))%mod,ans%=mod;
| ^~~~~
a.cc:24:86: error: 'mod' was not declared in this scope
24 | for(int i=b+1;i<=w;i++) ans+=(model::C(h-a-1+i-1,i-1)*model::C(a-1+w-i,a-1))%mod,ans%=mod;
| ^~~
a.cc:25:9: error: 'cout' was not declared in this scope
25 | cout<<ans<<endl;
| ^~~~
a.cc:25:15: error: 'ans' was not declared in this scope
25 | cout<<ans<<endl;
| ^~~
a.cc:25:20: error: 'endl' was not declared in this scope
25 | cout<<ans<<endl;
| ^~~~
|
s999989007
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX_N=2e5+20;
const int MOD = 1e9+7;
ll fact[MAX_N];
int H,W,A,B;
ll powmod(ll x, ll n)
{
ll res=1;
while(n){
if(n&1) res = (res*x)%MOD;
x = (x*x)%MOD;
n >>=1;
}
return res;
}
ll C(ll n, ll m)
{
ll a=fact[n];
ll b=(fact[m]*fact[n-m])%MOD;
return (a*powmod(b,MOD-2))%MOD;
}
void solve()
{
fact[0]=1LL;
for(ll i=1;i<N;++i) fact[i]=(fact[i-1]*i)%MOD;
ll res = 0;
for(ll i=B+1;i<=W;++i){
ll cur=(C(i-1+H-A-1,H-A-1)*C(W-i+A-1, W-i))%MOD;
res = (res + cur)%MOD;
}
cout << res << endl;
}
int main()
{
cin >> H >> W >> A >> B;
solve();
return 0;
}
|
a.cc: In function 'void solve()':
a.cc:31:22: error: 'N' was not declared in this scope
31 | for(ll i=1;i<N;++i) fact[i]=(fact[i-1]*i)%MOD;
| ^
|
s255080699
|
p04046
|
C++
|
#include <iostream>
using namespace std;
template <int p>
struct Modint
{
int value;
Modint() : value(0) {}
Modint(long x) : value(x >= 0 ? x % p : (p + x % p) % p) {}
inline Modint &operator+=(const Modint &b)
{
if ((this->value += b.value) >= p)
this->value -= p;
return (*this);
}
inline Modint &operator-=(const Modint &b)
{
if ((this->value += p - b.value) >= p)
this->value -= p;
return (*this);
}
inline Modint &operator*=(const Modint &b)
{
this->value = (int)((1LL * this->value * b.value) % p);
return (*this);
}
inline Modint &operator/=(const Modint &b)
{
(*this) *= b.inverse();
return (*this);
}
Modint operator+(const Modint &b) const { return Modint(*this) += b; }
Modint operator-(const Modint &b) const { return Modint(*this) -= b; }
Modint operator*(const Modint &b) const { return Modint(*this) *= b; }
Modint operator/(const Modint &b) const { return Modint(*this) /= b; }
inline Modint &operator++(int) { return (*this) += 1; }
inline Modint &operator--(int) { return (*this) -= 1; }
inline bool operator==(const Modint &b) const { return this->value == b.value; }
inline bool operator!=(const Modint &b) const { return this->value != b.value; }
inline bool operator<(const Modint &b) const { return this->value < b.value; }
inline bool operator<=(const Modint &b) const { return this->value <= b.value; }
inline bool operator>=(const Modint &b) const { return this->value >= b.value; }
//requires that "this->value and p are co-prime"
// a_i * v + a_(i+1) * p = r_i
// r_i = r_(i+1) * q_(i+1) * r_(i+2)
// q == 1 (i > 1)
// reference: https://atcoder.jp/contests/agc026/submissions/2845729 (line:93)
inline Modint inverse() const
{
assert(this->value != 0);
int r0 = p, r1 = this->value, a0 = 0, a1 = 1;
while (r1)
{
int q = r0 / r1;
r0 -= q * r1;
swap(r0, r1);
a0 -= q * a1;
swap(a0, a1);
}
return Modint(a0);
}
friend istream &operator>>(istream &is, Modint<p> &a)
{
long t;
is >> t;
a = Modint<p>(t);
return is;
}
friend ostream &operator<<(ostream &os, const Modint<p> &a)
{
return os << a.value;
}
};
/*
verified @ https://atcoder.jp/contests/abc034/submissions/4316912
*/
const int MOD = 1e9 + 7;
using Int = Modint<MOD>;
int main(void)
{
Int ans(1), W, H;
cin >> W >> H;
W--, H--;
for (Int i(2); i <= W + H; i++)
{
ans *= i;
}
for (Int i(2); i <= W; i++)
{
ans /= i;
}
for (Int i(2); i <= H; i++)
{
ans /= i;
}
cout << ans << endl;
return 0;
}
|
a.cc: In member function 'Modint<p> Modint<p>::inverse() const':
a.cc:57:17: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
57 | assert(this->value != 0);
| ^~~~~~
a.cc:57:17: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: In instantiation of 'Modint<p> Modint<p>::inverse() const [with int p = 1000000007]':
a.cc:32:16: required from 'Modint<p>& Modint<p>::operator/=(const Modint<p>&) [with int p = 1000000007]'
32 | (*this) *= b.inverse();
| ~~^~~~~~~
a.cc:103:10: required from here
103 | ans /= i;
| ^
a.cc:57:23: error: 'assert' was not declared in this scope
57 | assert(this->value != 0);
| ~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:2:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
1 | #include <iostream>
+++ |+#include <cassert>
2 |
|
s495182206
|
p04046
|
C++
|
#include <iostream>
#include <algorithm>
using namespace std;
const int MOD=1000*1000*1000+7;
vector<long long> facts;
vector<long long> fact_invs;
vector<long long> invs;
void comb_init(int n){
facts=vector<long long>(n+1);
fact_invs=vector<long long>(n+1);
invs=vector<long long>(n+1);
facts[0]=facts[1]=1;
fact_invs[0]=fact_invs[1]=1;
invs[1]=1;
for(int i=2; i<=n; ++i){
facts[i]=facts[i-1]*i%MOD;
invs[i]=MOD-invs[MOD%i]*(MOD/i)%MOD;
fact_invs[i]=fact_invs[i-1]*invs[i]%MOD;
}
}
long long comb(long long n, long long k){
return facts[n]*(fact_invs[k]*fact_invs[n-k]%MOD)%MOD;
}
long long f(long long h, long long w){
return comb(h+w-2, w-1);
}
int main(){
int h, w, a, b; cin >> h >> w >> a >> b;
comb_init(h+w);
long long ans=f(h, w);
for(int i=0; i<b; ++i){
long long removed=f(a, w-b+i+1);
long long times=f(h-a, b-i);
ans=ans-(removed*times%MOD);
if(ans<0) ans+=MOD;
}
cout << ans << endl;
return 0;
}
|
a.cc:8:1: error: 'vector' does not name a type
8 | vector<long long> facts;
| ^~~~~~
a.cc:9:1: error: 'vector' does not name a type
9 | vector<long long> fact_invs;
| ^~~~~~
a.cc:10:1: error: 'vector' does not name a type
10 | vector<long long> invs;
| ^~~~~~
a.cc: In function 'void comb_init(int)':
a.cc:13:5: error: 'facts' was not declared in this scope
13 | facts=vector<long long>(n+1);
| ^~~~~
a.cc:13:11: error: 'vector' was not declared in this scope
13 | facts=vector<long long>(n+1);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <algorithm>
+++ |+#include <vector>
3 |
a.cc:13:18: error: expected primary-expression before 'long'
13 | facts=vector<long long>(n+1);
| ^~~~
a.cc:14:5: error: 'fact_invs' was not declared in this scope
14 | fact_invs=vector<long long>(n+1);
| ^~~~~~~~~
a.cc:14:22: error: expected primary-expression before 'long'
14 | fact_invs=vector<long long>(n+1);
| ^~~~
a.cc:15:5: error: 'invs' was not declared in this scope
15 | invs=vector<long long>(n+1);
| ^~~~
a.cc:15:17: error: expected primary-expression before 'long'
15 | invs=vector<long long>(n+1);
| ^~~~
a.cc: In function 'long long int comb(long long int, long long int)':
a.cc:27:12: error: 'facts' was not declared in this scope
27 | return facts[n]*(fact_invs[k]*fact_invs[n-k]%MOD)%MOD;
| ^~~~~
a.cc:27:22: error: 'fact_invs' was not declared in this scope
27 | return facts[n]*(fact_invs[k]*fact_invs[n-k]%MOD)%MOD;
| ^~~~~~~~~
|
s049961331
|
p04046
|
C
|
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
int kaijo(int n){
int ans=1;
for(int i=2;i<=n;i++){
ans*=i;
ans%=mod;
}
return ans;
}
int modpow(int a,int b){
if(b==0)return 1;
if(b%2)return modpow(a,b-1)*a%mod;
return modpow(a,b/2)*modpow(a,b/2)%mod;
}
int h,w,a,b,k[200010],ans;
int comb(int x,int y){
if(y==0)return 1;
return k[x]*modpow(k[x-y],mod-2)%mod*modpow(k[y],mod-2)%mod;
}
signed main(){
cin>>h>>w>>a>>b;
k[0]=1;
for(int i=1;i<=h+w;i++){
k[i]=k[i-1]*i;
k[i]%=mod;
}
for(int i=b;i<w;i++){
ans+=comb(i+h-a-1,i)*(comb(w-i-1+a-1,w-i-1)+mod)%mod;
ans%=mod;
}
cout<<ans<<endl;
return 0;
}
|
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s512728766
|
p04046
|
C++
|
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include<bits/stdc++.h>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>*/
#define sz(s) (int)(s.size())
#define all(s) s.begin(), s.end()
#define rep(a, b, c) for(int a = b; a <= c; ++a)
#define per(a, b, c) for(int a = b; a >= c; --a)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int unsigned long long
using namespace std;
//using namespace __gnu_pbds;
typedef unsigned long long ull;
typedef long long ll;
/*typedef tree<pair<int, int>,
null_type, less<pair<int, int>>,
rb_tree_tag, tree_order_statistics_node_update>
ordered_set;*/
//find_by_order() order_of_key()
const double eps = 1e-7;
const int mod = 1e9+7, MXN = 5e5+17;
const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};
template<typename T>inline bool updmin(T &a, const T &b) {return a > b ? a = b,1 : 0;}
template<typename T>inline bool updmax(T &a, const T &b) {return a < b ? a = b,1 : 0;}
int h, w, a, b;
int f[MXN], res;
inline int Add(int a, int b) {
a += b;
if(a > mod) a -= mod;
if(a < mod) a += mod;
return a;
}
inline int Mul(int a, int b) {
return (a*1ll*b)%mod;
}
inline int Pow(int a, int b) {
int res = 1;
while(b) {
if(b&1) res = Mul(res,a);
b >>= 1;
a = Mul(a,a);
}
return res;
}
inline int Div(int a, int b) {
return Mul(a,Pow(b,mod-2));
}
inline int Cnk(int n, int k) {
return Div(f[n],Mul(f[k],f[n-k]));
}
int32_t main() { _
#ifdef DanQQQQQ
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#endif
cin >> h >> w >> a >> b;
f[0] = 1;
rep(i,1,200050) f[i] = Mul(f[i-1],i);
rep(i,0,b-1) res = Add(res,Mul(Cnk(h-a+i-1,i),Cnk(w+a-i-2,a-1)));
cout << Add(Cnk(h+w-2,w-1),-res) << endl;
return 0;
}
|
a.cc:30:25: error: narrowing conversion of '-1' from 'int' to 'long long unsigned int' [-Wnarrowing]
30 | const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};
| ^~
a.cc:30:40: error: narrowing conversion of '-1' from 'int' to 'long long unsigned int' [-Wnarrowing]
30 | const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};
| ^~
|
s256827876
|
p04046
|
C++
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#define mod 1e9+7
long long exgcd(long long a, long long b, long long &x, long long &y)
{
if (b == 0)
{
x = 1;
y = 0;
return a;
}
long long d = exgcd(b, a % b, y, x);
y -= a / b * x;
return d;
}
long long inv(long long a, long long MOD)
{
long long x, y;
exgcd(a, MOD, x, y);
x = (x % MOD + MOD) % MOD;
return x;
}
long long fac[200010];
long long lucas(long long n, long long m)
{
long long ret = 1, a, b;
while (n && m)
{
a = n % mod, b = m % mod;
if (a < b) return 0;
ret = ret * fac[a] % mod * inv(fac[b] * fac[a - b] % mod, mod) % mod;
n /= mod, m /= mod;
}
return ret;
}
int main()
{
long long x, y, n, m;
scanf("%lld%lld%lld%lld", &n, &m, &x, &y);
long long ans = 0;
fac[0] = 1;
for (int i = 1; i <= 200005; i++)
fac[i] = fac[i - 1] * i % mod;
long long z = y, p = n + m - 2;
for (long long i = 0; i <= n - x - 1; i++)
{
ans = ans + lucas(z + i - 1, i) * lucas(p - z - i, n - 1 - i) % mod;
ans %= mod;
}
printf("%lld\n", ans);
}
|
a.cc: In function 'long long int lucas(long long int, long long int)':
a.cc:30:15: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
30 | a = n % mod, b = m % mod;
| ~ ^
| |
| long long int
a.cc:30:28: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
30 | a = n % mod, b = m % mod;
| ~ ^
| |
| long long int
a.cc:32:28: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
32 | ret = ret * fac[a] % mod * inv(fac[b] * fac[a - b] % mod, mod) % mod;
| ~~~~~~~~~~~~ ^
| |
| long long int
a.cc:32:60: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
32 | ret = ret * fac[a] % mod * inv(fac[b] * fac[a - b] % mod, mod) % mod;
| ~~~~~~~~~~~~~~~~~~~ ^
| |
| long long int
a.cc: In function 'int main()':
a.cc:44:41: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
44 | fac[i] = fac[i - 1] * i % mod;
| ~~~~~~~~~~~~~~ ^
| |
| long long int
a.cc:48:71: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
48 | ans = ans + lucas(z + i - 1, i) * lucas(p - z - i, n - 1 - i) % mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
| |
| long long int
a.cc:49:13: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
49 | ans %= mod;
| ^
a.cc:49:13: note: in evaluation of 'operator%=(long long int, double)'
|
s195503448
|
p04046
|
C++
|
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;
template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);
int fastpow(int x, int n, int m){
int a = 1;
IREP(i, 64){
a = (a * a) % m;
if(((n >> i) & 1) == 1) a = (a * x) % m;
}
return a;
}
class Combination
{
public:
vec fact, invfact;
int MAX_N, mod;
Combination(int MAX_N, int mod): MAX_N(MAX_N), mod(mod) {
fact = vec(MAX_N + 1);
invfact = vec(MAX_N + 1);
fact[0] = 1;
FOR(i, 1, MAX_N + 1){
fact[i] = (fact[i - 1] * i) % mod;
}
invfact[MAX_N] = fastpow(fact[MAX_N], mod - 2, mod);
IREP(MAX_N, 0){
invfact[i] = (invfact[i + 1] * (i + 1)) % mod;
}
}
int comb(int n, int r){
if(r > n || r < 0 || n < 0) return 0;
int a = fact[n];
a = (a * invfact[r]) % mod;
a = (a * invfact[n - r]) % mod;
return a;
}
};
signed main(){
int H, W, A, B; cin >> H >> W >> A >> B;
int mod = 1000000007;
Combination C(H + W, mod);
int ans = C.comb(H + W - 2, W - 1);
REP(i, B){
int tmp = C.comb(i + H - A - 1, i) * C.comb(W + A - i - 2, W - i - 1);
tmp %= mod;
ans = (ans + (mod - tmp)) % mod;
}
cout << ans;
return 0;
}
template<typename T>
void readvec(vector<T> &a){
REP(i, a.size()){
cin >> a[i];
}
}
void readindex(vector<int> &a){
REP(i, a.size()){
cin >> a[i];
a[i]--;
}
}
|
a.cc: In constructor 'Combination::Combination(long long int, long long int)':
a.cc:45:21: error: 'i' was not declared in this scope
45 | invfact[i] = (invfact[i + 1] * (i + 1)) % mod;
| ^
|
s018919644
|
p04046
|
C++
|
#include<bits/stdc++.h>
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)
using namespace std;
typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }
const ll mod = 1000000007LL;
long long extgcd(long long a,long long b,long long& x,long long& y) {
long long d = a;
if(b != 0) {
d = extgcd(b,a%b,y,x);
y -= (a/b)*x;
}
else
x = 1,y = 0;
return d;
}
long long mod_inv(long long a,long long m) {
long long x,y;
extgcd(a,m,x,y);
return (m+x%m)%m;
}
ll H,W,A,B;
#define MAX 10010000
ll fact[MAX];
void compute() {
}
int main() {
fact[0] = 1;
REP(i,1,MAX) fact[i] = ( fact[i-1] * (ll)i ) % mod;
cin >> H >> W >> A >> B;
ll ans = 0;
ll x = B-1;
for(ll y=0;y<H-A;++y) {
ll v1 = 0;
v1 = fact[x + y];
v1 = ( v1 * mod_inv(fact[x],mod) ) % mod;
v1 = ( v1 * mod_inv(fact[y],mod) ) % mod;
//if( x <= 0 || y <= 0 ) v1 = 1;
ll v2 = 0;
ll rx = W - ( x + 1 ) - 1;
ll ry = H - y - 1;
v2 = fact[rx+ry];
if( rx ) v2 = ( v2 * mod_inv(fact[rx],mod) ) % mod;
if( ry ) v2 = ( v2 * mod_inv(fact[ry],mod) ) % mod;
//if( rx <= 0 || ry <= 0 ) v2 = 1;
( ans += ( v1 * v2 ) % mod ) %= mod;
}
cout << ans % mod << endl;
compute();
return 0;
}
|
a.cc:39:13: error: unable to find numeric literal operator 'operator""\U0000ff10000'
39 | #define MAX 10010000
| ^~~~~~~~~
a.cc:40:9: note: in expansion of macro 'MAX'
40 | ll fact[MAX];
| ^~~
a.cc: In function 'int main()':
a.cc:47:3: error: 'fact' was not declared in this scope
47 | fact[0] = 1;
| ^~~~
a.cc:39:13: error: unable to find numeric literal operator 'operator""\U0000ff10000'
39 | #define MAX 10010000
| ^~~~~~~~~
a.cc:3:34: note: in definition of macro 'REP'
3 | #define REP(i,s,n) for(int i=s;i<n;++i)
| ^
a.cc:48:11: note: in expansion of macro 'MAX'
48 | REP(i,1,MAX) fact[i] = ( fact[i-1] * (ll)i ) % mod;
| ^~~
|
s215209117
|
p04046
|
C++
|
#include <iostream>
2 #include <algorithm>
3 #include <cstring>
4 #include <cstdio>
5 #include <vector>
6 #include <cstdlib>
7 #include <iomanip>
8 #include <cmath>
9 #include <ctime>
#include <map>
#include <set>
#include <queue>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
return b?gcd(b,a%b):a;
}
bool cmp(int x,int y)
{
return x>y;
}
const int N=2e5+20;
const ll mod=1e9+7;
ll f[N],n,m,A,B;
ll powmod(ll x,ll n)
{
ll s=1;
while(n){
if(n&1)
s=(s*x)%mod;
x=(x*x)%mod;
n>>=1;
}
return s;
}
ll C(ll n,ll m)
{
ll a=f[n];
ll b=(f[m]*f[n-m])%mod;
return (a*powmod(b,mod-2))%mod;
}
int main()
{
f[0]=1;
for(ll i=1;i<N;i++)
f[i]=(f[i-1]*i)%mod;
while(cin>>n>>m>>A>>B){
ll res=0;
for(ll i=B+1;i<=m;i++){
ll tmp=(C(i-1+n-A-1,n-A-1)*C(m-i+A-1,m-i))%mod;
res=(res+tmp)%mod;
}
cout<<res<<endl;
}
return 0;
}
|
a.cc:2:4: error: stray '#' in program
2 | 2 #include <algorithm>
| ^
a.cc:3:4: error: stray '#' in program
3 | 3 #include <cstring>
| ^
a.cc:4:4: error: stray '#' in program
4 | 4 #include <cstdio>
| ^
a.cc:5:4: error: stray '#' in program
5 | 5 #include <vector>
| ^
a.cc:6:4: error: stray '#' in program
6 | 6 #include <cstdlib>
| ^
a.cc:7:4: error: stray '#' in program
7 | 7 #include <iomanip>
| ^
a.cc:8:4: error: stray '#' in program
8 | 8 #include <cmath>
| ^
a.cc:9:4: error: stray '#' in program
9 | 9 #include <ctime>
| ^
a.cc:2:2: error: expected unqualified-id before numeric constant
2 | 2 #include <algorithm>
| ^
In file included from /usr/include/c++/14/map:62,
from a.cc:10:
/usr/include/c++/14/bits/stl_tree.h:227:18: error: '__aligned_membuf' in namespace '__gnu_cxx' does not name a template type
227 | __gnu_cxx::__aligned_membuf<_Val> _M_storage;
| ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h: In member function '_Val* std::_Rb_tree_node<_Val>::_M_valptr()':
/usr/include/c++/14/bits/stl_tree.h:231:16: error: '_M_storage' was not declared in this scope
231 | { return _M_storage._M_ptr(); }
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h: In member function 'const _Val* std::_Rb_tree_node<_Val>::_M_valptr() const':
/usr/include/c++/14/bits/stl_tree.h:235:16: error: '_M_storage' was not declared in this scope
235 | { return _M_storage._M_ptr(); }
| ^~~~~~~~~~
|
s739702958
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
long long fact[100010];
long long poww(long long x,long long n)
{
if(n==0) return 1;
else if(n%2==0) return poww(x,n/2) * poww(x,n/2) % mod;
else if(n%2==1) return poww(x,n/2) * poww(x,n/2) % mod * x % mod;
}
long long C(long long k,long long n)
{
return fact[n] * poww(fact[k],mod-2) % mod * poww(fact[n-k],mod-2) % mod;
}
long long main()
{
long long h,w,a,b;
cin >> h >> w >> a >> b;
fact[0]=1;
for(long long i=1;i<=100000;i++)
{
fact[i]=fact[i-1]*i;
fact[i]=fact[i] % mod;
}
//cout << C(3,5);
long long ans=0;
for(long long i=1;i<=w-b;i++)
{
ans=ans+C(h-a-1,h-a+b+i-2)*C(a-1,a+w-b-i-1)%mod;
ans=ans%mod;
}
cout << ans << "\n";
}
|
cc1plus: error: '::main' must return 'int'
a.cc: In function 'long long int poww(long long int, long long int)':
a.cc:11:1: warning: control reaches end of non-void function [-Wreturn-type]
11 | }
| ^
|
s235996169
|
p04046
|
C++
|
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int comb(long long int n, long long int k);
int main(){
int h,w,a,b;
long long int ans;
cin >> h >> w >> a >> b;
ans = comb(h,w) - comb(a,b);
cout << ans % 1000000007 << endl;
}
int comb(int n, int k){
if(k == 1 || k == n){
return 1;
}else{
return comb(n-1,k) + comb(n-1, k-1);
}
}
|
/usr/bin/ld: /tmp/ccWiTXGU.o: in function `main':
a.cc:(.text+0x67): undefined reference to `comb(long long, long long)'
/usr/bin/ld: a.cc:(.text+0x7f): undefined reference to `comb(long long, long long)'
collect2: error: ld returned 1 exit status
|
s008389763
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;
typedef priority_queue<PP, vector<PP>, greater<PP>> PPQueue;
#define fi first
#define se second
#define sfi se.fi
#define sse se.se
#define pb push_back
#define INF INT_MAX
#define MOD 1000000007
#define bcnt __builtin_popcount
#define all(x) (x).begin(),(x).end()
#define uni(x) x.erase(unique(all(x)),x.end())
#define ub(x,y) (upper_bound(all(x),y)-x.begin())
#define lb(x,y) (lower_bound(all(x),y)-x.begin())
#define rep(i,n) repl(i,0,n-1)
#define usort(x) sort(all(x))
#define dsort(x) sort(all(x),greater<ll>())
#define mkp(x,y) make_pair(x,y)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define exist(x,y) (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
DVector dp;
ll h,w,a,b;
//// 階乗(mod p)
ll fact[2e5];
void mod_fact(ll n,ll p){
fact[0]=1;
for(ll i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%p;
}
//// 冪乗(mod p)
//// xの逆元 mod_pow(x,p-2,p)
ll mod_pow(ll x,ll n,ll p){
ll res=1;
while(n>0){
if(n&1)res=res*x%p;
x=x*x%p;
n>>=1;
}
return res;
}
//// コンビネーション(mod p)
ll mod_comb(ll n,ll k,ll p){
if(n<0||k<0||n<k)return 0;
return ((fact[n]*mod_pow(fact[k],p-2,p))%p)*mod_pow(fact[n-k],p-2,p)%p;
}
int main(){
cin.sync_with_stdio(false);
cin >> h >> w >> a >> b;
ll ans = 0;
mod_fact(2e5,MOD);
rep(i,min(h - a, w - b)){
ans += mod_comb(h - a + b - 1, b + i,MOD) * mod_comb(w - b + a - 1, a + i,MOD);
ans %= MOD;
}
cout << ans << endl;
}
|
a.cc:39:9: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
39 | ll fact[2e5];
| ^~~
a.cc:39:9: error: could not convert '2.0e+5' from 'double' to 'long unsigned int'
39 | ll fact[2e5];
| ^~~
| |
| double
a.cc:39:9: error: size of array 'fact' has non-integral type 'double'
|
s275857351
|
p04046
|
C++
|
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
//#define __int64 long long
#define P pair<int,int>
int n,m;
const ll M=1000000007;
ll F[211111];
ll IF[211111];
ll invl(ll a,ll b,ll m){//ap-2乗るを返す
ll tmp=1;
while(b){
if(b&1){
tmp=(tmp*a)%m;
}
a=(a*a)%m;
b/=2;
}
return tmp%m;
}
void pow(ll m){
F[0]=1;
IF[0]=1;
for(ll i=1;i<=210000;i++){
F[i]=(F[i-1]*i)%m;
IF[i]=invl(F[i],m-2,m)%m;//逆元を、フェルマーの小定理を利用して求める
}
}
ll C(ll n,ll r,ll m){
if(n<0||r<0||r>n)return (ll)0;
if(r>n/2)r=n-r;
//cout<<F[n]<<" "<<IF[r]<<" "<<IF[n-r]<<endl;
ll ret=F[n]*IF[r]%m*IF[n-r]%m;
return ret;
}
ll t[211111];
ll h,w,a,b;
int main(){
pow(M);
cin>>h>>w>>a>>b;
for(int i=0;i<w;i++){
ll k=h-a-1;//縦に進む回数
ll ret=C(k+i,k,M);
//cout<<ret<<" ";
t[i]=(ret+M)%M;
}
for(int i=b;i<w;i++){
ll k=a;
ll ret=(C(k+w-i-1-1,k-1,M)+M)%M;
t[i]=(t[i]*ret+M)%M;
}
ll ans=t[b];
for(int i=b+1;i<w;i++)ans=(ans%M+t[i]%M+M)%M;
cout<<ans<<endl;
}
|
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:20:7: note: in expansion of macro 'll'
20 | const ll M=1000000007;
| ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:22:1: note: in expansion of macro 'll'
22 | ll F[211111];
| ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:23:1: note: in expansion of macro 'll'
23 | ll IF[211111];
| ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:25:1: note: in expansion of macro 'll'
25 | ll invl(ll a,ll b,ll m){//ap-2乗るを返す
| ^~
a.cc:39:6: error: variable or field 'pow' declared void
39 | void pow(ll m){
| ^~~
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:39:10: note: in expansion of macro 'll'
39 | void pow(ll m){
| ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:49:1: note: in expansion of macro 'll'
49 | ll C(ll n,ll r,ll m){
| ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:59:1: note: in expansion of macro 'll'
59 | ll t[211111];
| ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:60:1: note: in expansion of macro 'll'
60 | ll h,w,a,b;
| ^~
a.cc: In function 'int main()':
a.cc:63:13: error: 'M' was not declared in this scope
63 | pow(M);
| ^
a.cc:63:9: error: 'pow' was not declared in this scope
63 | pow(M);
| ^~~
a.cc:64:14: error: 'h' was not declared in this scope
64 | cin>>h>>w>>a>>b;
| ^
a.cc:64:17: error: 'w' was not declared in this scope
64 | cin>>h>>w>>a>>b;
| ^
a.cc:64:20: error: 'a' was not declared in this scope
64 | cin>>h>>w>>a>>b;
| ^
a.cc:64:23: error: 'b' was not declared in this scope
64 | cin>>h>>w>>a>>b;
| ^
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:67:17: note: in expansion of macro 'll'
67 | ll k=h-a-1;//縦に進む回数
| ^~
a.cc:68:20: error: expected ';' before 'ret'
68 | ll ret=C(k+i,k,M);
| ^~~
a.cc:70:17: error: 't' was not declared in this scope
70 | t[i]=(ret+M)%M;
| ^
a.cc:70:23: error: 'ret' was not declared in this scope; did you mean 'rep'?
70 | t[i]=(ret+M)%M;
| ^~~
| rep
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:74:17: note: in expansion of macro 'll'
74 | ll k=a;
| ^~
a.cc:75:20: error: expected ';' before 'ret'
75 | ll ret=(C(k+w-i-1-1,k-1,M)+M)%M;
| ^~~
a.cc:77:17: error: 't' was not declared in this scope
77 | t[i]=(t[i]*ret+M)%M;
| ^
a.cc:77:28: error: 'ret' was not declared in this scope; did you mean 'rep'?
77 | t[i]=(t[i]*ret+M)%M;
| ^~~
| rep
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
16 | #define ll __int64
| ^~~~~~~
a.cc:81:9: note: in expansion of macro 'll'
81 | ll ans=t[b];
| ^~
a.cc:82:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
82 | for(int i=b+1;i<w;i++)ans=(ans%M+t[i]%M+M)%M;
| ^~~
| abs
a.cc:82:42: error: 't' was not declared in this scope
82 | for(int i=b+1;i<w;i++)ans=(ans%M+t[i]%M+M)%M;
| ^
a.cc:83:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
83 | cout<<ans<<endl;
| ^~~
| abs
|
s649444742
|
p04046
|
C++
|
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#define INF 999999
using namespace std;
int maing()
{
queue<pair<int, int> > qu;
int h, w, a, b, ans = 0;
cin >> h >> w >> a >> b;
qu.push(make_pair(1, 1));
while (!qu.empty())
{
pair<int, int> pa;
pa = qu.front();
qu.pop();
if (pa.first == h&&pa.second == w) ans++;
if (pa.first < h - a && pa.second <= b || pa.first<h && pa.second>b) qu.push(make_pair(pa.first + 1, pa.second));
if (pa.second < w) qu.push(make_pair(pa.first, pa.second + 1));
}
cout << ans << endl;
return 0;
}
|
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s336472021
|
p04046
|
C++
|
// 0529.cpp : 定义控制台应用程序的入口点。
//
#ifndef ONLINE_JUDGE
#define _CRT_SECURE_NO_WARNINGS
#define gets(str) gets_s(str)
#endif
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#define INF 999999
using namespace std;
int maing()
{
queue<pair<int, int> > qu;
int h, w, a, b, ans = 0;
cin >> h >> w >> a >> b;
qu.push(make_pair(1, 1));
while (!qu.empty())
{
pair<int, int> pa;
pa = qu.front();
qu.pop();
if (pa.first == h&&pa.second == w) ans++;
if (pa.first < h - a && pa.second <= b || pa.first<h && pa.second>b) qu.push(make_pair(pa.first + 1, pa.second));
if (pa.second < w) qu.push(make_pair(pa.first, pa.second + 1));
}
cout << ans << endl;
#ifndef ONLINE_JUDGE
printf("\n");
system("pause");
#endif
return 0;
}
|
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s732356212
|
p04046
|
C++
|
#include <bits/stdc++.h>
/* Karen {{{
___ ____
|_ ||_ _|
| |_/ / ,--. _ .--. .---. _ .--.
| __'. `'_\ : [ `/'`\]/ /__\\[ `.-. |
_| | \ \_ // | |, | | | \__., | | | |
|____||____|\'-;__/[___] '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;
#define endl '\n'
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)
typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;
inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
REP(i, v.size()) {
if (i != 0) std::cout << c;
std::cout << v[i];
}
std::cout << endl;
}
template <typename T>
void print(T x) {
std::cout << x << '\n';
}
/* }}} */
/* 定数 {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */
int f[100000][100000] = {1};
int dp(int h, int w, int a, int b)
{
if (h < a || w < b) return 0;
if(f[h][w] == 0){
f[h][w] = dp(h - 1, w, a, b) + dp(h, w - 1, a, b);
}
return f[h][w];
}
signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int H = in(), W = in(), A = in(), B = in();
int sum = 0;
for (int i = H - A - 1, j = W - B - 1; j < W; j++){
sum += (dp(i, j, 0, 0) % INF + dp(i + 1, j + 1, H - 1, W - 1)) % INF;
}
cout << sum;
return (0);
}
|
g++: internal compiler error: File size limit exceeded signal terminated program as
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.
|
s146954323
|
p04046
|
C++
|
#include<iostream>
#include<vector>
#define MOD 1000000007
using namespace std;
int fast_pow(int base, int n, int M){
if (n == 0) return 0;
if (n == 1)return base;
int halfn = fast_pow(base, n / 2, M);
if (n % 2 == 0) return (long long(halfn)*halfn) % M;
else return (((long long(halfn) * halfn) % M)*base) % M;
}
int findMMI(int n, int M){
return fast_pow(n, M - 2, M);
}
int modDiv(int numerator, int denominator, int M){
int denMMI = findMMI(denominator, M);
return (long long(numerator)*denMMI) % M;
}
class PerandCom{
public:
PerandCom(int lmt, int mod){
M = mod;
modFact.push_back(1);
for (int i = 1; i <= lmt; ++i){
modFact.push_back(int((long long(modFact.back())*i) % M));
}
}
int nCr(int n, int r){
return modDiv(modFact[n], (long long(modFact[r]) * modFact[n - r]) % M, M);
}
int nPr(int n, int r){
return modDiv(modFact[n], modFact[n - r], M);
}
private:
vector<int>modFact;
int M;
};
int main()
{
int h, w, a, b;
cin >> h >> w >> a >> b;
PerandCom pAc(h + w, MOD);
long long ans = 0;
for (int t = 1; t <= h - a; ++t){
ans +=((long long)pAc.nCr(b + t - 2, b - 1)*pAc.nCr(w - b + h - t - 1, w - b - 1));
ans %= MOD;
}
cout << ans << endl;
cin >> a;
return 0;
}
|
a.cc: In function 'int fast_pow(int, int, int)':
a.cc:9:34: error: expected primary-expression before 'long'
9 | if (n % 2 == 0) return (long long(halfn)*halfn) % M;
| ^~~~
a.cc:9:34: error: expected ')' before 'long'
9 | if (n % 2 == 0) return (long long(halfn)*halfn) % M;
| ~^~~~
| )
a.cc:10:24: error: expected primary-expression before 'long'
10 | else return (((long long(halfn) * halfn) % M)*base) % M;
| ^~~~
a.cc:10:24: error: expected ')' before 'long'
10 | else return (((long long(halfn) * halfn) % M)*base) % M;
| ~^~~~
| )
a.cc:10:64: error: expected ')' before ';' token
10 | else return (((long long(halfn) * halfn) % M)*base) % M;
| ~ ^
| )
a.cc:10:64: error: expected ')' before ';' token
10 | else return (((long long(halfn) * halfn) % M)*base) % M;
| ~ ^
| )
a.cc: In function 'int modDiv(int, int, int)':
a.cc:17:17: error: expected primary-expression before 'long'
17 | return (long long(numerator)*denMMI) % M;
| ^~~~
a.cc:17:17: error: expected ')' before 'long'
17 | return (long long(numerator)*denMMI) % M;
| ~^~~~
| )
a.cc: In constructor 'PerandCom::PerandCom(int, int)':
a.cc:26:43: error: expected primary-expression before 'int'
26 | modFact.push_back(int((long long(modFact.back())*i) % M));
| ^~~
a.cc: In member function 'int PerandCom::nCr(int, int)':
a.cc:30:44: error: expected primary-expression before 'long'
30 | return modDiv(modFact[n], (long long(modFact[r]) * modFact[n - r]) % M, M);
| ^~~~
a.cc:30:44: error: expected ')' before 'long'
a.cc:30:43: note: to match this '('
30 | return modDiv(modFact[n], (long long(modFact[r]) * modFact[n - r]) % M, M);
| ^
|
s309016624
|
p04046
|
C++
|
#include<iostream>
#include<vector>
#define MOD 1000000007
using namespace std;
int fast_pow(int base, int n, int M){
if (n == 0) return 0;
if (n == 1)return base;
int halfn = fast_pow(base, n / 2, M);
if (n % 2 == 0) return (long long(halfn)*halfn) % M;
else return (((long long(halfn) * halfn) % M)*base) % M;
}
int findMMI(int n, int M){
return fast_pow(n, M - 2, M);
}
int modDiv(int numerator, int denominator, int M){
int denMMI = findMMI(denominator, M);
return (long long(numerator)*denMMI) % M;
}
class PerandCom{
public:
PerandCom(int lmt, int mod){
M = mod;
modFact.push_back(1);
for (int i = 1; i <= lmt; ++i){
modFact.push_back(int((long long(modFact.back())*i) % M));
}
}
int nCr(int n, int r){
return modDiv(modFact[n], (long long(modFact[r]) * modFact[n - r]) % M, M);
}
int nPr(int n, int r){
return modDiv(modFact[n], modFact[n - r], M);
}
private:
vector<int>modFact;
int M;
};
int main()
{
int h, w, a, b;
cin >> h >> w >> a >> b;
PerandCom pAc(h + w, MOD);
long long ans = 0;
for (int t = 1; t <= h - a; ++t){
ans +=(long long(pAc.nCr(b + t - 2, b - 1))*pAc.nCr(w - b + h - t - 1, w - b - 1));
ans %= MOD;
}
cout << ans << endl;
cin >> a;
return 0;
}
|
a.cc: In function 'int fast_pow(int, int, int)':
a.cc:9:34: error: expected primary-expression before 'long'
9 | if (n % 2 == 0) return (long long(halfn)*halfn) % M;
| ^~~~
a.cc:9:34: error: expected ')' before 'long'
9 | if (n % 2 == 0) return (long long(halfn)*halfn) % M;
| ~^~~~
| )
a.cc:10:24: error: expected primary-expression before 'long'
10 | else return (((long long(halfn) * halfn) % M)*base) % M;
| ^~~~
a.cc:10:24: error: expected ')' before 'long'
10 | else return (((long long(halfn) * halfn) % M)*base) % M;
| ~^~~~
| )
a.cc:10:64: error: expected ')' before ';' token
10 | else return (((long long(halfn) * halfn) % M)*base) % M;
| ~ ^
| )
a.cc:10:64: error: expected ')' before ';' token
10 | else return (((long long(halfn) * halfn) % M)*base) % M;
| ~ ^
| )
a.cc: In function 'int modDiv(int, int, int)':
a.cc:17:17: error: expected primary-expression before 'long'
17 | return (long long(numerator)*denMMI) % M;
| ^~~~
a.cc:17:17: error: expected ')' before 'long'
17 | return (long long(numerator)*denMMI) % M;
| ~^~~~
| )
a.cc: In constructor 'PerandCom::PerandCom(int, int)':
a.cc:26:43: error: expected primary-expression before 'int'
26 | modFact.push_back(int((long long(modFact.back())*i) % M));
| ^~~
a.cc: In member function 'int PerandCom::nCr(int, int)':
a.cc:30:44: error: expected primary-expression before 'long'
30 | return modDiv(modFact[n], (long long(modFact[r]) * modFact[n - r]) % M, M);
| ^~~~
a.cc:30:44: error: expected ')' before 'long'
a.cc:30:43: note: to match this '('
30 | return modDiv(modFact[n], (long long(modFact[r]) * modFact[n - r]) % M, M);
| ^
a.cc: In function 'int main()':
a.cc:46:24: error: expected primary-expression before 'long'
46 | ans +=(long long(pAc.nCr(b + t - 2, b - 1))*pAc.nCr(w - b + h - t - 1, w - b - 1));
| ^~~~
a.cc:46:24: error: expected ')' before 'long'
46 | ans +=(long long(pAc.nCr(b + t - 2, b - 1))*pAc.nCr(w - b + h - t - 1, w - b - 1));
| ~^~~~
| )
|
s532132377
|
p04046
|
C++
|
#include <vector>
#include <iostream>
#define MOD 1000000007
using namespace std;
long long fast_pow(long long Base, long long n, long long M){
if (n == 0) return 1;
if (n == 1) return Base;
long long halfn = fast_pow(Base, n / 2, M);
long long ans;
if (n % 2 == 0) { ans = long long(halfn * halfn) % M; }
else { ans = long long(((halfn * halfn) % M)*Base) % M; }
return ans;
}
long long findMMI(int n){
return fast_pow(n, MOD - 2, MOD);
}
long long nCr(long long n, long long r, const vector<long long>& modFact){
long long ans;
long long numerator = modFact[n];
long long denominator = long long(modFact[r] * modFact[n - r]) % MOD;
long long denMMI = findMMI(denominator);
ans = (numerator * denMMI) % MOD;
return ans;
}
int main()
{
int h, w, a, b;
cin >> h >> w >> a >> b;
vector<long long> modFact = { 1 };
for (int i = 1; i <= w + h; ++i){
modFact.push_back (long long(modFact.back()*i)%MOD);
}
long long ans = 0;
for (int t = 1; t <= h - a; ++t){
long long first = nCr(b + t - 2, b - 1, modFact);
long long second = nCr(w - b + h - t - 1, w - b - 1, modFact);
long long fcs = (first*second)%MOD;
ans +=fcs;
ans %= MOD;
}
cout << ans << endl;
cin >> a;
return 0;
}
|
a.cc: In function 'long long int fast_pow(long long int, long long int, long long int)':
a.cc:10:33: error: expected primary-expression before 'long'
10 | if (n % 2 == 0) { ans = long long(halfn * halfn) % M; }
| ^~~~
a.cc:11:22: error: expected primary-expression before 'long'
11 | else { ans = long long(((halfn * halfn) % M)*Base) % M; }
| ^~~~
a.cc: In function 'long long int nCr(long long int, long long int, const std::vector<long long int>&)':
a.cc:20:33: error: expected primary-expression before 'long'
20 | long long denominator = long long(modFact[r] * modFact[n - r]) % MOD;
| ^~~~
a.cc: In function 'int main()':
a.cc:31:36: error: expected primary-expression before 'long'
31 | modFact.push_back (long long(modFact.back()*i)%MOD);
| ^~~~
|
s914876973
|
p04046
|
C++
|
#include <vector>
#include <iostream>
#define MOD 1000000007
using namespace std;
long long fast_pow(long long Base, long long n, long long M){
if (n == 0) return 1;
if (n == 1) return Base;
long long halfn = fast_pow(Base, n / 2, M);
long long ans;
if (n % 2 == 0) ans= long long(halfn * halfn) % M;
else ans= long long (((halfn * halfn) % M)*Base) % M;
return ans;
}
long long findMMI(int n){
return fast_pow(n, MOD - 2, MOD);
}
long long nCr(long long n, long long r, const vector<long long>& modFact){
long long ans;
long long numerator = modFact[n];
long long denominator = long long(modFact[r] * modFact[n - r]) % MOD;
long long denMMI = findMMI(denominator);
ans = (numerator * denMMI) % MOD;
return ans;
}
int main()
{
int h, w, a, b;
cin >> h >> w >> a >> b;
vector<long long> modFact = { 1 };
for (int i = 1; i <= w + h; ++i){
modFact.push_back (long long(modFact.back()*i)%MOD);
}
long long ans = 0;
for (int t = 1; t <= h - a; ++t){
long long first = nCr(b + t - 2, b - 1, modFact);
long long second = nCr(w - b + h - t - 1, w - b - 1, modFact);
long long fcs = (first*second)%MOD;
ans +=fcs;
ans %= MOD;
}
cout << ans << endl;
cin >> a;
return 0;
}
|
a.cc: In function 'long long int fast_pow(long long int, long long int, long long int)':
a.cc:10:30: error: expected primary-expression before 'long'
10 | if (n % 2 == 0) ans= long long(halfn * halfn) % M;
| ^~~~
a.cc:11:19: error: expected primary-expression before 'long'
11 | else ans= long long (((halfn * halfn) % M)*Base) % M;
| ^~~~
a.cc: In function 'long long int nCr(long long int, long long int, const std::vector<long long int>&)':
a.cc:20:33: error: expected primary-expression before 'long'
20 | long long denominator = long long(modFact[r] * modFact[n - r]) % MOD;
| ^~~~
a.cc: In function 'int main()':
a.cc:31:36: error: expected primary-expression before 'long'
31 | modFact.push_back (long long(modFact.back()*i)%MOD);
| ^~~~
|
s614802844
|
p04046
|
C++
|
#include <vector>
#include <iostream>
#define MOD 1000000007
using namespace std;
long long fast_pow(long long base, long long n, long long M){
if (n == 0) return 1;
if (n == 1) return base;
long long halfn = fast_pow(base, n / 2, M);
long long ans;
if (n % 2 == 0) ans= long long(halfn * halfn) % M;
else ans= long long (((halfn * halfn) % M)*base) % M;
return ans;
}
long long findMMI(int n){
return fast_pow(n, MOD - 2, MOD);
}
long long nCr(long long n, long long r, const vector<long long>& modFact){
long long ans;
long long numerator = modFact[n];
long long denominator = long long(modFact[r] * modFact[n - r]) % MOD;
long long denMMI = findMMI(denominator);
ans = (numerator * denMMI) % MOD;
return ans;
}
int main()
{
int h, w, a, b;
cin >> h >> w >> a >> b;
vector<long long> modFact = { 1 };
for (int i = 1; i <= w + h; ++i){
modFact.push_back (long long(modFact.back()*i)%MOD);
}
long long ans = 0;
for (int t = 1; t <= h - a; ++t){
long long first = nCr(b + t - 2, b - 1, modFact);
long long second = nCr(w - b + h - t - 1, w - b - 1, modFact);
long long fcs = (first*second)%MOD;
ans +=fcs;
ans %= MOD;
}
cout << ans << endl;
cin >> a;
return 0;
}
|
a.cc: In function 'long long int fast_pow(long long int, long long int, long long int)':
a.cc:10:30: error: expected primary-expression before 'long'
10 | if (n % 2 == 0) ans= long long(halfn * halfn) % M;
| ^~~~
a.cc:11:19: error: expected primary-expression before 'long'
11 | else ans= long long (((halfn * halfn) % M)*base) % M;
| ^~~~
a.cc: In function 'long long int nCr(long long int, long long int, const std::vector<long long int>&)':
a.cc:20:33: error: expected primary-expression before 'long'
20 | long long denominator = long long(modFact[r] * modFact[n - r]) % MOD;
| ^~~~
a.cc: In function 'int main()':
a.cc:31:36: error: expected primary-expression before 'long'
31 | modFact.push_back (long long(modFact.back()*i)%MOD);
| ^~~~
|
s827615823
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
// a, bの最大公約数と, ax+by=gcd(a, b)となるx,yを求める
//拡張ユークリッドの互除法
ll extgcd(ll a, ll b, ll &x, ll &y) {
ll g = a;
if(b != 0) {
g = Extgcd(b, a % b, y, x);
y -= (a / b) * x;
}
else {
x = 1;
y = 0;
}
return g;
}
// ax = gcd(a, m) (mod m) となるxを求める(逆元)
// a, m が互いに素ならば関数値はmod m でのaの逆数となる
ll mod_inverse(ll a, ll m)
{
ll x, y;
Extgcd(a, m, x, y);
return (x % m + m) % m; //(modをとったときに0にしないためにmを足している)
}
const int MAX_N = 2 * 100010;
vector<ll> fact(MAX_N), rfact(MAX_N);
void Init() {
fact[0] = rfact[0] = 1;
for (int i = 1; i < MAX_N; ++i) {
fact[i] = (fact[i - 1] * i) % MOD;
rfact[i] = (rfact[i - 1] * mod_inverse(i, MOD)) % MOD;
}
}
inline ll Combination(ll n, ll k) {
return ((fact[n] * rfact[n - k]) % MOD) * rfact[k] % MOD;
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
Init();
ll h, w, a, b;
cin >> h >> w >> a >> b;
ll ans = 0;
for (int i = 1; i <= h - a; ++i) {
ll l1 = Combination(i + b - 2, min(i - 1, b - 1));
ll l2 = Combination(h - i + w - b - 1, min(w - b - 1, h - i));
ans = (ans + (l1 * l2) % MOD) % MOD;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'll extgcd(ll, ll, ll&, ll&)':
a.cc:13:13: error: 'Extgcd' was not declared in this scope; did you mean 'extgcd'?
13 | g = Extgcd(b, a % b, y, x);
| ^~~~~~
| extgcd
a.cc: In function 'll mod_inverse(ll, ll)':
a.cc:29:5: error: 'Extgcd' was not declared in this scope; did you mean 'extgcd'?
29 | Extgcd(a, m, x, y);
| ^~~~~~
| extgcd
a.cc: In function 'int main()':
a.cc:59:43: error: no matching function for call to 'min(int, ll)'
59 | ll l1 = Combination(i + b - 2, min(i - 1, b - 1));
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:59:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
59 | ll l1 = Combination(i + b - 2, min(i - 1, b - 1));
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:59:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
59 | ll l1 = Combination(i + b - 2, min(i - 1, b - 1));
| ~~~^~~~~~~~~~~~~~
|
s580659085
|
p04046
|
C++
|
using System;
class NumberTheory {
bool isFact;
long[] fact;
public NumberTheory(){
isFact = false;
}
public void FactTable(long n, long m){
isFact = true;
fact = new long[n+1];
fact[0] = 1;
for(long i=1;i<n+1;i++){
fact[i] = (fact[i-1]*i)%m;
}
}
public long GetFact(long n){
if(isFact && -1<n && n<=fact.Length){
return fact[n];
} else {
return -1;
}
}
public long Mod_fact(long n, long p, out long e){
e = 0;
if(!isFact){
Console.WriteLine("Error:FactTable is not created!!");
return -1;
}
if(n==0) return 1;
long res = Mod_fact(n/p,p, out e);
e += n/p;
if(n/p%2!=0) return res * (p-fact[n%p])%p;
return res*fact[n%p]%p;
}
public long Mod_cmb(long n, long k, long p){
if(n<0||k<0||n<k) return 0;
long e1,e2,e3;
long a1 = Mod_fact(n,p, out e1),a2 = Mod_fact(k,p, out e2),a3 = Mod_fact(n-k,p, out e3);
if(e1>e2+e3) return 0;
return a1 * Mod_inverse(a2*a3%p, p)%p;
}
public long Extgcd(long a, long b, out long x, out long y){
long d = a;
if(b!=0){
d = Extgcd(b,a%b, out y, out x);
y -= (a/b)*x;
} else {
x = 1; y = 0;
}
return d;
}
public long Mod_inverse(long a, long m){
long x,y;
Extgcd(a,m, out x, out y);
return (m+x%m)%m;
}
}
public class Program{
static void Main(string[] args){
long N = 1000000007;
NumberTheory nt = new NumberTheory();
string[] str = Console.ReadLine().Split(' ');
long H = long.Parse(str[0]);
long W = long.Parse(str[1]);
nt.FactTable(H+W,N);
long A = long.Parse(str[2]);
long B = long.Parse(str[3]);
long ans = 0;
for(int i=1;i<H-A+1;i++){
ans += nt.Mod_cmb(B+i-2,i-1,N) * nt.Mod_cmb(H+W-i-B-1,H-i,N) % N;
ans = ans % N;
}
Console.WriteLine(ans);
}
}
|
a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:6:9: error: expected unqualified-id before '[' token
6 | long[] fact;
| ^
a.cc:7:11: error: expected ':' before 'NumberTheory'
7 | public NumberTheory(){
| ^~~~~~~~~~~~~
| :
a.cc:11:11: error: expected ':' before 'void'
11 | public void FactTable(long n, long m){
| ^~~~~
| :
a.cc:20:11: error: expected ':' before 'long'
20 | public long GetFact(long n){
| ^~~~~
| :
a.cc:28:11: error: expected ':' before 'long'
28 | public long Mod_fact(long n, long p, out long e){
| ^~~~~
| :
a.cc:28:42: error: 'out' has not been declared
28 | public long Mod_fact(long n, long p, out long e){
| ^~~
a.cc:42:11: error: expected ':' before 'long'
42 | public long Mod_cmb(long n, long k, long p){
| ^~~~~
| :
a.cc:50:11: error: expected ':' before 'long'
50 | public long Extgcd(long a, long b, out long x, out long y){
| ^~~~~
| :
a.cc:50:40: error: 'out' has not been declared
50 | public long Extgcd(long a, long b, out long x, out long y){
| ^~~
a.cc:50:52: error: 'out' has not been declared
50 | public long Extgcd(long a, long b, out long x, out long y){
| ^~~
a.cc:61:11: error: expected ':' before 'long'
61 | public long Mod_inverse(long a, long m){
| ^~~~~
| :
a.cc:67:2: error: expected ';' after class definition
67 | }
| ^
| ;
a.cc: In member function 'void NumberTheory::FactTable(long int, long int)':
a.cc:13:9: error: 'fact' was not declared in this scope; did you mean 'isFact'?
13 | fact = new long[n+1];
| ^~~~
| isFact
a.cc: In member function 'long int NumberTheory::GetFact(long int)':
a.cc:21:33: error: 'fact' was not declared in this scope; did you mean 'isFact'?
21 | if(isFact && -1<n && n<=fact.Length){
| ^~~~
| isFact
a.cc: In member function 'long int NumberTheory::Mod_fact(long int, long int, long int)':
a.cc:31:13: error: 'Console' was not declared in this scope
31 | Console.WriteLine("Error:FactTable is not created!!");
| ^~~~~~~
a.cc:35:36: error: 'out' was not declared in this scope
35 | long res = Mod_fact(n/p,p, out e);
| ^~~
a.cc:38:38: error: 'fact' was not declared in this scope; did you mean 'isFact'?
38 | if(n/p%2!=0) return res * (p-fact[n%p])%p;
| ^~~~
| isFact
a.cc:39:20: error: 'fact' was not declared in this scope; did you mean 'isFact'?
39 | return res*fact[n%p]%p;
| ^~~~
| isFact
a.cc: In member function 'long int NumberTheory::Mod_cmb(long int, long int, long int)':
a.cc:45:33: error: 'out' was not declared in this scope
45 | long a1 = Mod_fact(n,p, out e1),a2 = Mod_fact(k,p, out e2),a3 = Mod_fact(n-k,p, out e3);
| ^~~
a.cc:47:33: error: 'a2' was not declared in this scope; did you mean 'a1'?
47 | return a1 * Mod_inverse(a2*a3%p, p)%p;
| ^~
| a1
a.cc:47:36: error: 'a3' was not declared in this scope; did you mean 'a1'?
47 | return a1 * Mod_inverse(a2*a3%p, p)%p;
| ^~
| a1
a.cc: In member function 'long int NumberTheory::Extgcd(long int, long int, long int, long int)':
a.cc:53:31: error: 'out' was not declared in this scope
53 | d = Extgcd(b,a%b, out y, out x);
| ^~~
a.cc:53:42: error: expected ')' before 'x'
53 | d = Extgcd(b,a%b, out y, out x);
| ^
a.cc:53:23: note: to match this '('
53 | d = Extgcd(b,a%b, out y, out x);
| ^
a.cc: In member function 'long int NumberTheory::Mod_inverse(long int, long int)':
a.cc:63:21: error: 'out' was not declared in this scope
63 | Extgcd(a,m, out x, out y);
| ^~~
a.cc:63:32: error: expected ')' before 'y'
63 | Extgcd(a,m, out x, out y);
| ^
a.cc:63:15: note: to match this '('
63 | Extgcd(a,m, out x, out y);
| ^
a.cc: At global scope:
a.cc:69:1: error: expected unqualified-id before 'public'
69 | public class Program{
| ^~~~~~
|
s222832127
|
p04046
|
Java
|
import java.util.Scanner;
import java.math.*;
/**
* http://abc042.contest.atcoder.jp/tasks/arc058_b
* @author Cummin
*/
public class Main {
public static void main(String[] args) {
int H, W, A, B ;
// データの読み込み
Scanner sc = new Scanner(System.in);
H = sc.nextInt();
W = sc.nextInt();
A = sc.nextInt();
B = sc.nextInt();
BigInteger mod1000000007 = new BigInteger("1000000007") ;
BigInteger Bans1= new BigInteger("1") ;
long ans1[] = new long[(H-A)] ;
ans1[0] = 1 ;
for (int i=2; i <=H-A; i++) {
Bans1 = (Bans1.multiply(BigInteger.valueOf(B+i-2))).divide(BigInteger.valueOf(i-1)) ;
ans1[i-1] = Bans1.mod(mod1000000007).intValue() ;
BigInteger Bans2= new BigInteger("1") ;
long ans2[] = new long[(H)] ;
ans2[0] = 1 ;
for (int i=2; i <=H; i++) {
Bans2 = Bans2.multiply(BigInteger.valueOf(((W-B)+i-2))).divide(BigInteger.valueOf(i-1)) ;
ans2[i-1] = Bans2.mod(mod1000000007).intValue() ;
}
long ans = 0 ;
for (int i=0; i<(H-A); i++) {
ans = (ans + ans1[i]*ans2[(int)(H-1)-i]) % 1000000007 ;
System.out.println(ans) ;
}
}
|
Main.java:40: error: reached end of file while parsing
}
^
1 error
|
s453101899
|
p04046
|
C++
|
#include <iostream>
#include <string>
#define int long long
using namespace std;
const int MOD = 1e9+7;
int pot(int x, int p) {
if (p == 0) return 1;
int z = pot(x, p/2);
z = (z*z)%MOD;
if (p%2) z = (z*x) % MOD;
return z;
}
int inv(int x) {
return pot(x, MOD-2);
}
int pows[200000 + 10];
int powsinv[200000 + 10];
int calc(int a, int b) {
int x = pows[a+b-2] * powsinv[a-1] % MOD;
x = x * powsinv[b-1] % MOD;
return x;
}
signed main(){
pows[0] = 1; powsinv[0] = 1;
for (int i = 1; i < 200000 + 10; i++) {
pows[i] = (pows[i-1] * i) % MOD;
powsinv[i] = inv(pows[i]);
}
int res = 0;
for (int i = b+1; i <= w; i++) {
int x = calc(h - a, i) * calc(a, w-i+1) % MOD;
res = (res + x) % MOD;
}
cout << res << "\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:36:14: error: 'b' was not declared in this scope
36 | for (int i = b+1; i <= w; i++) {
| ^
a.cc:36:24: error: 'w' was not declared in this scope
36 | for (int i = b+1; i <= w; i++) {
| ^
a.cc:37:16: error: 'h' was not declared in this scope
37 | int x = calc(h - a, i) * calc(a, w-i+1) % MOD;
| ^
a.cc:37:20: error: 'a' was not declared in this scope
37 | int x = calc(h - a, i) * calc(a, w-i+1) % MOD;
| ^
|
s407681242
|
p04046
|
C++
|
#include <iostream>
#include <string>
#define int long long
using namespace std;
const int MOD = 1e9+7;
int pot(int x, int p) {
if (p == 0) return 1;
int z = pot(x, p/2);
z = (z*z)%MOD;
if (p%2) z = (z*x) % MOD;
return z;
}
int inv(int x) {
return pot(x, MOD-2);
}
int pows[20000 + 10];
int powsinv[20000 + 10];
int calc(int a, int b) {
int x = pows[a+b-2] * powsinv[a-1] % MOD;
x = x * powsinv[b-1] % MOD;
return x;
}
signed main(){
pows[0] = 1; powsinv[0] = 1;
for (int i = 1; i < 20000 + 10; i++) {
pows[i] = (pows[i-1] * i) % MOD;
powsinv[i] = inv(pows[i]);
}
int res = 0;
for (int i = b+1; i <= w; i++) {
int x = calc(h - a, i) * calc(a, w-i+1) % MOD;
res = (res + x) % MOD;
}
cout << res << "\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:36:14: error: 'b' was not declared in this scope
36 | for (int i = b+1; i <= w; i++) {
| ^
a.cc:36:24: error: 'w' was not declared in this scope
36 | for (int i = b+1; i <= w; i++) {
| ^
a.cc:37:16: error: 'h' was not declared in this scope
37 | int x = calc(h - a, i) * calc(a, w-i+1) % MOD;
| ^
a.cc:37:20: error: 'a' was not declared in this scope
37 | int x = calc(h - a, i) * calc(a, w-i+1) % MOD;
| ^
|
s363504018
|
p04046
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF INT_MAX/3
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cout<<#x<<":"<<x<<endl
#define debug2(x,y) cout<<#x<<","<<#y":"<<x<<","<<y<<endl
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& vec){
os << "[";
for(const auto& v : vec){
os << v << ",";
}
os << "]";
return os;
}
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const ll MOD = 1e9+7;
ll fact[200002];
ll fact_inv[200002];
ll mod_pow(ll x,ll n,ll mod){
ll res=1;
while(n){
if(n&1) res = (res*x)%mod;
x = (x*x)%mod;
n>>=1;
}
return res;
}
ll invp(ll x,ll mod){
return mod_pow(x,mod-2,mod);
}
ll nCr(ll n,ll r,ll mod){
ll ret = fact[n];
ret = (ret * fact_inv[r]) % mod;
ret = (ret * fact_inv[n-r]) % mod;
return ret;
}
void init(){
fact[0]=1;
for(int i=1;i<MAX_N;i++) fact[i]=(fact[i-1]*i)%MOD;
for(int i=0;i<MAX_N;i++) fact_inv[i]=invp(fact[i],MOD);
}
int main(){
ll H,W,A,B;
cin>>H>>W>>A>>B;
init();
ll ans = 0;
for(int i=B+1;i<=W;i++){
int le = i-1;
int hi = H-A-1;
ll tmp1 = nCr(le+hi,hi,MOD);
int ri = W-i;
int un = A-1;
ll tmp2 = nCr(ri+un,un,MOD);
ll tmp = (tmp1 * tmp2) % MOD;
ans = (ans+tmp) % MOD;
}
cout << ans << endl;
}
|
a.cc: In function 'void init()':
a.cc:57:19: error: 'MAX_N' was not declared in this scope
57 | for(int i=1;i<MAX_N;i++) fact[i]=(fact[i-1]*i)%MOD;
| ^~~~~
a.cc:58:19: error: 'MAX_N' was not declared in this scope
58 | for(int i=0;i<MAX_N;i++) fact_inv[i]=invp(fact[i],MOD);
| ^~~~~
|
s927875075
|
p04046
|
C++
|
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define mod 1e9+ 7
int main(){
int h, w, a, b;
int dp[2][100000];
cin >> h >> w >> a >> b;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (i >= h - a && j >= w - b) break;
else {
dp[1][j] = dp[0][j];
if (j)
dp[1][j] = dp[1][j - 1];
}
}
for (int j = 0; < w; j++) {
dp[0][j] = dp[1][j];
dp[1][j] = 0;
}
}
cout << dp[1][w -1] << endl;
}
/*2232 9
0 1 3 4 5 6 9 7 8
*/
|
a.cc: In function 'int main()':
a.cc:19:33: error: expected primary-expression before '<' token
19 | for (int j = 0; < w; j++) {
| ^
|
s979219426
|
p04046
|
C++
|
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define MAX 100000
int main() {
int H, W, A, B; cin >> H >> W >> A >> B;
static int b[MAX][MAX] = { 1 };
for (int h = 0; h < H; h++) {
for (int w = 0; w < W; w++) {
if (h + 1 < H - A || B - 1 < w)
b[h + 1][w] += b[h][w];
if (h < H - A || B - 1 < w + 1)
b[h][w + 1] += b[h][w];
b[h + 1][w] %= MOD;
b[h][w + 1] %= MOD;
}
}
cout << b[H - 1][W - 1] << endl;
return 0;
}
|
g++: internal compiler error: File size limit exceeded signal terminated program as
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.
|
s233366057
|
p04046
|
C++
|
#include <cstdio>
#define mod 1000000007
using namespace std;
int H, W, A, B, fact[222222], inv[222222], factinv[222222], z[222222], ret;
inline int ncr(int xx, int yy) {
if (xx < 0 || yy < 0 || xx < yy) return 0;
return 1LL * fact[xx] * factinv[yy] % mod * factinv[xx - yy] % mod;
}
int main() {
fact[0] = 1;
for (int i = 1; i <= 200009; i++) fact[i] = 1LL * fact[i - 1] * i % mod;
inv[1] = 1;
for (int i = 2; i <= 200009; i++) inv[i] = 1LL * inv[mod % i] * (mod - mod / i) % mod;
factinv[0] = 1;
for (int i = 1; i <= 200009; i++) factinv[i] = 1LL * factinv[i - 1] * inv[i] % mod;
scanf("%d%d%d%d", &H, &W, &A, &B);
for (int i = 0; i < W - B; i++) ret = (ret + 1LL * ncr(A + i - 1, i) * ncr(W - i + H - A - 2, H - A - 1) % mod;
printf("%d\n", ret);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:119: error: expected ')' before ';' token
17 | for (int i = 0; i < W - B; i++) ret = (ret + 1LL * ncr(A + i - 1, i) * ncr(W - i + H - A - 2, H - A - 1) % mod;
| ~ ^
|
s666257462
|
p04047
|
Java
|
import java.util.Arrays;
import java.util.Scanner;
public class BBQ_Easy {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int k=sc.nextInt(), res=0;
int[] s=new int[k*2];
for(int i=0; i<k*2; ++i) s[i]=sc.nextInt();
Arrays.sort(s);
for(int i=k*2-1; i>=0; --i)
if(i%2==0) res+=s[i];
System.out.println(res);
sc.close();
}
}
|
Main.java:4: error: class BBQ_Easy is public, should be declared in a file named BBQ_Easy.java
public class BBQ_Easy {
^
1 error
|
s932392466
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int a[2*n];
for(int i = 0; i < 2*n; ++i){
cin >> a[i];
}
sort(a,a+2*n);
int res = 0;
for(int i = 0; i < 2*n; i += 2){
res += a[i]
}
cout << res << endl;
}
|
a.cc: In function 'int main()':
a.cc:14:16: error: expected ';' before '}' token
14 | res += a[i]
| ^
| ;
15 | }
| ~
|
s404279183
|
p04047
|
C++
|
#incldue <bits/stdc++.h>
using namespace std;
int main () {
int n;
cin >> n;
vector <int> L(2*n);
for (int i=0; i<L.size(); i++)
cin >> L[i];
sort (L.begin(), L.end());
int res = 0;
for (int i=0; i<L.size(); i+=2) {
res += min (L[i], L[i+1]);
}
cout << res;
}
|
a.cc:1:2: error: invalid preprocessing directive #incldue; did you mean #include?
1 | #incldue <bits/stdc++.h>
| ^~~~~~~
| include
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
6 | cin >> n;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #incldue <bits/stdc++.h>
a.cc:7:9: error: 'vector' was not declared in this scope
7 | vector <int> L(2*n);
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | #incldue <bits/stdc++.h>
a.cc:7:17: error: expected primary-expression before 'int'
7 | vector <int> L(2*n);
| ^~~
a.cc:9:25: error: 'L' was not declared in this scope
9 | for (int i=0; i<L.size(); i++)
| ^
a.cc:12:15: error: 'L' was not declared in this scope
12 | sort (L.begin(), L.end());
| ^
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort (L.begin(), L.end());
| ^~~~
| short
a.cc:15:16: error: 'min' was not declared in this scope; did you mean 'main'?
15 | res += min (L[i], L[i+1]);
| ^~~
| main
a.cc:18:9: error: 'cout' was not declared in this scope
18 | cout << res;
| ^~~~
a.cc:18:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s209137770
|
p04047
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> L(2*N);
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
sort(L.begin(),L.end());
int ans=0;
for(int i = 0; i < 2 * N; i +=2){
ans+ = L[i];
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(L.begin(),L.end());
| ^~~~
| short
a.cc:15:10: error: expected primary-expression before '=' token
15 | ans+ = L[i];
| ^
|
s750317498
|
p04047
|
Java
|
import java.util.*;
public class Main{
public static void main(){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int sum=0;
int[] L=new int[n*2];
for(int i=0;i<L.length;i++){
L[i]=sc.nextInt();
}
sort(L);
for(int i=0;i<L.length;i+=2){
sum+=L[i];
}
System.out.println(sum);
}
}
|
Main.java:11: error: cannot find symbol
sort(L);
^
symbol: method sort(int[])
location: class Main
1 error
|
s006519324
|
p04047
|
Java
|
import java.util.*;
public class Main{
public static void main(){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int sum=0;
int[] L=new int[n*2];
for(int i=0;i<L.length;i++){
L[i]=sc.nextInt();
}
sort(L);
for(int i=0;i<L.length;i+=2){
sum+=L[i];
}
System.out.println(sum);
}
|
Main.java:16: error: reached end of file while parsing
}
^
1 error
|
s633707604
|
p04047
|
C
|
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) {
// TODO Auto-generated method stub
InputReader scn = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
int n = scn.nextInt();
int[] arr = new int[2 * n];
for (int i = 0; i < 2 * n; i++) {
arr[i] = scn.nextInt();
}
Arrays.sort(arr);
long ans = 0;
for (int i = 2 * n - 2; i >= 0; i--) {
int a = arr[i];
i--;
ans += a;
}
out.println(ans);
out.close();
}
public static boolean CountFrequencies(String[] arr) {
HashMap<String, Integer> map = new HashMap<>();
for (int i = 0; i < arr.length; i++) {
String a = arr[i];
if (map.containsKey(a)) {
map.put(a, map.get(a) + 1);
} else {
map.put(a, 1);
}
}
for (String val : map.keySet()) {
String val1 = val;
int val2 = map.get(val);
if (val2 % 2 != 0) {
return false;
}
}
return true;
}
public static int gcd(int a, int b) {
if (a == 0)
return b;
return gcd(b % a, a);
}
public static int lcm(int a, int b) {
return (a * b) / gcd(a, b);
}
public static ArrayList<String> GetSubSequences(String s) {
if (s.length() == 0) {
ArrayList<String> br = new ArrayList<>();
br.add("");
return br;
}
char ch = s.charAt(0);
String ms = s.substring(1);
ArrayList<String> rr = GetSubSequences(ms);
ArrayList<String> mr = new ArrayList<>();
int t = rr.size();
for (int i = 0; i < t; i++) {
mr.add(rr.get(i));
mr.add(ch + rr.get(i));
}
return mr;
}
public static int binarySearch(int arr[], int l, int r, int x) {
if (r >= l) {
int mid = l + (r - l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, mid - 1, x);
return binarySearch(arr, mid + 1, r, x);
}
return -1;
}
public static int firstOccurence(int array1[], int low, int high, int x, int n) {
if (low <= high) {
int mid = low + (high - low) / 2;
if ((mid == 0 || x > array1[mid - 1]) && array1[mid] == x)
return mid;
else if (x > array1[mid])
return firstOccurence(array1, (mid + 1), high, x, n);
else
return firstOccurence(array1, low, (mid - 1), x, n);
}
return -1;
}
public static int lastOccurence(int array2[], int low, int high, int x, int n) {
if (low <= high) {
int mid = low + (high - low) / 2;
if ((mid == n - 1 || x < array2[mid + 1]) && array2[mid] == x)
return mid;
else if (x < array2[mid])
return lastOccurence(array2, low, (mid - 1), x, n);
else
return lastOccurence(array2, (mid + 1), high, x, n);
}
return -1;
}
public static boolean isPrime(long n) {
if (n < 2)
return false;
if (n == 2 || n == 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
long sqrtN = (int) Math.sqrt(n) + 1;
for (long i = 6L; i <= sqrtN; i += 6) {
if (n % (i - 1) == 0 || n % (i + 1) == 0)
return false;
}
return true;
}
public static void quickSort(int[] arr, int lo, int hi) {
if (lo >= hi) {
return;
}
int mid = (lo + hi) / 2;
int pivot = arr[mid];
int left = lo;
int right = hi;
while (left <= right) {
while (arr[left] < pivot) {
left++;
}
while (arr[right] > pivot) {
right--;
}
if (left <= right) {
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
left++;
right--;
}
}
quickSort(arr, lo, right);
quickSort(arr, left, hi);
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public String nextLine() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String next() {
return nextLine();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void print(Object... objects) {
for (int i = 0; i < objects.length; i++) {
if (i != 0) {
writer.print(' ');
// writer.print(1);
}
writer.print(objects[i]);
}
}
public void println(Object... objects) {
print(objects);
writer.println();
}
public void close() {
writer.close();
}
}
}
|
main.c:1:1: error: unknown type name 'import'
1 | import java.io.*;
| ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
1 | import java.io.*;
| ^
main.c:2:1: error: unknown type name 'import'
2 | import java.util.*;
| ^~~~~~
main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
2 | import java.util.*;
| ^
main.c:4:1: error: unknown type name 'public'
4 | public class Main{
| ^~~~~~
main.c:4:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
4 | public class Main{
| ^~~~
|
s572566695
|
p04047
|
Java
|
import java.util.Arrays;
import java.util.Scanner;
public class Barbeque {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int sum=0;
int arr[]=new int[2*n];
for(int i=0;i<2*n;i++)
{
arr[i]=sc.nextInt();
}
Arrays.sort(arr);
for(int j=0;j<2*n;j=j+2) {
sum=sum+Math.min(arr[j], arr[j+1]);
}
System.out.println(sum);
sc.close();
}
}
|
Main.java:4: error: class Barbeque is public, should be declared in a file named Barbeque.java
public class Barbeque {
^
1 error
|
s735818609
|
p04047
|
Java
|
import java.util.Arrays;
import java.util.Scanner;
public class Barbeque {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int sum=0;
int arr[]=new int[2*n];
for(int i=0;i<2*n;i++)
{
arr[i]=sc.nextInt();
}
Arrays.sort(arr);
for(int j=0;j<2*n;j=j+2) {
sum=sum+Math.min(arr[j], arr[j+1]);
}
System.out.println(sum);
sc.close();
}
}
|
Main.java:4: error: class Barbeque is public, should be declared in a file named Barbeque.java
public class Barbeque {
^
1 error
|
s574265568
|
p04047
|
Java
|
import java.util.*;
public class Traning {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt() * 2;
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
Arrays.sort(a);
int sum = 0;
for (int i = 0; i < n; i += 2) {
sum += a[i];
}
System.out.println(sum);
}
}
|
Main.java:4: error: class Traning is public, should be declared in a file named Traning.java
public class Traning {
^
1 error
|
s182931600
|
p04047
|
C++
|
#include<iostream>
using namespace std;
#define int long long int
int32_t main()
{
int n;
cin>>n;
int arr[2*n],j;
for(j=0;j<2*n;j++)
cin>>arr[j];
sort(arr,arr+2*n);
int answer=0;
for(j=0;j<2*n;j+=2)
answer+=arr[j];
cout<<answer<<endl;
}
|
a.cc: In function 'int32_t main()':
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(arr,arr+2*n);
| ^~~~
| short
|
s404924929
|
p04047
|
C++
|
#include<bits/stdc.h++>
#include<iostream>
using namespace std;
int main() {
int N;
cin>>N;
vector<int> a(N*2);
for(int i=0;i<N*2;i++) cin>>a[i];
sort(a.begin(),a.end());
long ans=0;
for(int i=0;i<N;i++){
ans+= min(a[2*i],a[2*i+1]);
}
cout<<ans<<endl;
}
|
a.cc:1:9: fatal error: bits/stdc.h++: No such file or directory
1 | #include<bits/stdc.h++>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s375356833
|
p04047
|
C++
|
using namespace std;
int main() {
int N;
cin>>N;
vector<int>
a(N*2);
for(int i=0;i<N*2;i++)
cin>>a[i];
sort(a.begin(),a.end());
long ans=0;
for(int i=0;i<N;i++){
ans+= min(a[2*i],a[2*i+1]);
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:6:1: error: 'cin' was not declared in this scope
6 | cin>>N;
| ^~~
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:7:1: error: 'vector' was not declared in this scope
7 | vector<int>
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | using namespace std;
a.cc:7:8: error: expected primary-expression before 'int'
7 | vector<int>
| ^~~
a.cc:11:8: error: 'a' was not declared in this scope
11 | cin>>a[i];
| ^
a.cc:13:6: error: 'a' was not declared in this scope
13 | sort(a.begin(),a.end());
| ^
a.cc:13:1: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort(a.begin(),a.end());
| ^~~~
| short
a.cc:17:9: error: 'min' was not declared in this scope; did you mean 'main'?
17 | ans+= min(a[2*i],a[2*i+1]);
| ^~~
| main
a.cc:19:1: error: 'cout' was not declared in this scope
19 | cout<<ans<<endl;
| ^~~~
a.cc:19:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:12: error: 'endl' was not declared in this scope
19 | cout<<ans<<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;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.