submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s058869820
p04039
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define REPP(i,n) for(int i=1;i<=n;i++) const double PI = acos(-1); const double EPS = 1e-15; 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; } using namespace std; bool prime(int n){ if(n==1){ return false; }else if(n==2){ return true; }else{ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } } long long gcd(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd(b,a%b); } } long long lcm(long long x, long long y){ return (x/gcd(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ int n,k; cin>>n>>k; int d[k]; REP(i,k){ cin>>d[i]; } int dp[10000];//i以上でいろはちゃんのこだわりを満たす数。 bool usable[10]={};//0~9が使えるかどうかを記録する配列。 int index=0; REP(i,10){ if(index<k && i==d[index]){ index++; continue; }else{ usable[i]=true; } } int ans; int temp; bool flag=true; for(int i=n;i<100000){ temp=i; while(temp>0){ if(usable[temp%10]){ temp /= 10; }else{ flag = false; break; } } if(flag){ ans = i; break; }else{ flag = true; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:110:23: error: expected ';' before ')' token 110 | for(int i=n;i<100000){ | ^ | ;
s190762119
p04039
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define REPP(i,n) for(int i=1;i<=n;i++) const double PI = acos(-1); const double EPS = 1e-15; 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; } using namespace std; bool prime(int n){ if(n==1){ return false; }else if(n==2){ return true; }else{ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } } long long gcd(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd(b,a%b); } } long long lcm(long long x, long long y){ return (x/gcd(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ int n,k; cin>>n>>k; int d[k]; REP(i,k){ cin>>d[i]; } int dp[10000];//i以上でいろはちゃんのこだわりを満たす数。 bool usable[10]={};//0~9が使えるかどうかを記録する配列。 index=0; REP(i,10){ if(index<k && i==d[index]){ index++; continue; }else{ usable[i]=true; } } int ans; int temp; bool flag=true; for(int i=n;i<100000){ temp=i; while(temp>0){ if(usable[temp%10]){ temp /= 10; }else{ flag = false; break; } } if(flag){ ans = i; break; }else{ flag = true; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:98:9: error: overloaded function with no contextual type information 98 | index=0; | ^ a.cc:100:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<' 100 | if(index<k && i==d[index]){ | ~~~~~^~ a.cc:100:23: error: invalid types 'int [k][<unresolved overloaded function type>]' for array subscript 100 | if(index<k && i==d[index]){ | ^ a.cc:101:12: error: no post-increment operator for type 101 | index++; | ^~ a.cc:110:23: error: expected ';' before ')' token 110 | for(int i=n;i<100000){ | ^ | ;
s936366813
p04039
C++
#include<bits/stdc++.h> #define mins(a,b) a=min(a,b) #define maxs(a,b) a=max(a,b) template < typename T > std::string to_string( const T& n ) { std::ostringstream stm ; stm << n ; return stm.str() ; } } using namespace std; const long long INF=9000000000000000; int main(){ int n,x; cin>>n>>x; char num[x]; for(int i=0;i<x;i++){ cin>>num[i]; } string s; int ok=0; for(int i=n;i<100010;i++){ s=to_string(i); for(int j=0;j<s.size();j++){ for(int k=0;k<x;k++){ if(s[j]==num[k]) ok++; } } if(ok==0){ cout<<s<<endl; break; } } }
a.cc:10:1: error: expected declaration before '}' token 10 | } | ^
s285119970
p04039
C++
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define repo(i,o,n) for(int i=o;i<(int)(n);i++) #define repm(i,n) for(int i=(int)(n)-1;i>=0;i--) #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define sperase(v,n) (v).erase(remove(all(v), n), (v).end()); #define vdelete(v) (v).erase(unique(all(v)), (v).end()); #define pb(n) push_back(n); int n,k,d; vector<int> v; main() { cin >> n >> k; rep(i,k) cin >> d,v.pb(d); for(int i=n;;i++) { int f=1,tmp = i; while (tmp /= 10,tmp) { auto itr = lower_bound(all(v),tmp%10); if (*itr == tmp%10 || itr == v.end();) goto hoge; } cout << i << endl; return 0; hoge:; } }
a.cc:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 20 | main() { | ^~~~ a.cc: In function 'int main()': a.cc:27:50: error: expected primary-expression before ')' token 27 | if (*itr == tmp%10 || itr == v.end();) goto hoge; | ^
s034699567
p04039
C++
#include <iostream> #include <string> #include <vector> #include <utility> #include <functional> #include <numeric> #include <list> #include <set> #include <map> #include <algorithm> #include <cmath> #include <limits> #include <iomanip> #include <bitset> #include <queue> using namespace std; typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } #define rep(i, n) for(int i = 0;i < n;i++) const long long INF = 1LL << 60; int MOD = 1000000007; int main(){ std::ios_base::sync_with_stdio(false); string n; int k; cin>>n>>k; bool usable[10]; rep(i,10) usable[i]=true; rep(i,k){ int m;cin>>m; usable[m]=false; } bool we=false; string ans=""; rep(i,n.size()){ if(we){ rep(i,10){ if(usable[i]){ ans+=to_string(i); } } } else{ if(usable[stoi(n[i])]){ ans+=n[i]; continue; } for(int j=stoi(n[i])+1; j<10;++j){ if(usable[j]){ ans+=to_string(j); we=true; break; } } } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:50:23: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 50 | if(usable[stoi(n[i])]){ | ~~~~^~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)' 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)' 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~ a.cc:54:23: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 54 | for(int j=stoi(n[i])+1; j<10;++j){ | ~~~~^~~~~~ /usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)' 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)' 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~
s667298109
p04039
C++
#include <iostream> #include<vector> using namespace std; /* #include <boost/multiprecision/cpp_int.hpp> using namespace boost::multiprecision; using cint = cpp_int; */ // Define using ll = long long; using ull = unsigned long long; using ld = long double; const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, 1, 0, -1}; const ll MOD = 1e9 + 7; const ll inf = 1 << 30; // const ll INF = LONG_MAX; const ll INF = 1LL << 60; const ull MAX = ULONG_MAX; #define mp make_pair #define pb push_back #define eb emplace_back #define endl '\n' #define space ' ' #define def inline auto #define func inline constexpr ll #define run(a) __attribute__((constructor)) def _##a() #define all(v) begin(v), end(v) #define input(a) scanf("%lld", &(a)) #define print(a) printf("%lld\n", (a)) #define fi first #define se second #define ok(a, b) (0 <= (a) && (a) < (b)) template <class T> using vvector = vector<vector<T>>; template <class T> using rpriority_queue = priority_queue<T, vector<T>, greater<T>>; // Debug #define debug(...) \ { \ cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \ for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] "; \ cerr << endl; \ } #define dump(a, h, w) \ { \ cerr << __LINE__ << ": " << #a << " = [" << endl; \ rep(__i, h) { \ rep(__j, w) cerr << a[__i][__j] << space; \ cerr << endl; \ } \ cerr << "]" << endl; \ } #define vdump(a, n) \ { \ cerr << __LINE__ << ": " << #a << " = ["; \ rep(__i, n) if (__i) cerr << space << a[__i]; \ else cerr << a[__i]; \ cerr << "]" << endl; \ } struct edge { ll to, cost; edge(ll a, ll b) : to(a), cost(b) {} }; struct position { ll x, y; position() {} position(ll a, ll b) : x(a), y(b) {} position next(ll i) { return {x + dx[i], y + dy[i]}; } ll mdist() { return abs(x) + abs(y); } double dist() { return sqrt(x * x + y * y); } double norm(ll d) { if (d == inf) return max(x, y); if (d == 1) return mdist(); if (d == 2) return dist(); return 0; } ll num(ll width) { return abs(x) * width + abs(y); } bool operator==(position a) { return x == a.x && y == a.y; } bool operator!=(position a) { return x != a.x || y != a.y; } bool operator<(position a) { return x < a.x && y < a.y; } bool operator>(position a) { return x > a.x && y > a.y; } bool operator<=(position a) { return x <= a.x && y <= a.y; } bool operator>=(position a) { return x >= a.x && y >= a.y; } position operator+(position a) { return position(x + a.x, y + a.y); } position operator-(position a) { return position(x - a.x, y - a.y); } position operator*(position a) { return position(x * a.x, y * a.y); } position operator/(position a) { return position(x / a.x, y / a.y); } position operator%(position a) { return position(x % a.x, y % a.y); } position complex(position a) { return position(x * a.x - y * a.y, x * a.y + y * a.x); } /* // for sort: bool operator<(position a) { return x ^ a.x ? x < a.x : y < a.y; } bool operator>(position a) { return x ^ a.x ? x > a.x : y > a.y; } bool operator<=(position a) { return x ^ a.x ? x < a.x : y <= a.y; } bool operator>=(position a) { return x ^ a.x ? x > a.x : y >= a.y; } */ }; position Origin = position(0, 0); using pos = position; using vec = position; struct Range { ll left, right; Range() {} Range(ll l, ll r) : left(l), right(r) {} ll length() { return right - left; } bool operator==(Range A) { return left == A.left && right == A.right; } bool operator!=(Range A) { return !(Range(left, right) == A); } bool operator>(Range A) { return left < A.left && right > A.right; } bool operator<(Range A) { return left > A.left && right < A.right; } bool operator>=(Range A) { return left <= A.left && right >= A.right; } bool operator<=(Range A) { return left >= A.left && right <= A.right; } }; // Loop #define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i) #define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i) #define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i) #define each(i, a) for (auto &&i : a) #define loop() for (;;) // Stream #define fout(n) cout << fixed << setprecision(n) #define fasten cin.tie(0), ios::sync_with_stdio(0) // Speed #pragma GCC optimize("O3") #pragma GCC target("avx") // Math //#define gcd __gcd func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } func lcm(ll a, ll b) { return a * b / gcd(a, b); } func sign(ll a) { return a ? abs(a) / a : 0; } template <class T> def in() { T A; cin >> A; return A; } template <class T> def out(vector<vector<T>> A, ll H, ll W, char divc = space, char endc = endl) { rep(i, H) { rep(j, W) { if (j) cout << divc << A[i][j]; else cout << A[i][j]; } cout << endc; } } ll n = 200001; def extgcd(ll a, ll b, ll &x, ll &y) { if (b == 0) { x = 1, y = 0; return a; } ll d = extgcd(b, a % b, y, x); y -= a / b * x; return d; } def mod_inv(ll a) { ll x, y; ll d = extgcd(a, MOD, x, y); return (d == 1) * ((x + MOD) % MOD); } int dataf[200001], datai[200001]; ll mod_fact(ll a) { if (a <= 0) return 1; if (dataf[a]) return dataf[a]; return dataf[a] = mod_fact(a - 1) * a % MOD; } ll mod_inv_fact(ll a) { if (a >= n) return mod_inv(mod_fact(n)); if (datai[a]) return datai[a]; return datai[a] = mod_inv_fact(a + 1) * (a + 1) % MOD; } ll mod_comb_fast(ll n, ll r) { if (r < 0 || n < r) return 0LL; if (r == 0 || r == n) return 1LL; return mod_fact(n) * mod_inv_fact(n - r) % MOD * mod_inv_fact(r) % MOD; } signed main() { ll H, W, A, B; cin >> H >> W >> A >> B; ll res = 0; rep(i, H - A) { ll p = mod_comb_fast((B - 1) + (i), i); ll q = mod_comb_fast((W - B - 1) + (H - i - 1), H - i - 1); res += p * q; res %= MOD; } cout << res << endl; } // for compilation: g++ -Ofast -march=native -o _ _.cpp -std=c++17
a.cc:21:17: error: 'ULONG_MAX' was not declared in this scope 21 | const ull MAX = ULONG_MAX; | ^~~~~~~~~ a.cc:3:1: note: 'ULONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include<vector> +++ |+#include <climits> 3 | using namespace std; a.cc:38:25: error: 'priority_queue' does not name a type 38 | using rpriority_queue = priority_queue<T, vector<T>, greater<T>>; | ^~~~~~~~~~~~~~ a.cc: In member function 'double position::dist()': a.cc:77:28: error: 'sqrt' was not declared in this scope 77 | double dist() { return sqrt(x * x + y * y); } | ^~~~
s216717953
p04039
C++
#include <iostream> #include <vector> #include <climits> using namespace std; #define REP(i, n) for(int i=0; i<(n); i++) #define FOR(i, m, n) for(int i=(m);i<(n);i++) #define INF INT_MAX typedef vector<int> VI; int n, k; VI d(11); bool check(int n) { bool flag = true; int keta = 0; for (int i = n; i > 0; i = i / 10)keta = keta + 1; FOR(i, 1, keta + 1) { int x = n / (int)(pow(10, i - 1)) % 10; REP(j, k) { if (x == d[j])flag = false; } } return flag; } int main() { cin >> n >> k; REP(i, k)cin >> d[i]; int ans; FOR(i, n, INF) { if (check(i)) { ans = i; break; } } cout << ans << endl; }
a.cc: In function 'bool check(int)': a.cc:18:35: error: 'pow' was not declared in this scope 18 | int x = n / (int)(pow(10, i - 1)) % 10; | ^~~
s338405492
p04039
C++
#include<iostream> #include<cinttypes> #include<vector> #include<algorithm> #include<string> using ui = std::uint16_t; using si = std::int32_t; class number { si x[4]; public: number(si v) :x{si{v % 10 } , si{(v % 100) / 10} , si{(v % 1000)} / 100 , si{v / 1000}} {} auto& operator[](si v)const { return x[v]; } auto& operator[](si v) { return x[v]; } template<si N> auto& get()const { return x[N]; } auto as_si()const->si{ si t{x[3] * 1000 + x[2] * 100 + x[1] * 10 + x[0] }; return t; } auto begin() { return std::begin(x); } auto end() { return std::end(x); } }; int main() { si N{}, K{}; std::cin >> N >> K; std::vector<si> vec; for (si i{ 0 }; i < K; i++) { si t; std::cin >> t; vec.emplace_back(t); } std::sort(std::begin(vec), std::end(vec) ); number n{N}; //for development /* for (const auto&e : n) { std::cout << e << " "; }std::cout << "\n"; for (const auto &e : vec) { std::cout << e << " "; }std::cout << "\n"; */ for (si i{ 0 }; i < 4;i++) { auto& ival = n[i]; // auto& next = n[i + 1]; for (const auto& ve : vec) { if (ve == ival) {//このはちゃんがこの数嫌い if (ival == 9) { n = number(n.as_si()+std::pow(10,i)); } else { ival++; } } } } //for development //std::cout << "result :"; std::cout << n.as_si() << "\n"; //for development si t; std::cin >> t; return 0; }
a.cc: In function 'int main()': a.cc:70:67: error: 'pow' is not a member of 'std' 70 | n = number(n.as_si()+std::pow(10,i)); | ^~~
s713030769
p04039
C++
#include<iostream> #include<cinttypes> #include<vector> #include<algorithm> #include<string> using ui = std::uint16_t; template<class T> auto begend(T&&t) { return std::make_pair( std::begin(t) ,std::end(t) ); } template<class Container, class ITP > auto f(ui x,Container &vn,ITP& vitp)->bool { vn.clear(); std::string str = std::to_string(x); // auto sit = begend(sit); for (ui i{}; i < str.size(); i++) { const auto it = std::find(nsitp.first, nsitp.second, str[i]); if (it != nsitp.second) { const auto x = std::distance(nsitp.first, it); vn.push_back(x); } } // for (auto &e : vn) { std::cout << e << " "; }std::cout << "\n"; bool none{ true }; for (const auto&e : vn) { const auto c = std::count(vitp.first, vitp.second, e) == 0; none &= c; // std::cout << "e,c "<< e <<", "<< c <<" "<< (none ? "true" : "false") << "\n"; } return none; }; //using si = std::int16_t; const std::string ns{ "0123456789" }; const auto nsitp = begend(ns); int main() { ui N{}, K{}; std::cin >> N >> K; std::vector<ui> vi; for (ui i{}; i < K; i++) { ui tmp{}; std::cin >> tmp; vi.emplace_back( tmp ); } auto vitp = begend(vi); std::sort(vitp.first, vitp.second);//for merge std::vector<ui> vn{}; vn.reserve(4); ui init{ 1 }; auto g = [&]()-> bool{ return f(init, vn, vitp); }; auto b = init >= N && g(); while (!b) { init++; b = init >= N && g(); } std::cout << init << "\n"; // std::cin >> init; return 0; }
a.cc: In function 'bool f(ui, Container&, ITP&)': a.cc:27:43: error: 'nsitp' was not declared in this scope 27 | const auto it = std::find(nsitp.first, nsitp.second, str[i]); | ^~~~~
s403618693
p04039
C++
#include<iostream> #include<cinttypes> #include<vector> #include<algorithm> #include<string> using ui = std::uint16_t; template<class T> auto begend(T&&t) { return std::make_pair( std::begin(t) ,std::end(t) ); } template<class Container, class ITP > auto f(ui x,Container &vn,ITP& vitp)->bool { vn.clear(); std::string str = std::to_string(x); // auto sit = begend(sit); for (ui i{}; i < str.size(); i++) { const auto it = std::find(nsitp.first, nsitp.second, str[i]); if (it != nsitp.second) { const auto x = std::distance(nsitp.first, it); vn.push_back(x); } } // for (auto &e : vn) { std::cout << e << " "; }std::cout << "\n"; bool none{ true }; for (const auto&e : vn) { const auto c = std::count(vitp.first, vitp.second, e) == 0; none &= c; // std::cout << "e,c "<< e <<", "<< c <<" "<< (none ? "true" : "false") << "\n"; } return none; }; //using si = std::int16_t; const std::string ns{ "0123456789" }; const auto nsitp = begend(ns); int main() { ui N{}, K{}; std::cin >> N >> K; std::vector<ui> vi; for (ui i{}; i < K; i++) { ui tmp{}; std::cin >> tmp; vi.emplace_back( tmp ); } auto vitp = begend(vi); std::sort(vitp.first, vitp.second);//for merge std::vector<ui> vn{}; vn.reserve(4); ui init{ 1 }; auto g = [&]()-> bool{ return f(init, vn, vitp); }; auto b = init >= N && g(); while (!b) { init++; b = init >= N && g(); } std::cout << init << "\n"; //std::cin >> init; return 0; }
a.cc: In function 'bool f(ui, Container&, ITP&)': a.cc:27:43: error: 'nsitp' was not declared in this scope 27 | const auto it = std::find(nsitp.first, nsitp.second, str[i]); | ^~~~~
s085246612
p04039
C++
#include<iostream> #include<cinttypes> #include<vector> #include<algorithm> #include<string> using ui = std::uint16_t; template<class T> auto begend(T&&t) { return std::make_pair( std::begin(t) ,std::end(t) ); } template<class Container, class ITP > auto f(ui x,Container &vn,ITP& vitp)->bool { vn.clear(); std::string str = std::to_string(x); // auto sit = begend(sit); for (ui i{}; i < str.size(); i++) { const auto it = std::find(nsitp.first, nsitp.second, str[i]); if (it != nsitp.second) { const auto x = std::distance(nsitp.first, it); vn.push_back(x); } } // for (auto &e : vn) { std::cout << e << " "; }std::cout << "\n"; bool none{ true }; for (const auto&e : vn) { const auto c = std::count(vitp.first, vitp.second, e) == 0; none &= c; // std::cout << "e,c "<< e <<", "<< c <<" "<< (none ? "true" : "false") << "\n"; } return none; }; //using si = std::int16_t; const std::string ns{ "0123456789" }; const auto nsitp = begend(ns); int main() { ui N{}, K{}; std::cin >> N >> K; std::vector<ui> vi; for (ui i{}; i < K; i++) { ui tmp{}; std::cin >> tmp; vi.emplace_back( tmp ); } auto vitp = begend(vi); std::sort(vitp.first, vitp.second);//for merge std::vector<ui> vn{}; vn.reserve(4); ui init{ 1 }; auto g = [&]()-> bool{ return f(init, vn, vitp); }; auto b = init >= N && g(); while (!b) { init++; b = init >= N && g(); } std::cout << init << "\n"; std::cin >> init; return 0; }
a.cc: In function 'bool f(ui, Container&, ITP&)': a.cc:27:43: error: 'nsitp' was not declared in this scope 27 | const auto it = std::find(nsitp.first, nsitp.second, str[i]); | ^~~~~
s428879766
p04039
C++
#include<iostream> #include<cinttypes> #include<vector> #include<algorithm> #include<string> using ui = std::uint16_t; template<class T> auto begend(T&&t) { return std::make_pair( std::begin(t) ,std::end(t) ); } template<class Container> auto f(ui x,Container &vn)->bool { vn.clear(); std::string str = std::to_string(x); // auto sit = begend(sit); for (ui i{}; i < str.size(); i++) { const auto it = std::find(nsitp.first, nsitp.second, str[i]); if (it != nsitp.second) { const auto x = std::distance(nsitp.first, it); vn.push_back(x); } } // for (auto &e : vn) { std::cout << e << " "; }std::cout << "\n"; bool none{ true }; for (const auto&e : vn) { const auto c = std::count(vitp.first, vitp.second, e) == 0; none &= c; // std::cout << "e,c "<< e <<", "<< c <<" "<< (none ? "true" : "false") << "\n"; } return none; }; //using si = std::int16_t; const std::string ns{ "0123456789" }; const auto nsitp = begend(ns); int main() { ui N{}, K{}; std::cin >> N >> K; std::vector<ui> vi; for (ui i{}; i < K; i++) { ui tmp{}; std::cin >> tmp; vi.emplace_back( tmp ); } auto vitp = begend(vi); std::sort(vitp.first, vitp.second);//for merge std::vector<ui> vn{}; vn.reserve(4); ui init{ 1 }; auto b = init >= N && f(init,vn); while (!b) { init++; b = init >= N && f(init,vn); } std::cout << init << "\n"; std::cin >> init; return 0; }
a.cc: In function 'bool f(ui, Container&)': a.cc:27:43: error: 'nsitp' was not declared in this scope 27 | const auto it = std::find(nsitp.first, nsitp.second, str[i]); | ^~~~~ a.cc:36:43: error: 'vitp' was not declared in this scope 36 | const auto c = std::count(vitp.first, vitp.second, e) == 0; | ^~~~
s222791679
p04039
C++
using namespace std; int N,K; int num[11]; int main(){ cin >> N >> K; for(int i=0; i<K; i++) { int x; cin >> x; num[x]++; } int ans = 0; int cnt = 0; while( N ) { int n = N % 10; for(int i=0; i<11; i++){ if ( num[i] == 0 && i >= n) { for(int j=0; j<cnt; j++) i *= 10; ans += i; break; } } cnt++; N /= 10; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin >> N >> K; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:26:5: error: 'cout' was not declared in this scope 26 | cout << ans << endl; | ^~~~ a.cc:26:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:26:20: error: 'endl' was not declared in this scope 26 | 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;
s537292917
p04039
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); cin.sync_with_stdio(0); int n, k; cin >> n >> k; vector<bool> a(10); while (k--) { int x; cin >> x; a[x] = true; } auto f = [&](int x) { while (x) { if (a[x % 10]) return true; x /= 10; } return false; }; while (is_bad(n)) n++; cout << n; }
a.cc: In function 'int main()': a.cc:24:10: error: 'is_bad' was not declared in this scope; did you mean 'si_band'? 24 | while (is_bad(n)) n++; | ^~~~~~ | si_band
s292426355
p04039
C++
#include<bits/stdc++.h> using namespace std; int main() { long long n; int k; int a[10]={0}; for(int i=0;i<k;i++) { int x;xin>>x;a[x]=1; } long long ans=n; while(1) { long long v=ans; int y=1; while(v>0) { if(a[v%10]) {y=0;break;} v/=10; } if(y) break; ans+=n; } cout<<ans; }
a.cc: In function 'int main()': a.cc:10:7: error: 'xin' was not declared in this scope; did you mean 'sin'? 10 | int x;xin>>x;a[x]=1; | ^~~ | sin
s189130744
p04039
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <math.h> using namespace std; int main() { int N, K; cin >> N >> K; string d = ""; for (int i = 0; i < K; i++) { char c; cin >> c; d += c; } for (int i = N; i < N*10; i++) { string s = to_string(i); bool f = true; for (int j = 0; j < s.length(); ++j) { for (int k = 0; k < d.length(); k++) { if (s[j] == d[k]) { f = false; } } } if (f) { cout << i << endl; return; } } return 0; }
a.cc: In function 'int main()': a.cc:38:25: error: return-statement with no value, in function returning 'int' [-fpermissive] 38 | return; | ^~~~~~
s243690406
p04039
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <cfloat> #include <climits> #include <cstdlib> #include <cstring> #include <cmath> #include <queue> #include <sstream> #include <stack> #include <time.h> #include <vector> #include <complex> using namespace std; int d[12]; int main(){ int n,k,a=-1,b=-1,c=-1,d=-1,e=-1,pos=0; cin>>n>>k; for (int i=0;i<k;i++) cin>>d[i]; for (int i=n;i<i+1;i++){ if (i > 9999)a = n / 10000; if (i > 999) b = n % 10000 / 1000; if (i > 99)c = n % 1000 / 100; if (i > 9) d = n % 100 / 10; e = n % 10; for (int j=0;j<k;j++) if ((a == d[j]) or (b == d[j]) or (c == d[j]) or (d == d[j])) pos++; if (pos == 0){ cout<<n; system ("pause"); return 0; } pos=0; } }
a.cc: In function 'int main()': a.cc:21:11: error: invalid types 'int[int]' for array subscript 21 | cin>>d[i]; | ^ a.cc:29:18: error: invalid types 'int[int]' for array subscript 29 | if ((a == d[j]) or (b == d[j]) or (c == d[j]) or (d == d[j])) | ^ a.cc:29:33: error: invalid types 'int[int]' for array subscript 29 | if ((a == d[j]) or (b == d[j]) or (c == d[j]) or (d == d[j])) | ^ a.cc:29:48: error: invalid types 'int[int]' for array subscript 29 | if ((a == d[j]) or (b == d[j]) or (c == d[j]) or (d == d[j])) | ^ a.cc:29:63: error: invalid types 'int[int]' for array subscript 29 | if ((a == d[j]) or (b == d[j]) or (c == d[j]) or (d == d[j])) | ^
s490175031
p04039
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <cfloat> #include <climits> #include <cstdlib> #include <cstring> #include <cmath> #include <queue> #include <sstream> #include <stack> #include <time.h> #include <vector> #include <complex> using namespace std; int d[12]; int main(){ int n,k,pos=0,ctc=0,hhy=0,jyh=0,syx=0,mym=0; cin>>n>>k; for (int i=0;i<k;i++) cin>>d[i]; while (1){ ctc = n / 10000; hhy = n % 10000 / 1000; jyh = n % 1000 / 100; syx = n % 100 / 10; mym = n % 10; for (int j=0;j<k;j++){ if (n > 9999) if (ctc == d[j]) pos++; if ((hhy == d[j]) or (jyh == d[j]) or (syx == d[j]) or (mym == d[j])) pos++; } if (pos == 0){ cout<<n; system ("pause"); return 0; }
a.cc: In function 'int main()': a.cc:39:2: error: expected '}' at end of input 39 | } | ^ a.cc:22:12: note: to match this '{' 22 | while (1){ | ^ a.cc:39:2: error: expected '}' at end of input 39 | } | ^ a.cc:17:11: note: to match this '{' 17 | int main(){ | ^
s614528138
p04039
C++
#include <iostream> int n,k,g = 0,s = 0,b = 0,q = 0,w = 0; cin >> n >> k; int d[k]; for(int c = 0;c < k;c++){ cin >> d[c]; for(int a = n;a <= 10000;a++){ g = a % 10; s = a % 100 / 10; b = a % 1000 / 100; q = a % 10000 / 1000; w = a / 10000; if(g != d[c]){ if(s != d[c]){ if(b != d[c]){ if(q != d[c]){ if(w != d[c]){ cout << a << endl; return 0; } } } } } } } return 0; }
a.cc:4:5: error: 'cin' does not name a type 4 | cin >> n >> k; | ^~~ a.cc:5:11: error: size of array 'd' is not an integral constant-expression 5 | int d[k]; | ^ a.cc:6:5: error: expected unqualified-id before 'for' 6 | for(int c = 0;c < k;c++){ | ^~~ a.cc:6:19: error: 'c' does not name a type 6 | for(int c = 0;c < k;c++){ | ^ a.cc:6:25: error: 'c' does not name a type 6 | for(int c = 0;c < k;c++){ | ^ a.cc:29:5: error: expected unqualified-id before 'return' 29 | return 0; | ^~~~~~ a.cc:30:1: error: expected declaration before '}' token 30 | } | ^
s192489683
p04039
C++
/************************************************* ************************************************* ************************************************* *** _________________ | | | /*** *** | | | | / *** *** | | | | / *** *** | | | | / *** *** | | | | / *** *** | |____________| |/ en *** *** | | | |\ *** *** | | | | \ *** *** _____ | | | | \ *** *** | | | | | \ *** *** \ / | | | \ *** *** \___/ | | | \*** ************************************************* *************Written by: JiangHaoKai************* *************************************************/ //#include <bits/stdc++.h> #include <iostream> #include <set> using namespace std; typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; typedef float fl; typedef double ld; typedef pair<int,int> pii; #define ui(n) ((unsigned int)(n)) #define ll(n) ((long long)(n)) #define ull(n) ((unsigned long long)(n)) #define fl(n) ((float)(n)) #define ld(n) ((double)(n)) #define char(n) ((char)(n)) #define Bool(n) ((bool)(n)) #define fixpoint(n) fixed<<setprecision(n) const int INF=1e9+7; const ll LINF=1e18; #define PI 3.1415926535897932384626433832795028841971 #define MP make_pair #define MT make_tuple #define All(a) (a).begin(),(a).end() #define pall(a) (a).rbegin(),(a).rend() #define mod 1000000007 #define sz(a) ((int)(a).size()) #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define repa(i,a,n) for(int i=a;i<n;i++) #define repd(i,n) for(int i=n-1;i>=0;i--) #define FOR(i,a,n,step) for(int i=a;i<n;i+=step) #define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++) #define repV(i,v) for(auto i:v) #define MS(x,y) memset(x,y,sizeof(x)) #define sqr(x) ((x)*(x)) #define filein(x) freopen(x,"r",stdin) #define fileout(x) freopen(x,"w",stdout) #define fileout2(filename,name) ofstream name(filename,ios::out) #define filein2(filename,name) ifstream name(filename,ios::in) #define file(filename,name) fstream name(filename,ios::in|ios::out) #define Pause system("pause") #define Cls system("cls") #define fs first #define sc second #define PC(x) putchar(x) #define GC(x) x=getchar() #define Endl PC('\n') inline int READ() { int X=0,w=0;char ch=0;while(!isdigit(ch)){w|=ch=='-';ch=getchar();}while(isdigit(ch))X=(X<<3)+(X<<1)+(ch^48),ch=getchar(); return w?-X:X; } inline void WRITE(int x){if(x<0)putchar('-'),x=-x;if(x>9)WRITE(x/10);putchar(x%10+'0');} inline ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} inline ll gcdll(ll a,ll b){return b?gcdll(b,a%b):a;} inline string itoa(ll a){string res="";while(a>0)res+=(a%10+'0'),a/=10;reverse(All(res));return res==""?"0":res;} inline ll atoi(string s){ll res=0;repV(i,s)res=res*10+i-'0';return res;} const int dx[]={0,1,0,-1,1,-1,-1,1}; const int dy[]={1,0,-1,0,-1,-1,1,1}; /*************************************************************Begin****************************************************************/ int n=READ(),k=READ(); set<int> dislike; inline bool ok(int x) { if(x==0) return 1; else if(dislike.count(x%10)) return 0; else return ok(x/10); } int main() { rep(i,k) dislike.insert(READ()); repa(i,n,1000000) if(ok(i)) {WRITE(i);return 0;} return 0; } /**************************************************************End*****************************************************************/
a.cc: In function 'll powmod(ll, ll)': a.cc:76:45: error: 'assert' was not declared in this scope 76 | inline ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} | ^~~~~~ a.cc:23:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>' 22 | #include <set> +++ |+#include <cassert> 23 | using namespace std; a.cc: In function 'std::string itoa(ll)': a.cc:78:72: error: 'reverse' was not declared in this scope 78 | inline string itoa(ll a){string res="";while(a>0)res+=(a%10+'0'),a/=10;reverse(All(res));return res==""?"0":res;} | ^~~~~~~
s180717649
p04039
C++
/************************************************* ************************************************* ************************************************* *** _________________ | | | /*** *** | | | | / *** *** | | | | / *** *** | | | | / *** *** | | | | / *** *** | |____________| |/ en *** *** | | | |\ *** *** | | | | \ *** *** _____ | | | | \ *** *** | | | | | \ *** *** \ / | | | \ *** *** \___/ | | | \*** ************************************************* *************Written by: JiangHaoKai************* *************************************************/ //#include <bits/stdc++.h> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdalign> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <typeinfo> #include <valarray> #include <vector> #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <unordered_map> #include <unordered_set> #include <windows.h> using namespace std; typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; typedef float fl; typedef double ld; typedef pair<int,int> pii; #define ui(n) ((unsigned int)(n)) #define ll(n) ((long long)(n)) #define ull(n) ((unsigned long long)(n)) #define fl(n) ((float)(n)) #define ld(n) ((double)(n)) #define char(n) ((char)(n)) #define Bool(n) ((bool)(n)) #define fixpoint(n) fixed<<setprecision(n) const int INF=1e9+7; const ll LINF=1e18; #define PI 3.1415926535897932384626433832795028841971 #define MP make_pair #define MT make_tuple #define All(a) (a).begin(),(a).end() #define pall(a) (a).rbegin(),(a).rend() #define mod 1000000007 #define sz(a) ((int)(a).size()) #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define repa(i,a,n) for(int i=a;i<n;i++) #define repd(i,n) for(int i=n-1;i>=0;i--) #define FOR(i,a,n,step) for(int i=a;i<n;i+=step) #define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++) #define repV(i,v) for(auto i:v) #define MS(x,y) memset(x,y,sizeof(x)) #define sqr(x) ((x)*(x)) #define filein(x) freopen(x,"r",stdin) #define fileout(x) freopen(x,"w",stdout) #define fileout2(filename,name) ofstream name(filename,ios::out) #define filein2(filename,name) ifstream name(filename,ios::in) #define file(filename,name) fstream name(filename,ios::in|ios::out) #define Pause system("pause") #define Cls system("cls") #define fs first #define sc second #define PC(x) putchar(x) #define GC(x) x=getchar() #define Endl PC('\n') inline int READ() { int X=0,w=0;char ch=0;while(!isdigit(ch)){w|=ch=='-';ch=getchar();}while(isdigit(ch))X=(X<<3)+(X<<1)+(ch^48),ch=getchar(); return w?-X:X; } inline void WRITE(int x){if(x<0)putchar('-'),x=-x;if(x>9)WRITE(x/10);putchar(x%10+'0');} inline ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} inline ll gcdll(ll a,ll b){return b?gcdll(b,a%b):a;} inline string itoa(ll a){string res="";while(a>0)res+=(a%10+'0'),a/=10;reverse(All(res));return res==""?"0":res;} inline ll atoi(string s){ll res=0;repV(i,s)res=res*10+i-'0';return res;} const int dx[]={0,1,0,-1,1,-1,-1,1}; const int dy[]={1,0,-1,0,-1,-1,1,1}; /*************************************************************Begin****************************************************************/ int n=READ(),k=READ(); set<int> dislike; inline bool ok(int x) { if(x==0) return 1; else if(dislike.count(x%10)) return 0; else return ok(x/10); } int main() { rep(i,k) dislike.insert(READ()); repa(i,n,1000000) if(ok(i)) {WRITE(i);return 0;} return 0; } /**************************************************************End*****************************************************************/
a.cc:85:10: fatal error: windows.h: No such file or directory 85 | #include <windows.h> | ^~~~~~~~~~~ compilation terminated.
s208737498
p04039
C++
#include<string.h> #include<map> #include<math.h> #include<string> #include<algorithm> #include<queue> #include<vector> #include<stdio.h> using namespace std; int main(){ int g[10000]; int n,k,w,d; d=0; w=0; cin>>n>>k; for(int j=1;j<=k;j++) cin>>g[j]; for(int i=n;d<i.size;i++){ for(int l=1;l<=i.size();l++) for(int f=1;f<=k;f++) if(i[l]!=f) w++; if(w=k) d++;} cout<<n; return 0; }
a.cc: In function 'int main()': a.cc:15:1: error: 'cin' was not declared in this scope 15 | cin>>n>>k; | ^~~ a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 6 | #include<queue> +++ |+#include <iostream> 7 | #include<vector> a.cc:18:17: error: request for member 'size' in 'i', which is of non-class type 'int' 18 | for(int i=n;d<i.size;i++){ | ^~~~ a.cc:19:18: error: request for member 'size' in 'i', which is of non-class type 'int' 19 | for(int l=1;l<=i.size();l++) | ^~~~ a.cc:21:5: error: invalid types 'int[int]' for array subscript 21 | if(i[l]!=f) w++; | ^ a.cc:23:1: error: 'cout' was not declared in this scope 23 | cout<<n; | ^~~~ a.cc:23:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s635352747
p04039
C++
#include<string.h> #include<map> #include<math.h> #include<string> #include<algorithm> #include<queue> #include<vector> #include<stdio.h> using namespace std; int main(){ int g[10000]; int n,k,w,d; d=0; w=0; cin>>n>>k; for(int j=1;j<=k;j++) cin>>g[j]; for(int i=n;d<i.size;i++){ for(int l=1;l<=i.size();l++) for(int f=1;f<=k;f++) if(i[l]!=f) w++; if(w=k) d++;} cout<<n; return 0; }
a.cc: In function 'int main()': a.cc:15:1: error: 'cin' was not declared in this scope 15 | cin>>n>>k; | ^~~ a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 6 | #include<queue> +++ |+#include <iostream> 7 | #include<vector> a.cc:18:17: error: request for member 'size' in 'i', which is of non-class type 'int' 18 | for(int i=n;d<i.size;i++){ | ^~~~ a.cc:19:18: error: request for member 'size' in 'i', which is of non-class type 'int' 19 | for(int l=1;l<=i.size();l++) | ^~~~ a.cc:21:5: error: invalid types 'int[int]' for array subscript 21 | if(i[l]!=f) w++; | ^ a.cc:23:1: error: 'cout' was not declared in this scope 23 | cout<<n; | ^~~~ a.cc:23:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s639602085
p04039
C++
#include<iostream> #include<cstdio> #include<cmath> #include<string.h> using namespace std; char getnum(int n,int c) { char s[6]; sprintf(s,"%d",n); return (s[c-1]); } void plusnum(int &n,int c) { char s[6]; sprintf(s,"%d",n); n+=pow(10,strlen(s)-c); } template<size_t s> bool pass(int n,int c,int (&d)[s]) { int num; num=getnum(n,c); for(i=0;i<s;i++) if(num==d[i]) return false; return true; } int main() { int n,k,i; int d[10]; char ms[6]; cin>>n>>k; for(i=0;i<k;i++)cin>>d[i]; sprintf(ms,"%d",n); i=1; while(1) { if(!pass(n,i,k))plusnum(n,i); else if(i<strlen(ms))i++; else goto STOP_WHILE0; } STOP_WHILE0: cout<<n; return 0; }
a.cc: In function 'bool pass(int, int, int (&)[s])': a.cc:23:5: error: 'i' was not declared in this scope 23 | for(i=0;i<s;i++) | ^ a.cc: In function 'int main()': a.cc:39:9: error: no matching function for call to 'pass(int&, int&, int&)' 39 | if(!pass(n,i,k))plusnum(n,i); | ~~~~^~~~~~~ a.cc:19:6: note: candidate: 'template<long unsigned int s> bool pass(int, int, int (&)[s])' 19 | bool pass(int n,int c,int (&d)[s]) | ^~~~ a.cc:19:6: note: template argument deduction/substitution failed: a.cc:39:9: note: mismatched types 'int [s]' and 'int' 39 | if(!pass(n,i,k))plusnum(n,i); | ~~~~^~~~~~~
s619778431
p04039
C++
#include<iostream> #include<cstdio> #include<cmath> #include<string.h> using namespace std; char getnum(int n,int c) { char s[6]; sprintf(s,"%d",n); return (s[c-1]); } void plusnum(int &n,int c) { char s[6]; sprintf(s,"%d",n); n+=pow(10,strlen(s)-c); } template<size_t s> bool pass(int n,int c,int (&d)[s]) { int num; num=getnum(n,c); for(i=0;i<s;i++) if(num==d[i]) return false; return true; } int main() { int n,k,i; int d[10]; char ms[6]; cin>>n>>k; for(i=0;i<k;i++)cin>>d[i]; sprintf(ms,"%d",n); i=1; while(1) { if(!pass(n,i,k))plusnum(n,i); else if(i<strlen(ms))i++; else goto STOP_WHILE0; } STOP_WHILE0: cout<<n; return 0; }
a.cc: In function 'bool pass(int, int, int (&)[s])': a.cc:23:5: error: 'i' was not declared in this scope 23 | for(i=0;i<s;i++) | ^ a.cc: In function 'int main()': a.cc:39:9: error: no matching function for call to 'pass(int&, int&, int&)' 39 | if(!pass(n,i,k))plusnum(n,i); | ~~~~^~~~~~~ a.cc:19:6: note: candidate: 'template<long unsigned int s> bool pass(int, int, int (&)[s])' 19 | bool pass(int n,int c,int (&d)[s]) | ^~~~ a.cc:19:6: note: template argument deduction/substitution failed: a.cc:39:9: note: mismatched types 'int [s]' and 'int' 39 | if(!pass(n,i,k))plusnum(n,i); | ~~~~^~~~~~~
s258409716
p04039
C++
#include<bits\stdc++.h> using namespace std; int n, k, a[100500], res; map<int, int> m; vector<int> v; int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n >> k; for(int i=1;i<=k;i++){ cin >> a[i]; m[a[i]] = 1; } for(int i=9;i>=0;i--){ if(!m[i])v.push_back(i); } while(res <= n){ res += v[0]; res *= 10; } cout << res; return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s912105185
p04039
C++
#include<bits\stdc++.h> using namespace std; int n, k, a[100500], res; map<int, int> m; vector<int> v; int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n >> k; for(int i=1;i<=k;i++){ cin >> a[i]; m[a[i]] = 1; } for(int i=9;i>=0;i--){ if(!m[i])v.push_back(i); } while(res <= n){ res += v[0]; res *= 10; } cout << res; return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s582451058
p04039
C++
#include<bits\stdc++.h> using namespace std; int n, k, a[100500], res; map<int, int> m; vector<int> v; int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n >> k; for(int i=1;i<=k;i++){ cin >> a[i]; m[a[i]] = 1; } for(int i=9;i>=0;i--){ if(!m[i])v.push_back(i); } while(res <= n){ res += v[0]; res *= 10; } cout << res; return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s659224022
p04039
C++
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<bitset> using namespace std; typedef unsigned long long ull; const int N=2005; int n,m,p[N],q[N],a[1002005],f[N],len[N],now,sz; ull hash[1002005]; bitset<10005> arr[N],bit; char str[1000005]; bool cmp(int x,int y) { int l=1,r=min(len[x],len[y]); while (l<=r) { int mid=(l+r)/2; if (hash[p[x]+mid]==hash[p[y]+mid]) l=mid+1; else r=mid-1; } if (l>min(len[x],len[y])) return len[x]<len[y]; else return a[p[x]+l]<a[p[y]+l]; } void pri(int x) { for (int i=1;i<=len[x];i++) putchar(a[p[x]+i]+'a'); } void solve(int x,int L) { if (!L) return; int now=1; while (f[now]<x||!arr[f[now]][L]) now++; pri(f[now]); solve(f[now]+1,L-len[f[now]]); } int main() { scanf("%d%d",&n,&m); for (int i=1;i<=n;i++) { scanf("%s",str+1); len[i]=strlen(str+1); p[i]=sz+1;q[i]=sz+len[i]+1; for (int j=1;j<=len[i];j++) { hash[p[i]+j]=hash[p[i]+j-1]*27+str[j]-'a'+1; a[p[i]+j]=str[j]-'a'; } sz=q[i]; } for (int i=1;i<=n;i++) f[i]=i; sort(f+1,f+n+1,cmp); bit[0]=1; for (int i=n;i>=1;i--) arr[i]=bit<<len[i],bit|=bit<<len[i]; solve(1,m); return 0; }
a.cc: In function 'bool cmp(int, int)': a.cc:24:21: error: reference to 'hash' is ambiguous 24 | if (hash[p[x]+mid]==hash[p[y]+mid]) l=mid+1; | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:14:5: note: 'ull hash [1002005]' 14 | ull hash[1002005]; | ^~~~ a.cc:24:37: error: reference to 'hash' is ambiguous 24 | if (hash[p[x]+mid]==hash[p[y]+mid]) l=mid+1; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:14:5: note: 'ull hash [1002005]' 14 | ull hash[1002005]; | ^~~~ a.cc: In function 'int main()': a.cc:55:25: error: reference to 'hash' is ambiguous 55 | hash[p[i]+j]=hash[p[i]+j-1]*27+str[j]-'a'+1; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:14:5: note: 'ull hash [1002005]' 14 | ull hash[1002005]; | ^~~~ a.cc:55:38: error: reference to 'hash' is ambiguous 55 | hash[p[i]+j]=hash[p[i]+j-1]*27+str[j]-'a'+1; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:14:5: note: 'ull hash [1002005]' 14 | ull hash[1002005]; | ^~~~
s654350126
p04039
C++
#include<iostream> #include<string> #include<vector> using namespace std; int main() { string n; int k; cin >> n >> k; vector<bool> b(10); for(int i = 0; i < k; i++) { int a; cin >> a; b[a] = true; } vector<int> c; for(int i = 0; i < 10; i++) if(!b[i]) c.push_back(i); auto it = upper_bound(c.begin(), c.end(), n[i] - '0'); if(it == c.end()) { if(c[0] == '0') { cout << c[1]; for(int i = 0; i < n.size(); i++) cout << c[0]; cout << endl; return 0; } else { for(int i = 0; i < n.size() + 1; i++) cout << c[0]; cout << endl; return 0; } } else { cout << *it; for(int i = 0; i < n.size() - 1; i++) cout << c[0]; cout << endl; return 0; } }
a.cc: In function 'int main()': a.cc:19:47: error: 'i' was not declared in this scope; did you mean 'it'? 19 | auto it = upper_bound(c.begin(), c.end(), n[i] - '0'); | ^ | it a.cc:19:13: error: 'upper_bound' was not declared in this scope 19 | auto it = upper_bound(c.begin(), c.end(), n[i] - '0'); | ^~~~~~~~~~~
s927309921
p04039
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i,n) for(int i=0;i<n;++i) #define SORT(name) sort(name.begin(), name.end()) #define ZERO(p) memset(p, 0, sizeof(p)) #define MINUS(p) memset(p, -1, sizeof(p)) #if 1 # define DBG(fmt, ...) printf(fmt, __VA_ARGS__) #else # define DBG(fmt, ...) #endif #define MOD 1000000007 #define INF 1000000000 #define MAX_N 100010 int N, K bool okDigit[10] = {}; int main() { cin >> N >> K; REP(i, 10) { okDigit[i] = true; } REP(i, K) { int k; cin >> k; okDigit[k] = false; } for(int i = K; i <= 100000; ++i) { // i に嫌いな数字が入っていないか ll num = i; bool isOk = true; while(num > 0) { if(!okDigit[num % 10]) { isOk = false; break; } num /= 10; } if(isOk) { printf("%d\n", i); return 0; } } return 0; }
a.cc:21:1: error: expected initializer before 'bool' 21 | bool okDigit[10] = {}; | ^~~~ a.cc: In function 'int main()': a.cc:25:17: error: 'K' was not declared in this scope 25 | cin >> N >> K; | ^ a.cc:26:18: error: 'okDigit' was not declared in this scope 26 | REP(i, 10) { okDigit[i] = true; } | ^~~~~~~ a.cc:30:9: error: 'okDigit' was not declared in this scope 30 | okDigit[k] = false; | ^~~~~~~ a.cc:37:17: error: 'okDigit' was not declared in this scope 37 | if(!okDigit[num % 10]) { | ^~~~~~~
s789208675
p04039
C
#include<stdio.h> #include<math.h> #include<string.h> #include<iostream> using namespace std; int a[20]; int main() { int n,k; while(~scanf("%d%d",&n,&k)) { memset(a,0,sizeof(a)); for(int i=0; i<k; i++) { int q; scanf("%d",&q); a[q]=1; } int ans=9; int f1=0,sum=0; for(int i=0; i<=9; i++) { for(int j=0; j<=9; j++) { for(int k=0; k<=9; k++) { for(int r=0; r<=9; r++) { sum=i*1000+j*100+k*10+r; int fa=0; if(sum>=n) { ans=sum; int r=0; int s[20]; while(ans) { s[r++]=ans%10; ans/=10; } for(int i=0;i<r;i++) { if(a[s[i]]==1) { fa=1; break; } } if(fa==0) { f1=1; break; } } } if(f1==1) break; } if(f1==1) break; } if(f1==1)break; } printf("%d\n",sum); } }
main.c:5:9: fatal error: iostream: No such file or directory 5 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s821573642
p04039
C++
n, _ = map(int, raw_input().split()) d = set(map(int, raw_input().split())) while len(set(map(int, str(n))) & d) > 0: n += 1 print n
a.cc:1:1: error: 'n' does not name a type 1 | n, _ = map(int, raw_input().split()) | ^
s676210747
p04039
C++
#include <bits/stdc++.h> using namespace std; int main() { string a; int b,c[10],A = 0,B = 0,C = 0,D = 0,E = 0,F = 0,G = 0,H = 0,I = 0,J = 0; cin >> a >> b; for(int S = 0; S < b;S++){ cin >> c[S]; if(c[S] == 0){J = 1;} else if(c[S] == 1){A = 1;} else if(c[S] == 2){B = 1;} else if(c[S] == 3){C = 1;} else if(c[S] == 4){D = 1:} else if(c[S] == 5){E = 1:} else if(c[S] == 6){F = 1;} else if(c[S] == 7){G = 1;} else if(c[S] == 8){H = 1;} else if(c[S] == 9){I = 1;} } for(int S = 0; S < a.size();S++){ if(J){if(a[S] == "0"){a[S] = "1";}} if(A){if(a[S] == "1"){a[S] = "2";}} if(B){if(a[S] == "2"){a[S] = "3";}} if(C){if(a[S] == "3"){a[S] = "4";}} if(D){if(a[S] == "4"){a[S] = "5";}} if(E){if(a[S] == "5"){a[S] = "6";}} if(F){if(a[S] == "6"){a[S] = "7";}} if(G){if(a[S] == "7"){a[S] = "8";}} if(H){if(a[S] == "8"){a[S] = "9";}} if(I){if(a[S] == "9"){a[S] = "0";}} } cout << a << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:33: error: expected ';' before ':' token 15 | else if(c[S] == 4){D = 1:} | ^ | ; a.cc:16:33: error: expected ';' before ':' token 16 | else if(c[S] == 5){E = 1:} | ^ | ; a.cc:23:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 23 | if(J){if(a[S] == "0"){a[S] = "1";}} a.cc:23:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 23 | if(J){if(a[S] == "0"){a[S] = "1";}} | ^~~ | | | const char* a.cc:24:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 24 | if(A){if(a[S] == "1"){a[S] = "2";}} a.cc:24:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 24 | if(A){if(a[S] == "1"){a[S] = "2";}} | ^~~ | | | const char* a.cc:25:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 25 | if(B){if(a[S] == "2"){a[S] = "3";}} a.cc:25:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 25 | if(B){if(a[S] == "2"){a[S] = "3";}} | ^~~ | | | const char* a.cc:26:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 26 | if(C){if(a[S] == "3"){a[S] = "4";}} a.cc:26:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 26 | if(C){if(a[S] == "3"){a[S] = "4";}} | ^~~ | | | const char* a.cc:27:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 27 | if(D){if(a[S] == "4"){a[S] = "5";}} a.cc:27:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 27 | if(D){if(a[S] == "4"){a[S] = "5";}} | ^~~ | | | const char* a.cc:28:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 28 | if(E){if(a[S] == "5"){a[S] = "6";}} a.cc:28:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 28 | if(E){if(a[S] == "5"){a[S] = "6";}} | ^~~ | | | const char* a.cc:29:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 29 | if(F){if(a[S] == "6"){a[S] = "7";}} a.cc:29:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 29 | if(F){if(a[S] == "6"){a[S] = "7";}} | ^~~ | | | const char* a.cc:30:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 30 | if(G){if(a[S] == "7"){a[S] = "8";}} a.cc:30:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 30 | if(G){if(a[S] == "7"){a[S] = "8";}} | ^~~ | | | const char* a.cc:31:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 31 | if(H){if(a[S] == "8"){a[S] = "9";}} a.cc:31:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 31 | if(H){if(a[S] == "8"){a[S] = "9";}} | ^~~ | | | const char* a.cc:32:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 32 | if(I){if(a[S] == "9"){a[S] = "0";}} a.cc:32:38: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 32 | if(I){if(a[S] == "9"){a[S] = "0";}} | ^~~ | | | const char*
s513199639
p04039
C++
#include <bits/stdc++.h> using namespace std; main(){ int n,k,d[10]={},tmp; vector <int> dl; for(cin>>n>>k;;cin>>tmp;dl.push_back(tmp)); for(;;n++){ for(int a=n;a;a/=10) for(int i=0;i<dl.size();i++) if(dl[i]==a%10) goto end; cout<<n<<endl; return 0; end:; } }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:6:26: error: expected ')' before ';' token 6 | for(cin>>n>>k;;cin>>tmp;dl.push_back(tmp)); | ~ ^ | ) a.cc:6:44: error: expected ';' before ')' token 6 | for(cin>>n>>k;;cin>>tmp;dl.push_back(tmp)); | ^ | ;
s862758455
p04039
C++
#include <bits/stdc++11.h> using namespace std; main(){ int n,k,d[10]={},tmp; vector <int> dl; for(cin>>n>>k;;cin>>tmp;dl.push_back(tmp)); for(;;n++){ for(int a=n;a;a/=10) for(int i=0;i<dl.size();i++) if(dl[i]==a%10) goto end; cout<<n<<endl; return 0; end:; } }
a.cc:1:10: fatal error: bits/stdc++11.h: No such file or directory 1 | #include <bits/stdc++11.h> | ^~~~~~~~~~~~~~~~~ compilation terminated.
s544088142
p04039
C++
#include <iostream> using namespace std; main(){ int n,k,d[10]={},tmp; vector <int> dl; for(cin>>n>>k;;cin>>tmp;dl.push_back(tmp)); for(;;n++){ for(int a=n;a;a/=10) for(int i=0;i<dl.size();i++) if(dl[i]==a%10) goto end; cout<<n<<endl; return 0; end:; } }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:5:3: error: 'vector' was not declared in this scope 5 | vector <int> dl; | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:5:11: error: expected primary-expression before 'int' 5 | vector <int> dl; | ^~~ a.cc:6:26: error: expected ')' before ';' token 6 | for(cin>>n>>k;;cin>>tmp;dl.push_back(tmp)); | ~ ^ | ) a.cc:6:27: error: 'dl' was not declared in this scope; did you mean 'd'? 6 | for(cin>>n>>k;;cin>>tmp;dl.push_back(tmp)); | ^~ | d
s528302408
p04039
C++
#include<iostream> #include<algorithm> #include<vector> std::vector<int> f; bool fig[10]; int N, K; int mods[5] = {10000,1000,100,10,1 }; int ans; int main() { std::cin >> N >> K; for (int i = 0; i < K; i++) { int tmp; std::cin >> tmp; fig[tmp] = true; } for (int i = 0; i < 10; i++) { if (!fig[i]) { f.push_back(i); } } for (int i = 0; i < 5; i++) { int tmp = N/mods[i]; if (tmp == 0)continue; N = N % mods[i]; for (int j = 0; j <= f.size(); j++) { if (j == f.size()) { if (f[0] == 0)ans += f[1] * mods[i-1]; else ans + =f[0] * mods[i-1]; break; } if (tmp <= f[j]) { ans += mods[i] * f[j]; break; } } } std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:28:44: error: expected primary-expression before '=' token 28 | else ans + =f[0] * mods[i-1]; | ^
s163423992
p04039
C++
#include <assert.h> #include <ctype.h> #include <errno.h> #include <float.h> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <wchar.h> #include <wctype.h> #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <functional> #include <map> #include <ios> #include <iosfwd> #include <istream> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <utility> #include <vector> #include <cwchar> #include <cwctype> #include <complex.h> #include <fenv.h> #include <inttypes.h> #include <stdbool.h> #include <stdint.h> #include <tgmath.h> #include <conio.h> #include <numeric> #include <list> #include <windows.h> #include <cfloat> #include <climits> #include <unordered_map> #include <unordered_set> using namespace std; string n; int k; set<int> like,dlike; int main() { cin>>n>>k; for(int i=0;i<k;i++) { int a; cin>>a; dlike.insert(a); } for(int i=0;i<=10;i++) if(!dlike.count(i)) like.insert(i); for(int i=0;i<n.size();i++) if(dlike.count(n[i]-'0')) cout<<*like.upper_bound(n[i]-'0'); else cout<<n[i]; return 0; }
a.cc:53:10: fatal error: conio.h: No such file or directory 53 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s223341024
p04039
C++
#include <bits\stdc++.h> using namespace std; int n,m,i,j,a[15]; string st; char s[15]; bool check(int x) { sprintf(s,"%d",x); st=s; for (i=1;i<=m;i++) { if ((int)st.find(a[i]+'0')!=-1) { return 0; } } return 1; } int main() { cin>>n>>m; for (i=1;i<=m;i++) cin>>a[i]; while (!check(n)) n++; cout<<n; return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s614754000
p04039
C++
#include <iostream> #include <cstdio> #include <vector> #define _USE_MATH_DEFINES #include <math.h> #include <cstring> #include <numeric> #include <algorithm> #include <stdlib.h> #include <functional> #include <string> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <stack> #include <random> #include <complex> #include <unordered_map> #include <nmmintrin.h> #include <chrono> #define rep(i,s,n) for(int i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define PW(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) #define MP(a,b) make_pair((a),(b)) #define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second)) #define pritnf printf #define scnaf scanf #define itn int #ifdef _MSC_VER #define __builtin_popcount _mm_popcnt_u32 #define __builtin_popcountll _mm_popcnt_u64 #endif using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a%b); } template<typename A, size_t N, typename T> void Fill(A(&array)[N], const T &val) { std::fill((T*)array, (T*)(array + N), val); } signed main() { int n, k; scnaf("%d %d", &n, &k); int can[10] = {}; REP(i, k) { int a; scnaf("%d", &a); can[a] = 1; } for (;; n++) { char str[10]; itoa(n, str, 10); int len = strlen(str); bool f = 1; REP(i, len) if (can[str[i]-'0']) f = 0; if (f) { printf("%d\n", n); break; } } return 0; }
a.cc: In function 'int main()': a.cc:69:17: error: 'itoa' was not declared in this scope 69 | itoa(n, str, 10); | ^~~~
s198759852
p04039
C++
#include <iostream> #include <cstdio> #include <vector> #define _USE_MATH_DEFINES #include <math.h> #include <cstring> #include <numeric> #include <algorithm> #include <stdlib.h> #include <functional> #include <string> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <stack> #include <random> #include <complex> #include <unordered_map> #include <nmmintrin.h> #include <chrono> #define rep(i,s,n) for(int i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define PW(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) #define MP(a,b) make_pair((a),(b)) #define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second)) #define pritnf printf #define scnaf scanf #define itn int #ifdef _MSC_VER #define __builtin_popcount _mm_popcnt_u32 #define __builtin_popcountll _mm_popcnt_u64 #endif using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a%b); } template<typename A, size_t N, typename T> void Fill(A(&array)[N], const T &val) { std::fill((T*)array, (T*)(array + N), val); } signed main() { int n, k; scnaf("%d %d", &n, &k); int can[10] = {}; REP(i, k) { int a; scnaf("%d", &a); can[a] = 1; } for (;; n++) { char str[10]; itoa(n, str, 10); int len = strlen(str); bool f = 1; REP(i, len) if (can[str[i]-'0']) f = 0; if (f) { printf("%d\n", n); break; } } return 0; }
a.cc: In function 'int main()': a.cc:69:17: error: 'itoa' was not declared in this scope 69 | itoa(n, str, 10); | ^~~~
s030620518
p04039
C++
#include <iostream> #include <cstdio> #include <vector> #define _USE_MATH_DEFINES #include <math.h> #include <cstring> #include <numeric> #include <algorithm> #include <stdlib.h>> #include <functional> #include <string> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <stack> #include <random> #include <complex> #include <unordered_map> #include <nmmintrin.h> #include <chrono> #define rep(i,s,n) for(int i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define PW(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) #define MP(a,b) make_pair((a),(b)) #define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second)) #define pritnf printf #define scnaf scanf #define itn int #ifdef _MSC_VER #define __builtin_popcount _mm_popcnt_u32 #define __builtin_popcountll _mm_popcnt_u64 #endif using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a%b); } template<typename A, size_t N, typename T> void Fill(A(&array)[N], const T &val) { std::fill((T*)array, (T*)(array + N), val); } signed main() { int n, k; scnaf("%d %d", &n, &k); int can[10] = {}; REP(i, k) { int a; scnaf("%d", &a); can[a] = 1; } for (;; n++) { char str[10]; itoa(n, str, 10); int len = strlen(str); bool f = 1; REP(i, len) if (can[str[i]-'0']) f = 0; if (f) { printf("%d\n", n); break; } } return 0; }
a.cc:9:20: warning: extra tokens at end of #include directive 9 | #include <stdlib.h>> | ^ a.cc: In function 'int main()': a.cc:69:17: error: 'itoa' was not declared in this scope 69 | itoa(n, str, 10); | ^~~~
s700822083
p04039
C++
#include <iostream> #include <cstdio> #include <vector> #define _USE_MATH_DEFINES #include <math.h> #include <cstring> #include <numeric> #include <algorithm> #include <functional> #include <string> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <stack> #include <random> #include <complex> #include <unordered_map> #include <nmmintrin.h> #include <chrono> #define rep(i,s,n) for(int i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define PW(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) #define MP(a,b) make_pair((a),(b)) #define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second)) #define pritnf printf #define scnaf scanf #define itn int #ifdef _MSC_VER #define __builtin_popcount _mm_popcnt_u32 #define __builtin_popcountll _mm_popcnt_u64 #endif using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a%b); } template<typename A, size_t N, typename T> void Fill(A(&array)[N], const T &val) { std::fill((T*)array, (T*)(array + N), val); } signed main() { int n, k; scnaf("%d %d", &n, &k); int can[10] = {}; REP(i, k) { int a; scnaf("%d", &a); can[a] = 1; } for (;; n++) { char str[10]; itoa(n, str, 10); int len = strlen(str); bool f = 1; REP(i, len) if (can[str[i]-'0']) f = 0; if (f) { printf("%d\n", n); break; } } return 0; }
a.cc: In function 'int main()': a.cc:68:17: error: 'itoa' was not declared in this scope 68 | itoa(n, str, 10); | ^~~~
s999208537
p04039
Java
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main { static long mod = (long)1e9 + 7; public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); long n = in.nextLong(); int d = in.nextInt(); HashSet<Long> hs = new HashSet<>(); String s=""; for (int i = 0; i < d; i++) hs.add(in.nextLong()); long temp=n ; while (temp>0){ long dig=temp%10; while(hs.contains(dig)){ temp++; dig=temp%10; } s+=Long.toString(dig); temp=temp/10; } w.println(rev(s).parseLong()); w.close(); } static String rev(String s){ StringBuilder b = new StringBuilder(s); return b.reverse().toString(); } static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isEndOfLine(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; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Main.java:28: error: cannot find symbol w.println(rev(s).parseLong()); ^ symbol: method parseLong() location: class String 1 error
s239736295
p04039
C++
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <vector> #include <iostream> #include <set> #include <map> using namespace std; typedef long long ll; int N, K; int main(int argc, char const *argv[]) { cin >> N >> K; int a; vector<int> v; for (int i = 0; i < K; i++) { cin >> a; v.push_back(a) } string sx; for (int x = N; x < 10 * N; x++) { sx = to_string(x); bool flag = false; for (int i = 0; i < sx.size(); i++) { for (int j = 0; j < v.size(); j++) if (sx[i]-'0' == v[j]) flag = true; } if (!flag) { cout << x << endl; return 0; } } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:21:31: error: expected ';' before '}' token 21 | v.push_back(a) | ^ | ; 22 | } | ~
s270334176
p04039
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); String kirai[] = new String[k]; for (int i = 0; i < k; i++) { kirai[i] = sc.next(); } String number[]; number = String.valueOf(n).split(""); String anser = ""; String keta = ""; for (int j = number.length - 1; j >= 0; j--) { for (int h = 0; h < kirai.length; h++) { if (kirai[h].equals(number[j])) { int n2 = (Integer.parseInt(number[j]) + 1) % 10;// これだと小さい数ができない // 大きい数字になったらケタ上がりしないといけない。 number[j] = String.valueOf(n2); if (n2 == 0){ h = 0; if(j == 0)keta = "1"; else{ int n3 = (Integer.parseInt(number[j-1])+1)%10; number[j-1] = String.valueOf(n3); for(int i = j-2;i >= 0;i--){ if(number[i].equals("0")){ n3 = Integer.parseInt(number[i])+1; number[i] = String.valueOf(n3); } } } } } } } for(int i = 0;i < number.length;i++){ anser += number[i]; } if(keta.equals("1")){ keta += anser; System.out.println(keta); }else System.out.println(anser); } }
Main.java:3: error: illegal character: '\u3000' public class?Main { ^ 1 error
s394621342
p04039
Java
package xml1115; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int knum = scan.nextInt(); int[] hateNums = new int[knum]; for(int i = 0; i < knum; i++){ hateNums[i] = scan.nextInt(); } char[] likeNums = new char[10]; int count = 0; for(int i=0; i<knum; i++){ if(i != hateNums[i]){ likeNums[count] = (char)i; count++; } } // count = 0; // int result = 0; // while(true){ // for(int i=0; i<count; i++){ // for(int t=0; t<likeNums.length; t++){ // result = likeNums[t]; // if(n < result){ // System.out.println(result); // break; // } // } // } // } int result = n; String pu = ""; for(int i=0; i<=10000; i++){ String price = String.valueOf(n); String res = String.valueOf(result); int co = 0; for(int t=0; t<hateNums.length; t++){ String s = String.valueOf(hateNums[t]); if(!res.contains(s)){ co++; } if(co == hateNums.length){ pu = res; } } if(pu != ""){ break; } result++; } System.out.println(pu); } }
Main.java:5: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s072881063
p04039
Java
import java.util.Scanner; public class A { public static void main(String[] at){ Scanner scanner = new Scanner(System.in); int mon = scanner.nextInt(); String[] hate = new String [scanner.nextInt()]; for (int i = 0; i < hate.length; i++){ hate[i] = scanner.next(); } String money = Integer.toString(mon); int result = mon; boolean ok = true; while (ok){ for (int i = 0; i < hate.length; i++){ if (money.matches(".*" + hate[i] + ".*")){ result++; money = Integer.toString(result); break; } else if (i == hate.length-1){ ok = false; } } } System.out.println(result); } }
Main.java:3: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s761728937
p04039
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); String kirai[] = new String[k]; for (int i = 0; i < k; i++) { kirai[i] = sc.next(); } String number[]; number = String.valueOf(n).split(""); String anser = ""; for (int j = 0; j < number.length; j++) { for (int h = 0; h < kirai.length; h++) {// ここは二分探索のほうが良い if (kirai[h].equals(number[j])) { int n2 = (Integer.parseInt(number[j]) + 1) % 10;// これだと小さい数ができない number[j] = String.valueOf(n2); if(n2 == 1)h = 0; } } anser += number[j]; } System.out.println(anser); } }
Main.java:3: error: illegal character: '\u3000' public class?Main { ^ 1 error
s413584180
p04039
C++
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <sstream> #include <iostream> #include <vector> #include <map> #include <set> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef vector<int> vi; typedef vector<long> vl; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; vi d; for (int i = 0; i < k; ++i) { int tmp; cin >> tmp; d.push_back(tmp); } for (int i = n; i < INT_MAX; ++i) { int num = i; bool invalid = false; while (num > 0) { int tmp = num % 10; for (int i = 0; i < k; ++i) { if (d[i] == tmp) { invalid = true; } } if (invalid) break; num /= 10; } if (invalid) continue; cout << i << endl; return 0; } return 1; }
a.cc: In function 'int main()': a.cc:33:25: error: 'INT_MAX' was not declared in this scope 33 | for (int i = n; i < INT_MAX; ++i) { | ^~~~~~~ a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 9 | #include <set> +++ |+#include <climits> 10 |
s987209945
p04039
C++
#include<iostream> using namespace std; #include<vector> int main() { // get a integer int amt; int k; int bit_wise_d = 0; cin >> amt >> k; for(int i = 0; i < k; i++){ cin >> d; bit_wise_d |= 1 << d; } int ret = 0; while(amt > 0){ ret *= 10; int min_d = amt%10; for(int i = min_d; i < 10; i++){ if(bit_wise_d & (1 << i)){ ret += i; } else if(i == 9) return -1; } ret += amt%10; amt /= 10; } return 0; }
a.cc: In function 'int main()': a.cc:12:16: error: 'd' was not declared in this scope 12 | cin >> d; | ^
s198113201
p04039
C++
/* template.cpp [[[ */ #include <bits/stdc++.h> using namespace std; #define get_macro(a, b, c, d, name, ...) name #define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__) #define rep1(n) rep2(i_, n) #define rep2(i, n) rep3(i, 0, n) #define rep3(i, a, b) rep4(i, a, b, 1) #define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)s) #define rrep1(n) rrep2(i_, n) #define rrep2(i, n) rrep3(i, 0, n) #define rrep3(i, a, b) rrep4(i, a, b, 1) #define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)s) #define each(x, c) for (auto &&x : c) #define fs first #define sc second #define all(c) begin(c), end(c) using ui = unsigned; using ll = long long; using ul = unsigned long long; using ld = long double; const int inf = 1e9 + 10; const ll inf_ll = 1e18 + 10; const ll mod = 1e9 + 7; const ll mod9 = 1e9 + 9; const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1}; const int dy[]{0, -1, 0, 1, -1, -1, 1, 1}; template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); } template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); } struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__; ll in(){ ll x; cin >> x; return x; } vector<ll> in(size_t n){ vector<ll> v(n); each(x, v) cin >> x; return v; } /* ]]] */ int n, x, y, z; ll dp[60][1 << 16]; ll pw10[60]; int dfs(int i, int j){ int &res = dp[i][j]; if (~res) return res; if (i == n) return res = 1; res = 0; rep(k, 1, 11){ int nj = (j << k) | (1 << (k - 1)); int f = 1; f &= (nj >> (z - 1)) & 1; f &= (nj >> (z + y - 1)) & 1; f &= (nj >> (z + y + x - 1)) & 1; if (f) continue; nj &= (1 << (x + y + z - 1)) - 1; res += dfs(i + 1, nj); res %= mod; } return res; } int main(){ cin >> n >> x >> y >> z; pw10[0] = 1; rep(i, 59) pw10[i + 1] = pw10[i] * 10 % mod; memset(dp, -1, sizeof(dp)); cout << (pw10[n] - dfs(0, 0) + mod) % mod << endl; }
a.cc: In function 'int dfs(int, int)': a.cc:41:21: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'll' {aka 'long long int'} 41 | int &res = dp[i][j]; | ~~~~~~~^
s591480234
p04039
Java
/** * Created by iainws on 4/09/16. */ import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; public class IrohasObsession { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReaderIrohasObsession in = new InputReaderIrohasObsession(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskIrohasObsession solver = new TaskIrohasObsession(); solver.solve(1, in, out); out.close(); } } class TaskIrohasObsession { public boolean check(int cur, int [] arr){ boolean ok = true; while(cur != 0){ int r = cur % 10; for(int i = 0; i < arr.length; ++i){ if(arr[i] == r)ok = false; } cur /= 10; } if(ok)return true; return false; } public void solve(int taskNumber, InputReaderIrohasObsession in, PrintWriter out) { int N; int K; N = in.nextInt(); K = in.nextInt(); int [] arr = new int[K]; for(int i = 0; i < K; ++i){ int a = in.nextInt(); arr[i] = a; } for(int i = N; i < N * 10;++i){ if(check(i, arr)){ System.out.println(i); return; } } } } class InputReaderIrohasObsession { public BufferedReader reader; public StringTokenizer tokenizer; public InputReaderIrohasObsession(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } }
Main.java:13: error: class IrohasObsession is public, should be declared in a file named IrohasObsession.java public class IrohasObsession { ^ 1 error
s222119280
p04039
Java
import java.util.*; public class Main { int N, K; boolean[] D; int A; public static boolean isOK() { int a = A; while(A > 0) { if(D[a % 10]) return false; a = a / 10; } return true; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); K = sc.nextInt(); D = new int[10]; for(int i = 0; i < K; i++) { int d = sc.nextInt(); D[d] = true; } A = N; while(!isOK()) A++; System.out.println(A); } }
Main.java:10: error: non-static variable A cannot be referenced from a static context int a = A; ^ Main.java:11: error: non-static variable A cannot be referenced from a static context while(A > 0) { ^ Main.java:12: error: non-static variable D cannot be referenced from a static context if(D[a % 10]) return false; ^ Main.java:21: error: non-static variable N cannot be referenced from a static context N = sc.nextInt(); ^ Main.java:22: error: non-static variable K cannot be referenced from a static context K = sc.nextInt(); ^ Main.java:23: error: non-static variable D cannot be referenced from a static context D = new int[10]; ^ Main.java:23: error: incompatible types: int[] cannot be converted to boolean[] D = new int[10]; ^ Main.java:24: error: non-static variable K cannot be referenced from a static context for(int i = 0; i < K; i++) { ^ Main.java:26: error: non-static variable D cannot be referenced from a static context D[d] = true; ^ Main.java:29: error: non-static variable A cannot be referenced from a static context A = N; ^ Main.java:29: error: non-static variable N cannot be referenced from a static context A = N; ^ Main.java:30: error: non-static variable A cannot be referenced from a static context while(!isOK()) A++; ^ Main.java:32: error: non-static variable A cannot be referenced from a static context System.out.println(A); ^ 13 errors
s904898872
p04039
C++
#include<iostream> #include<algorithm> #include<utility> #include<vector> #include<queue> #include<stack> #include<map> #include<set> #include<string> #include<stack> #include<cstdio> #include<cmath> #include<iomanip> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<int,pii> piii; typedef vector<int> vi; typedef vector<pii> vpii; #define fr first #define sc second #define mp make_pair #define pb push_back #define rep(i,x) for(int i=0;i<x;i++) #define rep1(i,x) for(int i=1;i<=x;i++) #define rrep(i,x) for(int i=x-1;i>=0;i--) #define rrep1(i,x) for(int i=x;i>0;i--) #define so(v) sort(v.begin(),v.end()) #define re(s) reverse(s.begin(),s.end()) #define lb(v,a) lower_bound(v.begin(),v.end(),a) #define ub(v,a) upper_bound(v.begin(),v.end(),a) #define mp1(a,b,c) piii(a,pii(b,c)) const int INF=1000000000; const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}}; const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}}; const ll mod=1e9+7; int main(){ int n,k,d[20]={0}; cin>>n>>k; rep(i,k){int a; cin>>a; d[a]=1;} for(;;){ int t=n; while(t){ if(f[t%10]) break; t/=10; } if(!t){ cout<<t<<endl; break;} n++; } return 0; }
a.cc: In function 'int main()': a.cc:50:10: error: 'f' was not declared in this scope 50 | if(f[t%10]) break; | ^
s762696088
p04039
C++
#include <stdio.h> #include <iostream> using namespace std; bool like(char p,int *L,int len) { int d= p - '0'; for (int i=0;i<len;i++){ if (L[i]==d){ return true; } } return false; } int getMin(char p,int *L,int len) { int d= p - '0'; for (int i=0;i<len;i++){ if (L[i]>d){ return L[i]; } } return -1; } int main(int argc, char* argv[]) { int N,K; cin>>N>>K; int D[10]; int L[10]; int i,j; int d; for (i=0;i<10;i++){ D[i]=-1; } for (i=0;i<K;i++){ cin>>d; D[d]=d; } j=0; for (i=0;i<10;i++){ if (D[i]==-1){ L[j++]=i; } } char S[10]; sprintf(S,"%d",N); char *p=S; i=0; while (*p != '\0'){ if (i==0){ if (!like(*p,L,j)){ i=1; continue; } }else{ d=getMin(*p,L,j); if (d==-1){ if (p==S){ j=strlen(S); i=0; while (L[i]==0){ i++; } S[0] = L[i]; int k; for (k=1;k<j+1;k++){ S[k]=L[0]; } S[k] = '\0'; cout<<S<<endl; return 0; }else{ p--; continue; } }else{ *p = d + '0'; p++; while (*p != '\0'){ *p = L[0] + '0'; p++; } cout<<S<<endl; return 0; } } p++; } cout<<S<<endl; return 0; }
a.cc: In function 'int main(int, char**)': a.cc:59:43: error: 'strlen' was not declared in this scope 59 | j=strlen(S); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 | using namespace std;
s767633522
p04039
C++
#include <stdio.h> #include <iostream> using namespace std; bool like(char p,int *L,int len) { int d= p - '0'; for (int i=0;i<len;i++){ if (L[i]==d){ return true; } } return false; } int getMin(char p,int *L,int len) { int d= p - '0'; for (int i=0;i<len;i++){ if (L[i]>d){ return L[i]; } } return -1; } int main(int argc, char* argv[]) { int N,K; cin>>N>>K; int D[10]; int L[10]; int i,j; int d; for (i=0;i<10;i++){ D[i]=-1; } for (i=0;i<K;i++){ cin>>d; D[d]=d; } j=0; for (i=0;i<10;i++){ if (D[i]==-1){ L[j++]=i; } } char S[10]; sprintf(S,"%d",N); char *p=S; i=0; while (*p != '\0'){ if (i==0){ if (!like(*p,L,j)){ i=1; continue; } }else{ d=getMin(*p,L,j); if (d==-1){ if (p==S){ j=strlen(S); i=0; while (L[i]==0){ i++; } S[0] = L[i]; for (int k=1;k<j+1;j++){ S[k]=L[0]; } S[K] = '\0'; cout<<S<<endl; return 0; }else{ p--; continue; } }else{ *p = d + '0'; p++; while (*p != '\0'){ *p = L[0] + '0'; p++; } cout<<S<<endl; return 0; } } p++; } cout<<S<<endl; return 0; }
a.cc: In function 'int main(int, char**)': a.cc:59:43: error: 'strlen' was not declared in this scope 59 | j=strlen(S); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 | using namespace std;
s107298062
p04039
C++
//ここからテンプレート //#define PLASMA_NO_BOOST #if 1 #include<iostream> #include<list> #include<algorithm> #include<utility> #include<type_traits> #include<tuple> #include<memory> #include<iterator> #include<string> #include<functional> #include<list> #include<array> #include<complex> #include<numeric> #include<iomanip> #include<vector> #include<queue> #include<random> #include<map> #include<chrono> #include<stack> #include<set> #ifndef PLASMA_NO_BOOST #include<boost/optional.hpp> #include<boost/optional/optional_io.hpp> #include<boost/variant.hpp> #include<boost/range/adaptor/transformed.hpp> #include<boost/range/adaptor/indexed.hpp> #include<boost/range/adaptor/filtered.hpp> #include<boost/range/algorithm.hpp> #include<boost/range/irange.hpp> #include<boost/multi_array.hpp> #include<boost/preprocessor.hpp> #endif typedef long long int int64; typedef unsigned long long uint64; typedef long double double64; #ifdef PLASMA_NO_BOOST struct none_t {}; constexpr none_t none{}; template<class T>class optional { union inside_t { T value; none_t ignore; constexpr inside_t(T const& v) :value(v) {} constexpr inside_t(T&& v) : value(std::move(v)) {} constexpr inside_t(none_t) : ignore(none) {} constexpr inside_t() : ignore(none) {} constexpr inside_t(inside_t const&) = default; inside_t(inside_t&&) = default; inside_t& operator=(inside_t const&) = default; inside_t& operator=(inside_t&&) = default; ~inside_t() = default; }; inside_t inside; bool flag; public: void swap(optional&& v) { std::swap(this->inside, v.inside); std::swap(this->flag, v.flag); } void reset() { if (flag) { inside.value.~T(); inside.ignore = none; flag = false; } } constexpr optional(T const& v) :inside(v), flag(true) {} constexpr optional(T&& v) : inside(std::move(v)), flag(true) {} constexpr optional(none_t) : inside(), flag(false) {} constexpr optional() : inside(), flag(false) {} constexpr optional(optional const& v) : inside(v.inside), flag(v.flag) {} optional(optional&& v) : optional() { swap(std::move(v)); } optional& operator=(optional const& v) { this->inside = v.inside; this->flag = v.flag; return *this; } optional& operator=(optional&& v) { swap(std::move(v)); v.reset(); return *this; } optional& operator=(T const& v) { reset(); inside.value = v; flag = true; return *this; } optional& operator=(T&& v) { reset(); inside.value = std::move(v); flag = true; return *this; } optional& operator=(none_t) { reset(); return *this; } constexpr operator bool()const { return flag; } constexpr T const& operator*()const { return flag ? inside.value : throw std::domain_error("optional error: dont have value"); } }; template<class T>constexpr optional<typename std::remove_reference<typename std::remove_const<T>::type>::type>make_optional(T&& v) { return optional<std::remove_reference_t<std::remove_const_t<T>>>(std::forward<T>(v)); } #else using boost::optional; using boost::none_t; using boost::none; #endif #ifndef PLASMA_NO_BOOST namespace adaptor { using namespace boost::adaptors; } namespace algorithm { using namespace boost::range; template<class SinglePassRange, class Pred>bool any_of(SinglePassRange const& range, Pred pred) { return std::any_of(std::begin(range), std::end(range), pred); } template<class SinglePassRange, class Pred>bool all_of(SinglePassRange const& range, Pred pred) { return std::all_of(std::begin(range), std::end(range), pred); } } #endif namespace math { template<class T>constexpr T pow(T p, int n) { return n == 0 ? T(1) : n == 1 ? p : n == 2 ? p*p : n % 2 == 0 ? pow(pow(p, n / 2), 2) : pow(pow(p, n / 2), 2)*p; } int log(long long int p, int n) { int64 t = n; for (int i = 0;;++i) { if (t > p) return i; t *= n; } } constexpr double pi = 3.141592653589793; namespace detail { int gcd(int larger, int less) { return less == 0 ? larger : gcd(less, larger%less); } } int gcd(int lhs, int rhs) { return lhs < rhs ? detail::gcd(rhs, lhs) : detail::gcd(lhs, rhs); } void fourier_transform( std::vector<std::complex<double>>& vec, std::size_t N) { std::vector<std::complex<double>> butterfly; vec.resize(N); butterfly.resize(N); std::complex<double> half(std::cos(pi), std::sin(pi)); for (uint64 i = 1, k = N / 2;i < N;[&]() {i *= 2;k /= 2;}())//i*k == N/4 { std::complex<double> circle(std::cos(pi / i), std::sin(pi / i)); std::complex<double> c(1.0, 0); for (auto count = 0ull; count < i;++count) { for (auto j = 0ull;j < k;++j) { butterfly[count*k + j] = vec[2 * count*k + j] + vec[2 * count*k + j + k] * c; butterfly[count*k + j + N / 2] = vec[2 * count*k + j] + vec[2 * count*k + j + k] * c*half; } c *= circle; } std::swap(vec, butterfly); } } class polynomial { std::vector<std::complex<double>> value; void swap(polynomial&& p) { std::swap(value, p.value); } public: polynomial() :value{ 0.0 } {} polynomial(polynomial const&) = default; polynomial(std::vector<std::complex<double>>&& vec) :value(std::move(vec)) {} polynomial(polynomial&& p) :polynomial() { swap(std::move(p)); } polynomial(std::initializer_list<std::complex<double>> lis) :value(lis) {} polynomial(std::complex<double> c) :polynomial({ c }) {} polynomial& operator=(polynomial const&) = default; polynomial& operator=(polynomial&& p) { value = std::vector<std::complex<double>>{ 0.0 }; swap(std::move(p)); return *this; } ~polynomial() = default; std::complex<double> operator[](std::size_t deg)const { return deg >= value.size() ? 0.0 : value[deg]; } std::size_t degree()const { return value.size() - 1; } void strict_degree_set() { std::size_t N = degree(); for (;N > 0;--N) { if (value[N] != 0.0) break; } value.resize(N + 1); } void integer_degree_set() { std::size_t N = degree(); for (;N > 0;--N) { std::cout << value[N] << " " << (std::norm(value[N]) > (1.0e-20)) << std::endl; if (std::norm(value[N]) > (1.0e-20)) break; } value.resize(N + 1); } friend polynomial operator*(polynomial const& lhs, polynomial const& rhs) { std::size_t N = 1; while (true) { N *= 2; if (N > (lhs.degree() + rhs.degree())) break; } auto lhs_ = lhs.value; auto rhs_ = rhs.value; fourier_transform(lhs_, N); fourier_transform(rhs_, N); std::vector<std::complex<double>> vec; vec.reserve(N); for (std::size_t i = 0;i < N;++i) { vec.push_back(lhs_[i] * rhs_[i]); } for (auto& v : vec) { v = 2 * v.real() - v; } fourier_transform(vec, N); for (auto& v : vec) { v = (2 * v.real() - v)*(1.0 / N); } std::size_t k = N; for (;k > 0;--k) { if (std::norm(vec[k]) > 1.0e-23) break; } vec.resize(k + 1); return polynomial(std::move(vec)); } }; int real_integer(std::complex<double> c) { int v = static_cast<int>(c.real()); double u = c.real() - v; return v + static_cast<int>(2 * u); } template<class T>polynomial make_poly(std::vector<T> const& vec) { auto range = vec | adaptor::transformed([](T const& v) {return static_cast<std::complex<double>>(v);}); std::vector<std::complex<double>> ret(std::begin(range), std::end(range)); return polynomial(std::move(ret)); } polynomial make_poly(std::initializer_list<double>init) { std::vector<std::complex<double>> vec; for (auto v : init) { vec.emplace_back(v); } return polynomial(std::move(vec)); } polynomial make_poly(std::initializer_list<int> init) { std::vector<std::complex<double>> vec; for (auto v : init) { vec.emplace_back(v); } return polynomial(std::move(vec)); } template<class T>class infinite_value { optional<T> val; public: infinite_value(T const& v) :val(v) {} infinite_value(T&& v) :val(std::move(v)) {} infinite_value(none_t = none) :val() {} infinite_value(infinite_value const&) = default; infinite_value(infinite_value&&) = default; ~infinite_value() = default; infinite_value& operator=(T const& v) { val = v; return *this; } infinite_value& operator=(T&& v) { val = std::move(v); return *this; } infinite_value& operator=(none_t) { val = boost::none; return *this; } infinite_value& operator=(infinite_value const&) = default; infinite_value& operator=(infinite_value&&) = default; operator bool()const { return static_cast<bool>(val); } T const& operator*()const { return *val; } friend infinite_value operator+(infinite_value const& lhs, infinite_value const& rhs) { return lhs&&rhs ? infinite_value<T>(*lhs + *rhs) : infinite_value<T>(none); } friend infinite_value operator+(infinite_value const& lhs, T const& rhs) { return lhs ? infinite_value<T>(*lhs + rhs) : infinite_value<T>(none); } friend infinite_value operator+(T const& lhs, infinite_value const& rhs) { return lhs&&rhs ? infinite_value<T>(*lhs + *rhs) : infinite_value<T>(none); } friend bool operator==(infinite_value const& lhs, infinite_value const& rhs) { return (!lhs&&!rhs) || (lhs&&rhs && (*lhs == *rhs)); } friend bool operator==(infinite_value const& lhs, T const& rhs) { return lhs && (*lhs == rhs); } friend bool operator==(T const& lhs, infinite_value const& rhs) { return rhs && (lhs == *rhs); } friend bool operator<(infinite_value const& lhs, infinite_value const& rhs) { return !lhs ? false : !rhs ? true : *lhs < *rhs; } friend bool operator<(infinite_value const& lhs, T const& rhs) { return !lhs ? false : *lhs < rhs; } friend bool operator<(T const& lhs, infinite_value const& rhs) { return !rhs ? true : lhs < *rhs; } friend bool operator<=(infinite_value const& lhs, infinite_value const& rhs) { return (lhs < rhs) || (lhs == rhs); } friend bool operator<=(infinite_value const& lhs, T const& rhs) { return (lhs < rhs) || (lhs == rhs); } friend bool operator<=(T const& lhs, infinite_value const& rhs) { return (lhs < rhs) || (lhs == rhs); } friend bool operator>(infinite_value const& lhs, infinite_value const& rhs) { return !rhs ? false : !lhs ? true : *lhs > *rhs; } friend bool operator>(infinite_value const& lhs, T const& rhs) { return !lhs ? true : *lhs > rhs; } friend bool operator>(T const& lhs, infinite_value const& rhs) { return !rhs ? false : lhs > *rhs; } friend bool operator>=(infinite_value const& lhs, infinite_value const& rhs) { return (lhs > rhs) || (lhs == rhs); } friend bool operator>=(infinite_value const& lhs, T const& rhs) { return (lhs > rhs) || (lhs == rhs); } friend bool operator>=(T const& lhs, infinite_value const& rhs) { return (lhs > rhs) || (lhs == rhs); } }; template<std::size_t Mod>class modulo_number { uint64 val = {}; static constexpr uint64 abs(int64 n) { return n <= -1 ? n + Mod : n; } public: modulo_number(modulo_number const&) = default; modulo_number(modulo_number&&) = default; modulo_number& operator=(modulo_number const&) = default; modulo_number& operator=(modulo_number&&) = default; ~modulo_number() = default; constexpr modulo_number(uint64 num = {}) : val(num%Mod) {} constexpr modulo_number(unsigned int num) : val(num%Mod) {} constexpr modulo_number(int64 num) : val(abs(num%Mod)) {} constexpr modulo_number(int num) : val(abs(num%Mod)) {} modulo_number& operator=(uint64 num) { val = num%Mod; return *this; } modulo_number& operator=(int64 num) { val = abs(num%Mod); return *this; } modulo_number& operator=(unsigned int num) { val = num%Mod; return *this; } modulo_number& operator=(int num) { val = abs(num%Mod); return *this; } constexpr uint64 get()const { return val; } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>((lhs.val + rhs.val) % Mod); } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, int const& rhs) { return lhs + modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, unsigned int const& rhs) { return lhs + modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, int64 const& rhs) { return lhs + modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, uint64 const& rhs) { return lhs + modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator+(int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) + rhs; } friend constexpr modulo_number<Mod> operator+(unsigned int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) + rhs; } friend constexpr modulo_number<Mod> operator+(int64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) + rhs; } friend constexpr modulo_number<Mod> operator+(uint64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) + rhs; } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>((lhs.val + Mod - rhs.val) % Mod); } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, int const& rhs) { return lhs - modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, unsigned int const& rhs) { return lhs - modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, int64 const& rhs) { return lhs - modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, uint64 const& rhs) { return lhs - modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator-(int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) - rhs; } friend constexpr modulo_number<Mod> operator-(unsigned int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) - rhs; } friend constexpr modulo_number<Mod> operator-(int64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) - rhs; } friend constexpr modulo_number<Mod> operator-(uint64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) - rhs; } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>((lhs.val*rhs.val) % Mod); } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, int const& rhs) { return lhs * modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, unsigned int const& rhs) { return lhs * modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, int64 const& rhs) { return lhs * modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, uint64 const& rhs) { return lhs * modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator*(int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) * rhs; } friend constexpr modulo_number<Mod> operator*(unsigned int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) * rhs; } friend constexpr modulo_number<Mod> operator*(int64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) * rhs; } friend constexpr modulo_number<Mod> operator*(uint64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) * rhs; } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, modulo_number<Mod>const& rhs) { return lhs*math::pow(rhs, Mod - 2); } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, int const& rhs) { return lhs / modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, unsigned int const& rhs) { return lhs / modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, int64 const& rhs) { return lhs / modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, uint64 const& rhs) { return lhs / modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator/(int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) / rhs; } friend constexpr modulo_number<Mod> operator/(unsigned int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) / rhs; } friend constexpr modulo_number<Mod> operator/(int64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) / rhs; } friend constexpr modulo_number<Mod> operator/(uint64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) / rhs; } template<class Rhs>decltype(auto) operator+=(Rhs const& rhs) { return *this = *this + rhs; } template<class Rhs>decltype(auto) operator*=(Rhs const& rhs) { return *this = *this * rhs; } template<class Rhs>decltype(auto) operator-=(Rhs const& rhs) { return *this = *this - rhs; } template<class Rhs>decltype(auto) operator/=(Rhs const& rhs) { return *this = *this / rhs; } }; template<class T>constexpr T factorial(std::size_t n, std::size_t goal = 1) { return n == goal ? T(n) : n == 0 ? T(1) : factorial<T>(n, (n + goal) / 2 + 1)*factorial<T>((n + goal) / 2, goal); } namespace detail { constexpr uint64 integral_sqrt_i(uint64 v, uint64 start, uint64 end) { return start == end ? start : pow((start + end) / 2 + 1, 2) <= v ? integral_sqrt_i(v, (start + end) / 2 + 1, end) : integral_sqrt_i(v, start, (start + end) / 2); } } constexpr uint64 integral_sqrt(uint64 v) { return v == 0 ? 0 : v == 1 ? 1 : detail::integral_sqrt_i(v, 1, 0b100000000000000000000000000000000ull); } namespace detail { constexpr bool is_prime_i(uint64 v, uint64 start, uint64 end) { return start == end ? v%end != 0 : is_prime_i(v, start, (start + end) / 2) && is_prime_i(v, (start + end) / 2 + 1, end); } } constexpr bool is_prime(uint64 v) { return v == 0 ? false : v == 1 ? false : v == 2 ? true : v == 3 ? true : detail::is_prime_i(v, 2, integral_sqrt(v)); } class dynamic_modulo { uint64 value; uint64 mod; static constexpr uint64 abs(int64 v, uint64 mod) { return v <= -1 ? v + mod : v; } public: constexpr dynamic_modulo() :value(), mod(2) {} constexpr dynamic_modulo(uint64 v, uint64 m) : value(v), mod(m) {} dynamic_modulo(dynamic_modulo const&) = default; dynamic_modulo(dynamic_modulo&&) = default; dynamic_modulo& operator=(dynamic_modulo const&) = default; dynamic_modulo& operator=(dynamic_modulo&&) = default; ~dynamic_modulo() = default; constexpr uint64 get()const { return value; } constexpr friend auto operator+(dynamic_modulo const& lhs, dynamic_modulo const& rhs) { return lhs.mod != rhs.mod ? throw std::logic_error("math::dynamic_modulo mod number error") : dynamic_modulo((lhs.value + rhs.value) % lhs.mod, lhs.mod); } constexpr friend auto operator+(dynamic_modulo const& lhs, uint64 const& rhs) { return dynamic_modulo((lhs.value + rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator+(dynamic_modulo const& lhs, int64 const& rhs) { return dynamic_modulo(abs((lhs.value + rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator+(dynamic_modulo const& lhs, unsigned int const& rhs) { return dynamic_modulo((lhs.value + rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator+(dynamic_modulo const& lhs, int const& rhs) { return dynamic_modulo(abs((lhs.value + rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator+(uint64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo((lhs.value + rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator+(int64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value + rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator+(unsigned int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo((lhs.value + rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator+(int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value + rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, dynamic_modulo const& rhs) { return lhs.mod != rhs.mod ? throw std::logic_error("math::dynamic_modulo mod number error") : dynamic_modulo((lhs.value * rhs.value) % lhs.mod, lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, uint64 const& rhs) { return dynamic_modulo((lhs.value * rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, int64 const& rhs) { return dynamic_modulo(abs((lhs.value * rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, unsigned int const& rhs) { return dynamic_modulo((lhs.value * rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, int const& rhs) { return dynamic_modulo(abs((lhs.value * rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator*(uint64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo((lhs.value * rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator*(int64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value * rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator*(unsigned int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo((lhs.value * rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator*(int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value * rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, dynamic_modulo const& rhs) { return lhs.mod != rhs.mod ? throw std::logic_error("math::dynamic_modulo mod number error") : dynamic_modulo(abs((lhs.value - rhs.value) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, uint64 const& rhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, int64 const& rhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, unsigned int const& rhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, int const& rhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(uint64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(int64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(unsigned int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } template<class Rhs>dynamic_modulo& operator+=(Rhs const& rhs) { return *this = *this + rhs; } template<class Rhs>dynamic_modulo& operator-=(Rhs const& rhs) { return *this = *this - rhs; } template<class Rhs>dynamic_modulo& operator*=(Rhs const& rhs) { return *this = *this * rhs; } }; } namespace geometry { template<class Type>struct point { Type x, y; }; template<class Type>auto make_point(Type x, Type y) { return point<Type>{x, y}; } template<class Type>auto operator+(point<Type>const& lhs, point<Type>const& rhs) { return make_point(lhs.x + rhs.x, lhs.y + rhs.y); } template<class Type>auto operator-(point<Type>const& lhs, point<Type>const& rhs) { return make_point(lhs.x - rhs.x, lhs.y - rhs.y); } template<class Point>struct box { Point small, large; }; template<class Point>auto make_box(Point a, Point b) { return box<Point>{ make_point(std::min(a.x, b.x), std::min(a.y, b.y)), make_point(std::max(a.x, b.x), std::max(a.y, b.y))}; } #ifndef PLASMA_NO_BOOST template<class Point>boost::optional<box<Point>> hit_check(box<Point> a, box<Point> b) { if (a.small.x > b.small.x) std::swap(a, b); if (a.large.x < b.small.x) return boost::none; auto small_x = b.small.x; auto large_x = std::min(b.large.x, a.large.x); if (a.small.y < b.small.y) { if (b.small.y < a.large.y) return make_box( make_point(small_x, b.small.y), make_point(large_x, std::min(a.large.y, b.large.y))); else return boost::none; } else { if (a.small.y < b.large.y) return make_box( make_point(small_x, a.small.y), make_point(large_x, std::min(a.large.y, b.large.y))); else return boost::none; } } #endif } namespace graph_traits { class graph { std::vector<int64> node_data; std::vector<std::vector<std::pair<int, int64>>> edge_data; public: graph() = default; graph(std::vector<int64>&& n) :node_data(std::move(n)), edge_data{} { edge_data.resize(node_data.size()); } graph(std::size_t size) :node_data(size), edge_data{} { } void resize(int size) { node_data.resize(size); edge_data.resize(size); } void edge_reserve(int size) { for (auto& v : edge_data) { v.reserve(size); } } void add_node(int64 data) { node_data.emplace_back(data); edge_data.emplace_back(); } void add_edge(int from, int to, int64 data) { edge_data[from].emplace_back(to, data); } std::vector<math::infinite_value<int64>> dijkstra(int from)const { struct compare { bool operator()( std::pair<int, math::infinite_value<int64>>const& lhs, std::pair<int, math::infinite_value<int64>>const& rhs)const { return lhs.second > rhs.second; } }; std::priority_queue< std::pair<int, math::infinite_value<int64>>, std::vector<std::pair<int, math::infinite_value<int64>>>, compare>nodes; std::vector<math::infinite_value<int64>> ret(node_data.size()); for (int i{};i < node_data.size();++i) { nodes.emplace(i, math::infinite_value<int64>()); } nodes.emplace(from, int()); while (nodes.size()) { auto p = nodes.top(); nodes.pop(); if (ret[p.first] <= p.second) continue; ret[p.first] = p.second; for (auto const& d : edge_data[p.first]) { nodes.emplace(d.first, std::min(ret[d.first], ret[p.first] + d.second)); } } return ret; } int64 operator[](int n)const { return node_data[n]; } }; } void Main(std::integral_constant<int, 1>); void Main(std::integral_constant<int, 2>); void Main(std::integral_constant<int, 3>); void Main(std::integral_constant<int, 4>); void Main(std::integral_constant<int, 5>); #endif//テンプレートここまで //ここを書き換える constexpr int problem = 1; //ここは書き換えない int main() { std::cin.sync_with_stdio(false); std::cout << std::setprecision(std::numeric_limits<long double>::digits10 + 1); Main(std::integral_constant<int, problem>{}); } void Main(std::integral_constant<int, 1>) { std::vector<int> vec; int N, K; std::cin >> N >> K; for (int i{};i < K;++i) { int C; std::cin >> C; vec.emplace_back(C); } for (int i = N;i < 10000;++i) { int v = i; while (v) { if (std::binary_search(vec.begin(), vec.end(), v % 10) goto next; v /= 10; } std::cout << i << std::endl; break; next:; } } typedef math::modulo_number<1000000007> number_t; number_t helper(number_t k,number_t n) { } std::vector<number_t> check(std::vector<number_t>const& data, std::size_t H) { std::vector<number_t> ret; int W = data.size(); for (int i{};i < W;++i) { number_t num; for (int index = 1;index <= i;++index) { num += data[i - index] * helper(H - 1, index); } } return ret; } void Main(std::integral_constant<int, 2>) { int H, W, A, B; std::cin >> H >> W >> A >> B; std::vector<math::modulo_number<1000000007>> data(W, number_t(1)); auto vec = check(data, H - A); auto ite = std::next(vec.begin(), B); vec.erase(vec.begin(), ite); auto ret = check(vec, A + 1); std::cout << ret.back().get() << std::endl; } void Main(std::integral_constant<int, 3>) { } void Main(std::integral_constant<int, 4>) { } void Main(std::integral_constant<int, 5>) { }
a.cc:29:9: fatal error: boost/optional.hpp: No such file or directory 29 | #include<boost/optional.hpp> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s156513793
p04039
C++
#include<cstdio> #include<set> #include<algorithm> using namespace std; int len,k; char c[10]; int bit[10]; int dis[10],to[10]; int fir; void go() {//puts("__"); int wei=len; for(int i=1;i<=wei;i++) { if(to[bit[i]]==-1) { bit[i]=fir,bit[i+1]++; if(i==len)wei=len+1; } else bit[i]=to[bit[i]]; } if(bit[wei]==0)wei--; for(int i=wei+1;i;i--)printf("%d",bit[i]);puts(""); } int main() { while(~scanf("%s%d",c+1,&k)) { len=strlen(c+1); for(int i=1;i<=len;i++)bit[i]=c[len+1-i]-'0';bit[len+1]=0; memset(dis,0,sizeof dis); fir=9; while(k--) { int x;scanf("%d",&x);dis[x]=1; } for(int i=0;i<=9;i++) { if(!dis[i]) { fir=i;break; } } for(int i=0;i<=9;i++) { to[i]=-1; for(int j=i;j<=9;j++) { if(!dis[j]) { to[i]=j;break; } } } go(); } }
a.cc: In function 'int main()': a.cc:29:13: error: 'strlen' was not declared in this scope 29 | len=strlen(c+1); | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 | using namespace std; a.cc:31:9: error: 'memset' was not declared in this scope 31 | memset(dis,0,sizeof dis); | ^~~~~~ a.cc:31:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s660988655
p04039
C
#include<stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> int main() { int n; int k; int d1; int d2; int d3; int d4; int d5; int d6; int d7; int d8; int d9; int d10; int i; int cnt0; int cnt1; int cnt2; int cnt3; int cnt4; int cnt5; int cnt6; int cnt7; int cnt8; int cnt9; int a; // 個数のの入力 scanf("%d %d",&n,&k); scanf("%d %d %d %d %d %d %d %d %d %d ",&d1,&d2,&d3,&d4,&d5,&d6,&d7,&d8,&d9,&d10); a = (int)log10(n) + 1; if (k == 1) { if (d1 == 0) { printf("%d\n",n); } } if (d1 == 0 ) { cnt0 = cnt0 + 1;     } return 0; }
main.c: In function 'main': main.c:49:1: error: stray '\343' in program 49 | <U+3000><U+3000><U+3000><U+3000>} | ^~~~~~~~ main.c:49:3: error: stray '\343' in program 49 | <U+3000><U+3000><U+3000><U+3000>} | ^~~~~~~~ main.c:49:5: error: stray '\343' in program 49 | <U+3000><U+3000><U+3000><U+3000>} | ^~~~~~~~ main.c:49:7: error: stray '\343' in program 49 | <U+3000><U+3000><U+3000><U+3000>} | ^~~~~~~~
s453794371
p04039
C
#include<stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> int main() { int n; int k; int d1; int d2; int d3; int d4; int d5; int d6; int d7; int d8; int d9; int d10; int i; int cnt0; int cnt1; int cnt2; int cnt3; int cnt4; int cnt5; int cnt6; int cnt7; int cnt8; int cnt9; int a; // 個数のの入力 scanf("%d %d",$n,&k); scanf("%d %d %d %d %d %d %d %d %d %d ",&d1,&d2,&d3,&d4,&d5,&d6,&d7,&d8,&d9,&d10); a = (int)log10(n) + 1; if (k == 1) { if (d1 == 0) { printf("%d\n",n); } } return 0; }
main.c: In function 'main': main.c:36:23: error: '$n' undeclared (first use in this function); did you mean 'n'? 36 | scanf("%d %d",$n,&k); | ^~ | n main.c:36:23: note: each undeclared identifier is reported only once for each function it appears in
s362379892
p04039
C++
import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { try(Scanner scan = new Scanner(new InputStreamReader(System.in))){ int N = scan.nextInt(); int K = scan.nextInt(); boolean[] D = new boolean[10]; int min = 0; int minNot0 = 1; for(int i = 0; i<K; i++){ int tmp = scan.nextInt(); if(min == tmp){ min++; minNot0 = min; } if(minNot0 == tmp){ minNot0++; } D[tmp] = true; } String nStr = String.valueOf(N); StringBuffer ans = new StringBuffer(); boolean isLarge = false; for(int i = 0; i<nStr.length(); i++){ if(isLarge){ ans.append(min); }else if(D[Character.digit(nStr.charAt(i),10)] == false){ ans.append(nStr.charAt(i)); }else{ for(int j = Character.digit(nStr.charAt(i),10); j<K; j++){ if(D[j] == false){ ans.append(j); isLarge = true; break; } } if(isLarge == false){ ans.append(minNot0); i--; } } } System.out.println(ans.toString()); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.InputStreamReader; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Scanner; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main { | ^~~~~~
s674892765
p04039
C++
9999 9 0 1 2 3 4 5 6 7 9
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 9999 9 | ^~~~
s800707445
p04039
C++
#include <stdio.h> #include <cstdlib> #include <string.h> #include <math.h> #include <string> #include <vector> #include <list> #include <set> #include <iostream> #include <fstream> #include <map> #include <algorithm> #include "windows.h" //#include "../../gmp_int.h" //#include "../../common.h" #define MAX(a, b) ((a)>(b)?(a):(b)) #define MAX3(a, b, c) (MAX((a),MAX((b),(c)))) #define FOR(a,b,c) for (s32(a)=(b);(a)<(s32)(c);(a)++) #define BL {char bl[10];cin.getline(bl, 10);} #define GL(c) cin.getline(c, sizeof(c)) typedef char s8; typedef unsigned char u8; typedef short s16; typedef unsigned short u16; typedef int s32; typedef unsigned int u32; typedef long long int s64; typedef unsigned long long int u64; using namespace std; //ifstream test_input; //#define cin test_input int main(int argc, char* argv[]) { cout.precision(15); s64 N, K, D[11]; bool ok[11]; cin >> N >> K; FOR(i, 0, 10) ok[i] = true; FOR(i, 0, K) { cin >> D[i]; ok[D[i]] = false; } for (s64 x = N;; x++) { s64 y = x; bool ng = false; while (y > 0) { if (!ok[y % 10]) { ng = true; break; } y /= 10; } if (!ng) { cout << x << endl; break; } } return 0; }
a.cc:13:10: fatal error: windows.h: No such file or directory 13 | #include "windows.h" | ^~~~~~~~~~~ compilation terminated.
s908153596
p04039
Java
import java.io.*; import java.util.*; public class tmp { public static InputReader in; public static PrintWriter out; public static final int MOD = (int) (1e9 + 7); public static void main(String[] args) { in = new InputReader(System.in); out = new PrintWriter(System.out); int n = in.nextInt(), k = in.nextInt(); int[] d = in.nextIntArray(k); for (int i = n; i < 10000; i++) { char[] num = Integer.toString(i).toCharArray(); boolean isValid = true; for (int j = 0; j < num.length; j++) { for (int ii : d) { if(ii == (int)num[j] - (int)'0') isValid = false; } } if(isValid) { out.println(i); break; } } out.close(); } static class Node implements Comparable<Node>{ int next; long dist; public Node (int u, int v) { this.next = u; this.dist = v; } public void print() { out.println(next + " " + dist + " "); } public int compareTo(Node n) { return Integer.compare(-this.next, -n.next); } } static class InputReader { private InputStream stream; private byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) c = snext(); int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) c = snext(); int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } 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 interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Main.java:4: error: class tmp is public, should be declared in a file named tmp.java public class tmp { ^ 1 error
s539105770
p04039
Java
import java.io.*; import java.util.*; public class tmp { public static InputReader in; public static PrintWriter out; public static final int MOD = (int) (1e9 + 7); public static void main(String[] args) { in = new InputReader(System.in); out = new PrintWriter(System.out); int n = in.nextInt(), k = in.nextInt(); int[] d = in.nextIntArray(k); for (int i = n; i < 10000; i++) { char[] num = Integer.toString(i).toCharArray(); boolean isValid = true; for (int j = 0; j < num.length; j++) { for (int ii : d) { if(ii == (int)num[j] - (int)'0') isValid = false; } } if(isValid) { out.println(i); break; } } out.close(); } static class Node implements Comparable<Node>{ int next; long dist; public Node (int u, int v) { this.next = u; this.dist = v; } public void print() { out.println(next + " " + dist + " "); } public int compareTo(Node n) { return Integer.compare(-this.next, -n.next); } } static class InputReader { private InputStream stream; private byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) c = snext(); int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) c = snext(); int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } 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 interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Main.java:4: error: class tmp is public, should be declared in a file named tmp.java public class tmp { ^ 1 error
s087278058
p04039
Java
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class IrohasObsession { public static void main(String[] args) { InputReader r = new InputReader(System.in); int n = r.nextInt(); int k = r.nextInt(); boolean[] can = new boolean[10]; for (int i = 0; i < k; i++) { can[r.nextInt()] = true; } for (int res = n;; res++) { int x = res; boolean win = true; while (x > 0) { int dig = x % 10; x /= 10; if (can[dig]) { win = false; } } if (win) { System.out.println(res); return; } } } static class InputReader { private BufferedReader reader; private StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public InputReader(FileReader stream) { reader = new BufferedReader(stream); tokenizer = null; } public String nextLine() { try { return reader.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } } }
Main.java:8: error: class IrohasObsession is public, should be declared in a file named IrohasObsession.java public class IrohasObsession { ^ 1 error
s201597543
p04040
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll mod=1000000007; ll fact[200002]; ll ncr[200003]; ll power(ll a, ll b) { ll res = 1; while (b > 0) { if (b & 1) res=(res*a)%mod; b>>=1; a=(a*a)%mod; } return res; } ll solve(ll x, ll y) { ll res = fact[x+y]; res=(res*ncr[x])%mod; res=(res*ncr[y])%mod; return rc; } int main() { fact[0]=1; ncr[0]= 1; for(int x=1; x<=200000;x++) {fact[x] = (x*fact[x-1])%mod; ncr[x] = power(fact[x],mod-2); } ll h,w,a,b; cin>>h>>w>>a>>b; ll y= h-a-1; ll ans = 0; for(int i=b;i<w;i++) { ll r1=solve(y,i); ll r2=solve(h-y-2,w-i-1); ans+=(r1*r2)%mod; ans=ans%mod; } cout<<ans<<endl; }
a.cc: In function 'll solve(ll, ll)': a.cc:27:8: error: 'rc' was not declared in this scope 27 | return rc; | ^~
s536854793
p04040
C++
#include <bits/stdc++.h> #pragma warning (disable:4996) using namespace std; using ll = long long; using LL = ll; using ull = unsigned long long; using uLL = ull; #define clean_0(A) memset((A),0,sizeof(A)) #define clean_1(A) memset((A),-1,sizeof(A)) #define For(i,a,b) for(int (i)=(a);(i)<=b;++(i)) #define Max_(a,b) ((a)>=(b)?(a):(b)) #define Min_(a,b) ((a)<=(b)?(a):(b)) constexpr auto Max = [](const auto& a, const auto& b) {return a >= b ? a : b; }; constexpr auto Min = [](const auto& a, const auto& b) {return a <= b ? a : b; }; constexpr int INF = 0x7F7F7F7F; constexpr double eps = 1e-9; constexpr ll mod1 = 197; constexpr ll mod2 = 19260817; constexpr ll mod3 = ll(1e8) + 7; constexpr ll mod4 = ll(1e9) + 7;; constexpr ll mod5 = 998244353; constexpr ll mod = mod4; constexpr int maxn = int(3e5) + 1; constexpr int MAXN = maxn; namespace io { #define in(a) (a=read()) #define out(a) write(a) #define outn(a) (out(a),putchar('\n')) #define I_int int inline I_int read() { I_int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } template<typename T> bool scan_d(T& ret) { #define p(x) ((x)>='0'&&(x)<='9') int c; int sgn; if (c = getchar(), c == EOF)return false; while (c != '-' && !p(c))c = getchar(); sgn = (c == '-') ? -1 : 1; ret = (c == '-') ? 0 : c - '0'; while (c = getchar(), p(c))ret = ret * 10 + c - '0'; ret *= sgn; return true; #undef p } char F[200]; template<typename T> inline void write(T x) { if (x == 0) { putchar('0'); return; } auto tmp = x > 0 ? x : -x; if (x < 0) putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0) putchar(F[--cnt]); } void read(char* s, int Arr[], size_t n) { for (size_t i = 0; i < n; ++i)Arr[i] = strtoll(s, &s, 10); } #undef I_int } using namespace io; constexpr auto ModUp = [](const auto& x, ll Mod = mod) {return (x % Mod + Mod) % Mod; }; template<typename T> constexpr T exgcd(T a, T b, T& x, T& y) { if (a == 0 && b == 0)return -1; if (b == 0) { x = 1, y = 0; return a; } T d = exgcd(b, a % b, y, x); y -= a / b * x; return d; } template<typename T> constexpr T inv1(T a, T Mod = mod) { T x = -1, y = -1; return exgcd(a, Mod, x, y) == 1 ? (x % Mod + Mod) % Mod : -1; } template<typename T> constexpr T _gcd(T a, T b) { return b ? _gcd(b, a % b) : a; } template<typename T> constexpr T combinator(T n, T m, T Mod = mod - 1) { m = min(m, n - m); T ret = 1; for (T i = 1; i <= m; ++i) { ret = ret * (n - m + i) / i % Mod; } return ret; } template<typename T> constexpr T poww(T a, T b, T Mod = mod) { T ret = 1; a %= Mod; b %= Mod - 1; if (b < 0)b += Mod - 1; while (b) { if (b & 1)ret = ret * a % Mod; a = a * a % Mod; b >>= 1; } return ret; } constexpr auto inv2 = [](ll a, ll Mod = mod) {return poww(a, Mod - 2, Mod); }; struct Combinator1 { static constexpr int Mod = ::mod; static constexpr int Maxn = 1;//::maxn; int dp[Maxn][Maxn];//this is C(n,m)%(mod-1) constexpr Combinator1() :dp() { for (int i = 0; i < Maxn; ++i) { for (int j = 0; j <= i; ++j) { if (j == 0) dp[i][j] = 1; else if (i == j) dp[i][j] = 1; else dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % (Mod - 1); } } } }; struct Combinator2 { static constexpr int Mod = ::mod; static constexpr int Maxn = ::maxn; ll Fact[Maxn], Inv_Fact[Maxn]; constexpr Combinator2(const int n = Maxn - 1) :Fact(), Inv_Fact() { Fact[0] = 1; for (int i = 1; i < n; ++i) Fact[i] = Fact[i - 1] * i % Mod; Inv_Fact[0] = 1; Inv_Fact[n] = inv2(Fact[n], Mod); for (int i = n; i > 1; --i) Inv_Fact[i - 1] = Inv_Fact[i] * i % Mod; } constexpr ll Comb(int a, int b)const { if (a < 0 || b < 0)return 1; return Fact[a] * Inv_Fact[b] % Mod * Inv_Fact[a - b] % Mod; } }; constexpr Combinator2 a; int main() { int A, B, H, W; while (cin >> H >> W >> A >> B) { ll ans = a.Comb(H + W - 2, H - 1); for (ll i = 1; i <= B; i++) { ans -= a.Comb(H - A + i - 2, H - A - 1) * a.Comb(A - 1 + W - i, A - 1) % mod; ans = ModUp(ans); } cout << ans << endl; } }
a.cc:162:23: in 'constexpr' expansion of 'Combinator2((((int)Combinator2::Maxn) - 1))' a.cc:149:17: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit) 149 | for (int i = 1; i < n; ++i) | ^~~
s599361687
p04040
C++
#include <bits/stdc++.h> #pragma warning (disable:4996) using namespace std; using ll = long long; using LL = ll; using ull = unsigned long long; using uLL = ull; #define clean_0(A) memset((A),0,sizeof(A)) #define clean_1(A) memset((A),-1,sizeof(A)) #define For(i,a,b) for(int (i)=(a);(i)<=b;++(i)) #define Max_(a,b) ((a)>=(b)?(a):(b)) #define Min_(a,b) ((a)<=(b)?(a):(b)) constexpr auto Max = [](const auto& a, const auto& b) {return a >= b ? a : b; }; constexpr auto Min = [](const auto& a, const auto& b) {return a <= b ? a : b; }; constexpr int INF = 0x7F7F7F7F; constexpr double eps = 1e-9; constexpr ll mod1 = 197; constexpr ll mod2 = 19260817; constexpr ll mod3 = ll(1e8) + 7; constexpr ll mod4 = ll(1e9) + 7;; constexpr ll mod5 = 998244353; constexpr int mod = mod4; constexpr int maxn = int(3e5) + 1; constexpr int MAXN = maxn; namespace io { #define in(a) (a=read()) #define out(a) write(a) #define outn(a) (out(a),putchar('\n')) #define I_int int inline I_int read() { I_int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } template<typename T> bool scan_d(T& ret) { #define p(x) ((x)>='0'&&(x)<='9') int c; int sgn; if (c = getchar(), c == EOF)return false; while (c != '-' && !p(c))c = getchar(); sgn = (c == '-') ? -1 : 1; ret = (c == '-') ? 0 : c - '0'; while (c = getchar(), p(c))ret = ret * 10 + c - '0'; ret *= sgn; return true; #undef p } char F[200]; template<typename T> inline void write(T x) { if (x == 0) { putchar('0'); return; } auto tmp = x > 0 ? x : -x; if (x < 0) putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0) putchar(F[--cnt]); } void read(char* s, int Arr[], size_t n) { for (size_t i = 0; i < n; ++i)Arr[i] = strtoll(s, &s, 10); } #undef I_int } using namespace io; template<typename T> T exgcd(T a, T b, T& x, T& y) { if (a == 0 && b == 0)return -1; if (b == 0) { x = 1, y = 0; return a; } T d = exgcd(b, a % b, y, x); y -= a / b * x; return d; } template<typename T> T inv1(T a,T Mod=mod) { T x, y; return exgcd(a, Mod, x, y) == 1 ? (x % Mod + Mod) % Mod : -1; } auto inv2 = [](auto a, auto Mod) {return poww<ll>(a, Mod - 1, Mod); }; template<typename T> constexpr T _gcd(T a, T b) { return b ? _gcd(b, a % b) : a; } template<typename T> constexpr T combinator(T n, T m, T Mod = mod - 1) { m = min(m, n - m); T ret = 1; for (T i = 1; i <= m; ++i) { ret = ret * (n - m + i) / i % Mod; } return ret; } template<typename T> constexpr T poww(T a, T b, T Mod = mod) { T ret = 1; a %= Mod; b %= Mod - 1; if (b < 0)b += Mod - 1; while (b) { if (b & 1)ret = ret * a % Mod; a = a * a % Mod; b >>= 1; } return ret; } struct Combinator { static constexpr int Mod = ::mod; static constexpr int Maxn = 1;//::maxn; int dp[Maxn][Maxn];//this is C(n,m)%(mod-1) constexpr Combinator() :dp() { for (int i = 0; i < Maxn; ++i) { for (int j = 0; j <= i; ++j) { if (j == 0) dp[i][j] = 1; else if (i == j) dp[i][j] = 1; else dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % (Mod - 1); } } } }; ll Fact[maxn], Inv[maxn]; //void Init(int n) //{ // Fact[0] = 1; // for (int i = 1; i <= n; i++) // Fact[i] = Fact[i - 1] * i % mod; // Inv[0] = 1; // Inv[n] = poww(Fact[n], mod - 2LL); // for (int i = n - 1; i > 0; i--) // Inv[i] = Inv[i + 1] * (i + 1LL) % mod; //} //ll C(int a, int b) { // if (a < 0 || b < 0)return 1; // return F[a] * Inv[b] % mod * Inv[a - b] % mod; //} //int main() //{ // Init(2.1e5); // int a, b, h, w; // while (cin >> h>>w>>a>>b) // { // ll ans = C(h + w - 2, h - 1); // for (ll i = 1; i <= b; i++) { // ans -= C(h - a + i - 2, h - a - 1) * C(a - 1 + w - i, a - 1) % mod; // ans = (ans % mod + mod) % mod; // } // printf("%lld", ans); // } //} int H, W, A, B; const ll Maxn = maxn; const int Mod = mod; void Init(int N) { Fact[0] = 1; for (int i = 1; i <= N; i++) Fact[i] = Fact[i - 1] * i % Mod; Inv[0] = 1; Inv[N] = inv2(Fact[N], Mod - 2LL);//poww(Fact[N], Mod - 2LL); for (int i = N - 1; i > 0; i--) Inv[i] = Inv[i + 1] * (i + 1) % Mod; } ll C(int a, int b) { if (a < 0 || b < 0)return 1; return Fact[a] * Inv[b] % Mod * Inv[a - b] % Mod; } int main() { scanf("%d %d %d %d", &H, &W, &A, &B); Init(H+W-2); ll ans = C(H + W - 2, H - 1); for (ll i = 1; i <= B; i++) { ans -= C(H - A + i - 2, H - A - 1) * C(A - 1 + W - i, A - 1) % Mod; ans = (ans % Mod + Mod) % Mod; } printf("%lld", ans); }
a.cc: In lambda function: a.cc:91:42: error: 'poww' was not declared in this scope; did you mean 'powl'? 91 | auto inv2 = [](auto a, auto Mod) {return poww<ll>(a, Mod - 1, Mod); }; | ^~~~ | powl a.cc:91:49: error: expected primary-expression before '>' token 91 | auto inv2 = [](auto a, auto Mod) {return poww<ll>(a, Mod - 1, Mod); }; | ^
s556142762
p04040
C++
#include <bits/stdc++.h> #pragma warning (disable:4996) using namespace std; using ll = long long; using LL = ll; using ull = unsigned long long; using uLL = ull; #define clean_0(A) memset((A),0,sizeof(A)) #define clean_1(A) memset((A),-1,sizeof(A)) #define For(i,a,b) for(int (i)=(a);(i)<=b;++(i)) #define Max_(a,b) ((a)>=(b)?(a):(b)) #define Min_(a,b) ((a)<=(b)?(a):(b)) constexpr auto Max = [](const auto& a, const auto& b) {return a >= b ? a : b; }; constexpr auto Min = [](const auto& a, const auto& b) {return a <= b ? a : b; }; constexpr int INF = 0x7F7F7F7F; constexpr double eps = 1e-9; constexpr ll mod1 = 197; constexpr ll mod2 = 19260817; constexpr ll mod3 = ll(1e8) + 7; constexpr ll mod4 = ll(1e9) + 7;; constexpr ll mod5 = 998244353; constexpr int mod = mod4; constexpr int maxn = int(3e5) + 1; constexpr int MAXN = maxn; namespace io { #define in(a) (a=read()) #define out(a) write(a) #define outn(a) (out(a),putchar('\n')) #define I_int int inline I_int read() { I_int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } template<typename T> bool scan_d(T& ret) { #define p(x) ((x)>='0'&&(x)<='9') int c; int sgn; if (c = getchar(), c == EOF)return false; while (c != '-' && !p(c))c = getchar(); sgn = (c == '-') ? -1 : 1; ret = (c == '-') ? 0 : c - '0'; while (c = getchar(), p(c))ret = ret * 10 + c - '0'; ret *= sgn; return true; #undef p } char F[200]; template<typename T> inline void write(T x) { if (x == 0) { putchar('0'); return; } auto tmp = x > 0 ? x : -x; if (x < 0) putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0) putchar(F[--cnt]); } void read(char* s, int Arr[], size_t n) { for (size_t i = 0; i < n; ++i)Arr[i] = strtoll(s, &s, 10); } #undef I_int } using namespace io; template<typename T> T exgcd(T a, T b, T& x, T& y) { if (a == 0 && b == 0)return -1; if (b == 0) { x = 1, y = 0; return a; } T d = exgcd(b, a % b, y, x); y -= a / b * x; return d; } template<typename T> T inv1(T a,T Mod=mod) { T x, y; return exgcd(a, Mod, x, y) == 1 ? (x % Mod + Mod) % Mod : -1; } auto inv2 = [](auto a, auto Mod) {return poww(a, Mod - 1, Mod); }; template<typename T> constexpr T _gcd(T a, T b) { return b ? _gcd(b, a % b) : a; } template<typename T> constexpr T combinator(T n, T m, T Mod = mod - 1) { m = min(m, n - m); T ret = 1; for (T i = 1; i <= m; ++i) { ret = ret * (n - m + i) / i % Mod; } return ret; } template<typename T> constexpr T poww(T a, T b, T Mod = mod) { T ret = 1; a %= Mod; b %= Mod - 1; if (b < 0)b += Mod - 1; while (b) { if (b & 1)ret = ret * a % Mod; a = a * a % Mod; b >>= 1; } return ret; } struct Combinator { static constexpr int Mod = ::mod; static constexpr int Maxn = 1;//::maxn; int dp[Maxn][Maxn];//this is C(n,m)%(mod-1) constexpr Combinator() :dp() { for (int i = 0; i < Maxn; ++i) { for (int j = 0; j <= i; ++j) { if (j == 0) dp[i][j] = 1; else if (i == j) dp[i][j] = 1; else dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % (Mod - 1); } } } }; ll Fact[maxn], Inv[maxn]; //void Init(int n) //{ // Fact[0] = 1; // for (int i = 1; i <= n; i++) // Fact[i] = Fact[i - 1] * i % mod; // Inv[0] = 1; // Inv[n] = poww(Fact[n], mod - 2LL); // for (int i = n - 1; i > 0; i--) // Inv[i] = Inv[i + 1] * (i + 1LL) % mod; //} //ll C(int a, int b) { // if (a < 0 || b < 0)return 1; // return F[a] * Inv[b] % mod * Inv[a - b] % mod; //} //int main() //{ // Init(2.1e5); // int a, b, h, w; // while (cin >> h>>w>>a>>b) // { // ll ans = C(h + w - 2, h - 1); // for (ll i = 1; i <= b; i++) { // ans -= C(h - a + i - 2, h - a - 1) * C(a - 1 + w - i, a - 1) % mod; // ans = (ans % mod + mod) % mod; // } // printf("%lld", ans); // } //} int H, W, A, B; const ll Maxn = maxn; const int Mod = mod; void Init(int N) { Fact[0] = 1; for (int i = 1; i <= N; i++) Fact[i] = Fact[i - 1] * i % Mod; Inv[0] = 1; Inv[N] = inv2(Fact[N], Mod - 2LL);//poww(Fact[N], Mod - 2LL); for (int i = N - 1; i > 0; i--) Inv[i] = Inv[i + 1] * (i + 1) % Mod; } ll C(int a, int b) { if (a < 0 || b < 0)return 1; return Fact[a] * Inv[b] % Mod * Inv[a - b] % Mod; } int main() { scanf("%d %d %d %d", &H, &W, &A, &B); Init(H+W-2); ll ans = C(H + W - 2, H - 1); for (ll i = 1; i <= B; i++) { ans -= C(H - A + i - 2, H - A - 1) * C(A - 1 + W - i, A - 1) % Mod; ans = (ans % Mod + Mod) % Mod; } printf("%lld", ans); }
a.cc: In instantiation of '<lambda(auto:32, auto:33)> [with auto:32 = long long int; auto:33 = long long int]': a.cc:180:15: required from here 180 | Inv[N] = inv2(Fact[N], Mod - 2LL);//poww(Fact[N], Mod - 2LL); | ~~~~^~~~~~~~~~~~~~~~~~~~ a.cc:91:46: error: 'poww' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation 91 | auto inv2 = [](auto a, auto Mod) {return poww(a, Mod - 1, Mod); }; | ~~~~^~~~~~~~~~~~~~~~~ a.cc:109:13: note: 'template<class T> constexpr T poww(T, T, T)' declared here, later in the translation unit 109 | constexpr T poww(T a, T b, T Mod = mod) | ^~~~
s306296952
p04040
C++
#include<bits/stdc++.h> using namespace std; typedef long long LL; const int P = 1000000007; LL f[1000001], v[1000001]; LL rp(LL now, int k) { LL will = 1; for (; k; k >>= 1, now *= now, now %= P) { if (k & 1) will *= now, will %= P; } return will; } LL C(int n, int m) { if(n < m) return 0; if(m == 0) return 1; return f[n] * rp(f[m], P - 2) % P * rp(f[n - m], P - 2) % P; } void init() { f[0] = 1; v[0] = 1; for (int i = 1; i <= 1000000; i++) //1e6以 内的组合数 { f[i] = f[i - 1] * i % P; } } int main() { init(); int h, w, a, b; cin >> h >> w >> a >> b; LL ans = 0; for(int i = b + 1; i <= w; i++) {· // printf("C(%d, %d)\n", (h - a) + (b + i) - 2, h - a - 1); // printf("C(%d, %d)\n", a + (w - b - i + 1), a - 1); LL tmp = C((h - a) + i - 2, i - 1) * C(a + (w - i + 1) - 2, w - i) % P; ans = (ans + tmp) % P; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:35:38: error: '\U000000b7' was not declared in this scope 35 | for(int i = b + 1; i <= w; i++) {· | ^ a.cc:39:22: error: 'tmp' was not declared in this scope; did you mean 'tm'? 39 | ans = (ans + tmp) % P; | ^~~ | tm
s560663719
p04040
C++
#include<iostream> #include<cstring> using namespace std; const int maxn = 1e5 + 5; const int mod = 1e9 + 7; int dp[maxn][maxn]; int h, w, a, b; bool range(int i, int j) { return i <= h - 1 && i >= h - a && j >= 0 && j < b; } int main() { memset(dp, 0, sizeof(dp)); cin >> h >> w >> a >> b; for(int i = 0; i < h; i ++) if(!range(i, 0)) dp[i][0] = 1; for(int i = 0; i < w; i ++) if(!range(0, i)) dp[0][i] = 1; for(int i = 1; i < h; i ++) { for(int j = 1; j < w; j ++) if(!range(i, j)) dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod; } cout << dp[h - 1][w - 1] << endl; }
/tmp/ccT85Zcu.o: in function `range(int, int)': a.cc:(.text+0xc): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0x17): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0x1d): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccT85Zcu.o /tmp/ccT85Zcu.o: in function `main': a.cc:(.text+0x73): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0x8f): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0xb9): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0x107): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0x150): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccT85Zcu.o a.cc:(.text+0x231): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s651758784
p04040
C++
#include<bits/stdc++.h> #define Mod 1000000007 #define Val(x) (((long long)x) % Mod) #define maxn 200005 using namespace std; int fac[maxn]; int Pow(int a,int n) { int ret = 1; int base = a; while(n) { if(n&1) ret = Val(ret*base); base = Val(base*base); n >>= 1; } return ret; } int cal(int n,int m) { return Val(Val(fac[n+m]*Pow(fac[n],Mod-2))*Pow(fac[m],Mod-2)); } int main() { ios::sync_with_stdio(0); cin.tie(0); fac[0] = 1; for(int i=1;i<maxn;i++)a fac[i] = Val(fac[i-1] * i); int n,m,a,b; cin >> n >> m >> a >> b; int ans = 0; for(int j=b+1;j<=m;j++) ans = Val(ans + Val(cal(n-a-1,j-1)*cal(a-1,m-j))); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:32: error: 'a' was not declared in this scope 24 | for(int i=1;i<maxn;i++)a | ^
s672094405
p04040
C++
#include<bits/stdc++.h> using namespace std; long long f[2000000],n[2000000]; long long p=1000000007; long long mi(long long x,long long y,long long c) { long long ans=1; while(y) { if(y&1) ans=ans*x%c; x=x*x%c; y>>=1; } return ans; } long long mo(int x,int y) { if(x==y||y==0) { return 1; } return ((f[x]%p*n[y]%p)%p*n[x-y]%p)%p; } int main(){ f[1]=1; for(int i=2;i<=200000;i++) { f[i]=(f[i-1]%p*i)%p; } n[200000]=mi(f[200000],p-2); for(int i=199999;i>=1;i--) { n[i]=(n[i+1]%p*(i+1)%p)%p; } cin>>n>>m>>a>>b; for(int i=1;i<=n-a;i++) { ans+=() } return 0; }
a.cc: In function 'int main()': a.cc:30:21: error: too few arguments to function 'long long int mi(long long int, long long int, long long int)' 30 | n[200000]=mi(f[200000],p-2); | ~~^~~~~~~~~~~~~~~ a.cc:5:11: note: declared here 5 | long long mi(long long x,long long y,long long c) | ^~ a.cc:35:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'long long int [2000000]') 35 | cin>>n>>m>>a>>b; | ~~~^~~ | | | | | long long int [2000000] | std::istream {aka std::basic_istream<char>} In file included 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/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'long long int*' 35 | cin>>n>>m>>a>>b; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long int*' to 'short int' [-fpermissive] 35 | cin>>n>>m>>a>>b; | ^ | | | long long int* a.cc:35:14: error: cannot bind rvalue '(short int)((long long int*)(& n))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long int*' to 'short unsigned int' [-fpermissive] 35 | cin>>n>>m>>a>>b; | ^ | | | long long int* a.cc:35:14: error: cannot bind rvalue '(short unsigned int)((long long int*)(& n))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long int*' to 'int' [-fpermissive] 35 | cin>>n>>m>>a>>b; | ^ | | | long long int* a.cc:35:14: error: cannot bind rvalue '(int)((long long int*)(& n))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long int*' to 'unsigned int' [-fpermissive] 35 | cin>>n>>m>>a>>b; | ^ | | | long long int* a.cc:35:14: error: cannot bind rvalue '(unsigned int)((long long int*)(& n))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long int*' to 'long int' [-fpermissive] 35 | cin>>n>>m>>a>>b; | ^ | | | long long int* a.cc:35:14: error: cannot bind rvalue '(long int)((long long int*)(& n))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long int*' to 'long unsigned int' [-fpermissive] 35 | cin>>n>>m>>a>>b; | ^ | | | long long int* a.cc:35:14: error: cannot bind rvalue '(long unsigned int)((long long int*)(& n))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive] 35 | cin>>n>>m>>a>>b; | ^ | | | long long int* a.cc:35:14: error: cannot bind rvalue '(long long int)((long long int*)(& n))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long int*' to 'long long unsigned int' [-fpermissive] 35 | cin>>n>>m>>a>>b; | ^ | | | long long int* a.cc:35:14: error: cannot bind rvalue '(long long unsigned int)((long long int*)(& n))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 35 | cin>>n>>m>>a>>b; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'long long int [2000000]' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'long long int [2000000]' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'long long int [2000000]' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'long long int [2000000]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&))
s096188941
p04040
C++
#include <iostream> #include <vector> using namespace std; //combinationを作る前処理 vector<pair<long long, long long> > prime_factorize(long long n) { vector<pair<long long, long long> > res; for (long long p = 2; p * p <= n; ++p) { if (n % p != 0) continue; int num = 0; while (n % p == 0) { ++num; n /= p; } res.push_back(make_pair(p, num)); } if (n != 1) res.push_back(make_pair(n, 1)); return res; } const int MAX = 210000; const int MOD = 1000000007; 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(){ long long int H , W , A , B; cin >> H >> W >> A >> B; COMinit(); long long int ans = 0; for(int i=0;i<W-B;i++){ ans += (com(A+W-B-i,A)*com(H-A-1+B+i,H-A-1))%1000000007 ans %= 1000000007; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:55:60: error: expected ';' before 'ans' 55 | ans += (com(A+W-B-i,A)*com(H-A-1+B+i,H-A-1))%1000000007 | ^ | ; 56 | ans %= 1000000007; | ~~~
s015555335
p04040
C
#include<cstdio> #include<iostream> #define int long long const int mod=1e9+7; const int maxn=1e5+10; int h,w,a,b,ans; int f[maxn<<1]; inline int read(){ char ch=getchar();int x=0,f=1; while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();} while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();} return x*f; } inline int ksm(int x,int y){ x%=mod; int res=1; while(y){ if(y&1) (res*=x)%=mod; (x*=x)%=mod; y>>=1; } return res%mod; } inline int get(int x1,int y1,int x2,int y2){ int n=x2-x1+y2-y1,m=x2-x1; return ( f[n]*ksm( f[m]*f[n-m] , mod-2 ) )%mod; } signed main(){ h=read(),w=read(),a=read(),b=read(); f[0]=f[1]=1; for(register int i=2;i<=(maxn<<1);i++) (f[i]=f[i-1]*i)%=mod; for(register int i=1;i<=h-a;i++){ (ans+=get(1,1,i,b)*get(i,b+1,h,w))%=mod; } std::cout<<ans<<std::endl; return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s531838337
p04040
C++
#include<bits/stdc++.h> using namespace std; //#define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } signed main(){ int a,b,c,d; long long f; cin>>a>>b>>c>>d; vector<vector<int>> e(a,vector<int>(b,0)); fo(i,a){ if(i<a-c) e[i][0]=1; } fo(i,b) e[0][i]=1; for(int i=1;i<a;i++){ for(int j=1;j<b;j++){ if(i<a-c||j>=d){ f=e[i-1][j]+e[i][j-1]; f%=1000000007; e[i][j]=f; } } cout<<e[a-1][b-1]<<endl; }
a.cc: In function 'int main()': a.cc:95:2: error: expected '}' at end of input 95 | } | ^ a.cc:75:14: note: to match this '{' 75 | signed main(){ | ^
s460479882
p04040
C++
/* #include <cstdio> #define ll long long #define mod 1000000007 using namespace std; int h, w, a, b; ll ans; inline ll c(int a, int b) { } int main() { scanf("%d %d %d %d", &h, &w, &a, &b); for (int i = 1; i <= h - a; ++i) ans = (ans + c(b + i - 1, i) * c(h - i + w - b - 1, h - i)) % mod; printf("%lld", ans); 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
s900037255
p04040
C++
#include<bits/stdc++.h> using namespace std; int fact[ MAXH + MAXW ]; int int_pow( int x, int p ){ int res = 1; while( p ){ if( p & 1 ) res = 1LL * res * x % MOD; x = 1LL * x * x % MOD; p >>= 1; } return res; } int mod_inv( int x ){ return int_pow( x, MOD - 2 ); } int get_ways( int h, int w ){ return 1LL * fact[ h + w - 2 ] * mod_inv( fact[ h - 1 ] ) % MOD * mod_inv( fact[ w - 1 ] ) % MOD; } void solve(){ for( int i = fact[ 0 ] = 1; i < MAXH + MAXW; ++i ) fact[ i ] = 1LL * fact[ i - 1 ] * i % MOD; int H, W, A, B; cin >> H >> W >> A >> B; int ans = 0; for( int i = B + 1; i <= W; ++i ) ( ans += 1LL * get_ways( H - A, i ) * get_ways( A, W - i + 1 ) % MOD ) %= MOD; cout << ans << "\n"; } int main() { solve(); }
a.cc:3:11: error: 'MAXH' was not declared in this scope 3 | int fact[ MAXH + MAXW ]; | ^~~~ a.cc:3:18: error: 'MAXW' was not declared in this scope 3 | int fact[ MAXH + MAXW ]; | ^~~~ a.cc: In function 'int int_pow(int, int)': a.cc:8:43: error: 'MOD' was not declared in this scope 8 | if( p & 1 ) res = 1LL * res * x % MOD; | ^~~ a.cc:9:27: error: 'MOD' was not declared in this scope 9 | x = 1LL * x * x % MOD; | ^~~ a.cc: In function 'int mod_inv(int)': a.cc:16:24: error: 'MOD' was not declared in this scope 16 | return int_pow( x, MOD - 2 ); | ^~~ a.cc: In function 'int get_ways(int, int)': a.cc:20:18: error: 'fact' was not declared in this scope 20 | return 1LL * fact[ h + w - 2 ] * mod_inv( fact[ h - 1 ] ) % MOD * mod_inv( fact[ w - 1 ] ) % MOD; | ^~~~ a.cc:20:65: error: 'MOD' was not declared in this scope 20 | return 1LL * fact[ h + w - 2 ] * mod_inv( fact[ h - 1 ] ) % MOD * mod_inv( fact[ w - 1 ] ) % MOD; | ^~~ a.cc: In function 'void solve()': a.cc:24:18: error: 'fact' was not declared in this scope 24 | for( int i = fact[ 0 ] = 1; i < MAXH + MAXW; ++i ) | ^~~~ a.cc:24:37: error: 'MAXH' was not declared in this scope 24 | for( int i = fact[ 0 ] = 1; i < MAXH + MAXW; ++i ) | ^~~~ a.cc:24:44: error: 'MAXW' was not declared in this scope 24 | for( int i = fact[ 0 ] = 1; i < MAXH + MAXW; ++i ) | ^~~~ a.cc:25:47: error: 'MOD' was not declared in this scope 25 | fact[ i ] = 1LL * fact[ i - 1 ] * i % MOD; | ^~~ a.cc:31:74: error: 'MOD' was not declared in this scope 31 | ( ans += 1LL * get_ways( H - A, i ) * get_ways( A, W - i + 1 ) % MOD ) %= MOD; | ^~~
s622463332
p04040
C++
#include <bits/stdc++.h> #define LL long long using namespace std; const int mod = 1000 * 1000 * 1000 + 7; const int MAX = 200001; int mult(int a , int b) { return (a * (LL)b) % mod; } int add(int a , int b) { return a + b < mod ? a + b : a + b - mod; } int sub(int a , int b) { return a - b >= 0 ? a - b : a - b + mod; } int modPow(int a , int step) { int ans = 1; while(step) { if(step & 1) ans = mult(ans , a); step >>= 1; a = mult(a , a); } return ans; } vector<int> fact(MAX) , inv(MAX); int c(int n , int k) { return mult(fact[n] , mult(inv[n - k] , inv[k]); } int ways(int h , int w) { return c(h + w , w); } int main() { int H , W , A , B; cin >> H >> W >> A >> B; fact[0] = inv[0] = 1; for(int i = 1; i < fact.size(); i++) { fact[i] = mult(fact[i - 1] , i); inv[i] = modPow(fact[i] , mod - 2); } int ans = ways(H , W); for(int i = 0; i < B; i++) { ans = sub(ans , mult(ways(H - A , i + 1) , ways(A , W - i))); } cout << ans; return 0; }
a.cc: In function 'int c(int, int)': a.cc:33:56: error: expected ')' before ';' token 33 | return mult(fact[n] , mult(inv[n - k] , inv[k]); | ~ ^ | )
s860356016
p04040
C++
#include <bits/stdc++.h> #define LL long long using namespace std; const int mod = 1000 * 1000 * 1000 + 7; const int MAX = 200001; int mult(int a , int b) { return (a * (LL)b) % mod; } int add(int a , int b) { return a + b < mod ? a + b : a + b - mod; } int sub(int a , int b) { return a - b >= 0 ? a - b : a - b + mod; } int modPow(int a , int step) { int ans = 1; while(step) { if(step & 1) ans = mult(ans , a); step >>= 1; a = mult(a , a); } return ans; } vector<int> fact(MAX) , inv(MAX); int c(int n , int k) { return mult(fact[n] , mult(inv[n - k] , inv[k]); } int ways(int h , int w) { return c(h + w , w); } int main() { int H , W , A , B; cin >> H >> W >> A >> B; fact[0] = inv[0] = 1; for(int i = 1; i < fact.size(); i++) { fact[i] = mult(fact[i - 1] , i); inv[i] = modPow(fact[i] , mod - 2); } int ans = ways(H , W); for(int i = 0; i < B; i++) { ans = sub(ans , mult(ways(H - A , i + 1) , ways(A , N - i))); } cout << ans; return 0; }
a.cc: In function 'int c(int, int)': a.cc:33:56: error: expected ')' before ';' token 33 | return mult(fact[n] , mult(inv[n - k] , inv[k]); | ~ ^ | ) a.cc: In function 'int main()': a.cc:52:69: error: 'N' was not declared in this scope 52 | ans = sub(ans , mult(ways(H - A , i + 1) , ways(A , N - i))); | ^
s730776307
p04040
C++
#include <bits/stdc++.h> #define LL long long using namespace std; const int mod = 1000 * 1000 * 1000 + 7; const int MAX = 200001; int mult(int a , int b) { return (a * (LL)b) % mod; } int add(int a , int b) { return a + b < mod ? a + b : a + b - mod; } int sub(int a , int b) { return a - b >= 0 ? a - b : a - b + mod; } int modPow(int a , int step) { int ans = 1; while(step) { if(step & 1) ans = mult(ans , a); step >>= 1; a = mult(a , a); } return ans; } int c(int n , int k) { return mult(fact[n] , mult(inv[n - k] , inv[k]); } int ways(int h , int w) { return c(h + w , w); } int main() { int H , W , A , B; cin >> H >> W >> A >> B; vector<int> fact(MAX) , inv(MAX); fact[0] = inv[0] = 1; for(int i = 1; i < fact.size(); i++) { fact[i] = mult(fact[i - 1] , i); inv[i] = modPow(fact[i] , mod - 2); } int ans = ways(h , w); for(int i = 0; i < B; i++) { ans = sub(ans , mult(ways(H - A , i + 1) , ways(A , N - i))); } cout << ans; return 0; }
a.cc: In function 'int c(int, int)': a.cc:32:21: error: 'fact' was not declared in this scope 32 | return mult(fact[n] , mult(inv[n - k] , inv[k]); | ^~~~ a.cc:32:36: error: 'inv' was not declared in this scope; did you mean 'int'? 32 | return mult(fact[n] , mult(inv[n - k] , inv[k]); | ^~~ | int a.cc: In function 'int main()': a.cc:49:24: error: 'h' was not declared in this scope 49 | int ans = ways(h , w); | ^ a.cc:49:28: error: 'w' was not declared in this scope 49 | int ans = ways(h , w); | ^ a.cc:52:69: error: 'N' was not declared in this scope 52 | ans = sub(ans , mult(ways(H - A , i + 1) , ways(A , N - i))); | ^
s167179067
p04040
C
#include <bits/stdc++.h> using namespace std; #define countof(a) (sizeof(a)/sizeof(*a)) #define vi vector<int> #define vvi vector<vector<int> > #define vpi vector<pi > #define pi pair<int,int> #define fi first #define se second #define all(n) n.begin(), n.end() #define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++) #define UPTO(var, from, to) for (register int var = (from); var <= ((int)to); var++) #define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--) #define FOR(var, to) UPTO(var, 0, (to)-1) #define DOWN(var, from) DOWNTO(var, (from)-1, 0) #define INIT(var, val) FOR(i,countof(var)) var[i] = val #define INPUT(var) FOR(i,countof(var)) cin >> var[i] #define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]-- #define SORT(v) qsort(v,countof(v),sizeof(*v),int_less) #define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater) #define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b) #define MOD 1000000007 #define INF ((1 << 30)-1) #define LINF ((1LL << 62)-1) typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; typedef int8_t s8; typedef int16_t s16; typedef int32_t s32; typedef int64_t s64; /* ------------------------ */ /* BEGIN EXTERNAL LIBRARIES */ /* ------------------------ */ template<int mod> struct ModInt{ int x; ModInt():x(0){} ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){} ModInt &operator+=(const ModInt &p){ if((x+=p.x)>=mod)x-=mod; return *this; } ModInt &operator-=(const ModInt &p){ if((x+=mod-p.x)>=mod)x-=mod; return *this; } ModInt &operator*=(const ModInt &p){ x=(int)(1LL*x*p.x%mod); return *this; } ModInt &operator/=(const ModInt &p){ *this*=p.inverse(); return *this; } ModInt operator-()const{return ModInt(-x);} ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;} ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;} ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;} ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;} bool operator==(const ModInt &p)const{return x==p.x;} bool operator!=(const ModInt &p)const{return x!=p.x;} operator int() const { return x; } // added by QCFium ModInt operator=(const int p) {x = p; return ModInt(*this);} // added by QCFium ModInt inverse()const{ int a=x,b=mod,u=1,v=0,t; while(b>0){ t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } return ModInt(u); } friend ostream &operator<<(ostream &os,const ModInt<mod> &p){ return os<<p.x; } friend istream &operator>>(istream &is,ModInt<mod> &a){ long long x; is>>x; a=ModInt<mod>(x); return (is); } }; typedef ModInt<MOD> mint; struct UnionFind{ vi data; UnionFind(int size):data(size,-1){} bool unite(int x,int y) { x=root(x);y=root(y); if(x!=y){ if(data[y]<data[x])swap(x,y); data[x]+=data[y];data[y]=x; } return x!=y; } bool find(int x,int y) { return root(x)==root(y); } int root(int x) { return data[x]<0?x:data[x]=root(data[x]); } int size(int x) { return -data[root(x)]; } // added by QCFium bool united() { int comroot = -1; FOR(i,data.size()) { if (comroot != -1 && root(i) != comroot) return false; comroot = root(i); } return true; } }; /* ---------------------- */ /* END EXTERNAL LIBRARIES */ /* ---------------------- */ int mpow(s64 num, s64 times) { // O(log(times)) mint next = num%MOD; mint res = 1; while (times) { if (times%2) res *= next; next *= next; times /= 2; } return res; } struct Comb { vector<vector<s64> > data; Comb(int n) { // O(n^2) data = vector<vector<s64> >(n+1,vector<s64>(n+1,1)); UPTO(i,1,n) { FOR(j,i+1) { if (!j || j == i) data[i][j] = 1; else data[i][j] = data[i-1][j-1] + data[i-1][j]; } } } s64 ncr(int n, int r) { return data[n][r]; } }; struct MComb { vector<mint> fact; vector<mint> inversed; MComb(int n) { // O(n+log(mod)) fact = vector<mint>(n+1,1); UPTO(i,1,n) fact[i] = fact[i-1]*mint(i); inversed = vector<mint>(n+1); inversed[n] = mpow(fact[n], MOD-2); DOWN(i,n) inversed[i]=inversed[i+1]*mint(i+1); } int ncr(int n, int r) { return fact[n] * inversed[r] * inversed[n-r]; } int npr(int n, int r) { return fact[n] * inversed[n-r]; } int nhr(int n, int r) { assert(n+r-1 < (int)fact.size()); return ncr(n+r-1, r); } }; template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> set<Key> operator+(const set<Key>& a, const set<Key>& b) { set<Key> c = a; for (auto i : b) c.insert(i); return c; } template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> set<Key> operator+=(set<Key>& a, const set<Key>& b) { for (auto& i : b) a.insert(i); return a; } template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> set<Key> operator*(const set<Key>& a, const set<Key>& b) { set<Key> c; for (auto& i : a) if (b.count(i)) c.insert(i); return c; } template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> set<Key> operator*=(set<Key>& a, const set<Key>& b) { set<Key> c; for (auto& i : a) if (b.count(i)) c.insert(i); return a = c; } template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> set<Key> operator-(const set<Key>& a, const set<Key>& b) { set<Key> c; for (auto& i : a) if (!b.count(i)) c.insert(i); return c; } template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> set<Key> operator-=(set<Key>& a, const set<Key>& b) { set<Key> c; for (auto& i : a) if (!b.count(i)) c.insert(i); return a = c; } static inline int ri() { int a; scanf("%d", &a); return a; } int int_less(const void *a, const void *b) { return (*((const int*)a) - *((const int*)b)); } int int_greater(const void *a, const void *b) { return (*((const int*)b) - *((const int*)a)); } int main() { int h = ri(); int w = ri(); int a = ri(); int b = ri(); MComb* com = new MComb(200001); assert(com); mint r0[w-b]; UPTO(i,b,w-1) { r0[i-b] = com->ncr(h-a-1 + i, i); } mint res = 0; UPTO(i,b,w-1) { res += r0[i-b]*(mint)com->ncr(a-1 + w-i-1, w-i-1); } cout << res << endl; return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s441798791
p04040
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; long long fact[1000000]; long long fact_in[1000000]; //出力 void Yes(){ cout << "Yes" << endl; } void yes(){ cout << "yes" << endl; } void No(){ cout << "No" << endl; } void no(){ cout << "no" << endl; } void Possible(){ cout << "Possible" << endl; } void possible(){ cout << "possible" << endl; } void Imossible(){ cout << "Impossible" << endl; } void imossible(){ cout << "impossible" << endl; } //マクロ #define INF 10010010010010010 #define chmin(a, b) a = min(a, b) #define chmax(a, b) a = max(a, b) #define sort(a) sort(a.begin(), a.end()) #define reverse(a) reverse(a.begin(), a.end()) long long const MOD = 1000000007; // 階乗 (mod とりバージョン) ll fact_mod(ll n, ll mod) { ll f = 1; for(long long i = 2; i <= n; i++) f = f * (i % MOD) % MOD; return f; } // 繰り返し二乗法 (modの世界での累乗) // ※modが素数の場合、この関数で(mod - 2)乗したら、mod割り算ができるよ! // (参考問題: ABC034 C問題など) ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while(n > 0) { if(n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき) x = (x * x) % mod; n >>= 1; //右シフト(n = n >> 1) } return res; } // 組み合わせ nCr を求める (modあり) ll combination_mod(ll n, ll r, ll mod) { if(r > n-r) r = n-r; long long res = (((fact[n] % mod) * (fact_in[r] % mod)) % MOD) * (fact_in[n - r] % mod)) % mod; /* if(r == 0) return 1; ll a = 1; for(long long i = 0; i < r; i++) a = a * ((n-i) % mod) % mod; ll b = mod_pow(fact_mod(r, mod), mod-2, mod); return (a % mod) * (b % mod) % mod; */ return res; } int main(){ fact[0] = 1; for(long long i = 1; i < 1000000; i++){ fact[i] = ((fact[i - 1] % MOD) * (i % MOD)) % MOD; } for(ll i = 0; i < 1000000; i++){ fact_in[i] = mod_pow(fact[i], MOD - 2, MOD) % MOD; } long long ans = 0; long long h, w, a, b; cin >> h >> w >> a >> b; a = h - a; for(ll j = b + 1; j <= w; j++){ ans += (combination_mod(a + j - 2, j - 1, MOD) % MOD) * (combination_mod(w - j + h - a - 1, w - j, MOD) % MOD); ans %= MOD; //cout << a + j - 2 << " " << j - 1 << " " << w - j + h - a - 1 << " " << w - j << endl; //cout << j << " " << ans << endl; } cout << ans << endl; }
a.cc: In function 'll combination_mod(ll, ll, ll)': a.cc:50:92: error: expected ',' or ';' before ')' token 50 | long long res = (((fact[n] % mod) * (fact_in[r] % mod)) % MOD) * (fact_in[n - r] % mod)) % mod; | ^
s597960564
p04040
C++
/** * * AtCoder Regular Contest 058 - Problem D: Iroha and the Grid * * Count the number of ways Iroha can travel from (1,1) to (H, W) in a H x W grid with bottom A * rows and leftmost B columns blocked. * * Combinatorial solution: compute the number of ways that we can move from O = (1, 1) to * Pk = (k, B) and multiply for the number of ways from Qk = (k, B + 1) to (H, W), * for k = 1, 2, ..., H - A. * * ----------------------------------- * |O | | * | | | * | Pk|Qk | * | | | * | | | * | | | * ----------------------------------- * |xxxxxxxxxxxxxxxxxxxx| | * |xxxxxxxxxxxxxxxxxxxx| | * |xxxxxxxxxxxxxxxxxxxx| | * |xxxxxxxxxxxxxxxxxxxx| D| * ----------------------------------- * * shape(X, Y) = dimensions of the rectangle with upper left corner A and lower right corner B * * shape(O, Pk) = (k, B) * shape(Qk, D) = (H - k + 1, W - B) * * The number of ways we can travel from (1, 1) to (N, M) in a rectangular grid moving right or * down only is C(M + N - 2, M - 1) = C(M + N - 2, N - 1), because we must walk (M - 1) steps to * right and * (N - 1) steps down, and we must choose when move forward ou move down. */ #include <iostream> using namespace std; using ll = long long; const int MAX { 200010 }; const ll MOD { 1000000007 }; ll fact[MAX], inv[MAX]; ll fast_exp(ll a, ll n) { ll res = 1, base = a; while (n) { if (n & 1) { res *= base; res %= MOD; } base *= base; base %= MOD; n >>= 1; } return res; } ll binom(int n, int m) { ll res = (fact[n] * inv[m]) % MOD; res = (res * inv[n - m]) % MOD; return res; } void precomp() { fact[0] = inv[0] = 1; for (int n = 1; n < MAX; ++n) fact[n] = (n * fact[n - 1]) % MOD; // Fermat Theorem to compute inverse mod p for (int n = 1; n < MAX; ++n) inv[n] = fast_exp(fact[n], MOD - 2); } // Ways we can move from (1, 1) to (h, w) ll ways(int h, int w) { return binom(h + w - 2, h - 1); } int main() { ios::sync_with_stdio(false); precomp(); int H, W, A, B; cin >> H >> W >> A >> B; ll total = 0; for (int k = 1; k <= H - A; ++h) { total += (ways(k, B) * ways(H - k + 1, W - B)) % MOD; total %= MOD; } cout << total << endl; return 0; }
a.cc: In function 'int main()': a.cc:103:35: error: 'h' was not declared in this scope 103 | for (int k = 1; k <= H - A; ++h) | ^
s030431275
p04040
C++
include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> #include <string> #include <algorithm> #include <stack> #include <queue> #include <set> #include <map> using namespace std; #define MOD 10000000007 #define ADD(X,Y) ((X)=((X)+(Y)%MOD)%MOD) typedef long long i64;typedef vector<int> svec; i64 modpow(i64 a,i64 p=MOD-2) { if(p==0) return 1; i64 tmp=(a,p/2); tmp=tmp*tmp%MOD; if(p%2==1) tmp=tmp*a%MOD; return tmp; } int H,W,A,B; i64 fact[202020],frev[202020]; i64 C(int p,int q) { if(q<0||p<q) return 0; return fact[p]*frev[q]%MOD*frev[p-q]%MOD; } i64 pat(int p,int q){return C(p+q-2,q-1);} int main() { scanf("%d%d%d",&H,&W,&A,&B); fact[0]=frev[0]=1; for(int i=1;i<=200000;++i) {fact[i]=(fact[i-1]*i)%MOD; frev[i]=modpow(fact[i]); } i64 ret=0; for(int i=0;i<H-A;++i) { ADD(ret,pat(i+1,B)*pat(H-i,B)%MOD); } printf("%11d\n",ret); return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <cstdio> | ^~~~~~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:4: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/stdlib.h:32, from /usr/include/c++/14/cstdlib:79, from a.cc:2: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 179 | _GLIBCXX_NODISCARD inline void* operator
s311171060
p04040
C++
#include"stdafx.h" #include<iostream> #include<algorithm> #include<functional> #include <string> #include<iomanip> #include<cstdio> #include<math.h> #include<stack> #include<queue> #include<cstring> #include<vector> #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define EREP(i,n) for(int i=(n-1);i>=0;--i) #define D(n,retu) REP(i,n){cin>>retu[i];} #define mod 1000000007 #define MIN -93193111451418101 #define INF 931931114518101 using namespace std; typedef long long int ll; template<typename T> void fill_all(T& arr, const T& v) { arr = v; } template<typename T, typename ARR> void fill_all(ARR& arr, const T& v) { for (auto& i : arr) { fill_all(i, v); } } #define MAX_NUM 50 long long comb[MAX_NUM + 1][MAX_NUM + 1]; ll par[100000], depth[100000]; static void calc_comb() { for (uint32_t i = 0; i <= MAX_NUM; i++) { for (uint32_t j = 0; j <= i; j++) { if ((j == 0) || (i == j)) { comb[i][j] = 1; } else { comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j]; } } } } //------------------変数-----------------------// ll h, w, a, b; //-------------------関数----------------------// ll yojou(ll a, ll b, ll p) {//aのb乗をpで割ったあまりを計算する関数 if (b == 0) { return 1; }//0乗は1 if (b % 2 == 0) {//2の倍数なら省略できて ll d = yojou(a, b / 2, p);//わるう return (d*d) % p;//2割ったので二乗う } return a*yojou(a, b - 1, p) % p;//2で割れないなら一個進める } ll combinationwithmod(ll h, ll w) {//h,wは点の数ではなく辺の数です ll cnt = 1; if (w < h) { swap(w, h); } for (int i = w + 1; i <= w + h; i++) { cnt = cnt * i%mod; } for (int i = 1; i <= h; i++) { cnt = cnt*yojou(i, mod - 2, mod) % mod; }return cnt; } bool in(ll y,ll x) { if (x > w || y > h) { return false; } else { return true; } } int main() { cin >> h >> w >> a >> b; h--; w--; a--; b--; ll cnt = 0; if (a) { for (ll i = b; i <= w; i++) { cnt+=combinationwithmod(h - a, i)*combinationwithmod(a-1,w-i); cnt %= mod; } } cout << cnt%mod << endl; return 0; }
a.cc:1:9: fatal error: stdafx.h: No such file or directory 1 | #include"stdafx.h" | ^~~~~~~~~~ compilation terminated.
s493644997
p04040
C++
//code by 27. #include<stdio.h> #include<cstdio> #include<iostream> #include<algorithm> #include<string> #include<math.h> #include<vector> #include<queue> #include<map> #include<stack> #include<fstream> #include<stdlib.h> #include<set> #include<cassert> #include<climits> #include<cmath> #include<memory.h> #include<conio.h> #include<windows.h> #include<ctime> using namespace std; long long ypa(long long n,long long k)//a^ { //cout<<"3"; if(k==1)return n; if(k==0)return 1; unsigned long long t=ypa(n,k/3); if(k%3==0)return t*t%1000000007*t%1000000007; else if(k%3==1)return t*t%1000000007*t%1000000007*n%1000000007; else if(k%3==2)return t*t%1000000007*t%1000000007*n%1000000007*n%1000000007; } long long c(long long a,long long b) { //cout<<"2"<<endl; a=min(a,b-a); if(a==0)return 1; long long s1=1,s2=1; for(int i=1;i<=a;i++) { s1*=i; s1=s1%1000000007; s2*=i+b-a; s2=s2%1000000007; } return s2*ypa(s1,1000000005)%1000000007; } int main() { long long n,m,a,b; cin>>n>>m>>a>>b; long long s=0; long long s1=c(n-a-1,n-a+b-2); long long s2=c(a-1,m+a-b-1); for(long long i=b+1;i<=m;i++) { s1=s1*(n-a+i-2)/(n-a+i-3-(n-a-1)+1); //cout<<"s1:"<<s1<<"*"<<n-a+i-2<<"/"<<n-a+i-3-(n-a-1)+1<<endl; //cout<<"s2:"<<s2<<"*"<<m+a-i-(a-1)<<"/"<<m+a-i<<endl; s2=s2*(m+a-i-(a-1))/(m+a-i); s1=s1%100000007; s2=s2%100000007; s+=s1*s2; s=s%1000000007; } cout<<s; return 0; }
a.cc:19:9: fatal error: conio.h: No such file or directory 19 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s096177015
p04040
C++
#define SIZE 200005 #define MOD 1000000007 using namespace std; typedef long long int ll; typedef pair <int,int> P; ll inv[SIZE],fac[SIZE],finv[SIZE]; void make() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<SIZE;i++) { inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; fac[i]=fac[i-1]*(ll) i%MOD; finv[i]=finv[i-1]*inv[i]%MOD; } } ll C(int a,int b) { if(a<b) return 0; return fac[a]*(finv[b]*finv[a-b]%MOD)%MOD; } int main() { make(); int W,H,A,B; scanf("%d %d %d %d",&H,&W,&A,&B);W--,H--; ll ret=C(W+H,W); for(int i=0;i<B;i++) { ll all=C((H-A)+i,i); ll all2=C((W-i)+(A-1),A-1); ret-=all*all2%MOD; if(ret<0) ret+=MOD; } printf("%lld\n",ret); return 0; }
a.cc:6:9: error: 'pair' does not name a type 6 | typedef pair <int,int> P; | ^~~~ a.cc: In function 'int main()': a.cc:30:9: error: 'scanf' was not declared in this scope 30 | scanf("%d %d %d %d",&H,&W,&A,&B);W--,H--; | ^~~~~ a.cc:39:9: error: 'printf' was not declared in this scope 39 | printf("%lld\n",ret); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #define SIZE 200005
s892956939
p04040
C++
#include <iostream> #include <iomanip> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <algorithm> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <functional> #include <utility> #define INF 0x3f3f3f3f #define MOD 1000000007 #define PI 4*atan(1.0) typedef long long ll; typedef long double ld; using namespace std; int dx[4]={0,0,-1,1}; int dy[4]={-1,1,0,0}; int calc(long long int a,long long int b,long long int p){ if(!b) return 1; else if(!(b%2)){ long long int d=calc(a,b/2,p); return (d*d)%p; }else return (a*calc(a,b-1,p))%p; } const int MAX=100001; int main(){ int H,W,A,B; ll ans=0; cin>>H>>W>>A>>B; ll inv[MAX]={}; ll uniteA[MAX]={},uniteB[MAX]={}; for(int i=1;i<MAX;i++){ inv[i]=calc(i,MOD-2,MOD); } for(int i=B;i<=W-1;i++){ ll temp=1; for(int j=1;j<=i+H-A-1;j++) temp=temp*j%MOD; for(int j=1;j<=H-A-1;j++) temp=temp*inv[j]%MOD; for(int j=1;j<=i;j++) temp=temp*inv[j]%MOD; uniteA[W-i-1]=temp; if(uniteA[W-i-1]) //printf("uniteA[%d]=%d\n",W-i-1,uniteA[W-1-i]); } for(int i=W-B-1;i>=0;i--){ ll temp=1; for(int j=1;j<=i+A-1;j++) temp=temp*j%MOD; for(int j=1;j<=A-1;j++) temp=temp*inv[j]%MOD; for(int j=1;j<=i;j++) temp=temp*inv[j]%MOD; uniteB[i]=temp; if(uniteB[i]) //printf("uniteB[%d]=%d\n",i,uniteB[i]); } for(int i=0;i<MAX;i++) ans=(ans+(uniteA[i]*uniteB[i])%MOD)%MOD; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:54:9: error: expected primary-expression before '}' token 54 | } | ^ a.cc:66:9: error: expected primary-expression before '}' token 66 | } | ^
s428982606
p04040
C++
#include <iostream> #include <string.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define ull unsigned ll #define db double #define INF 0x3f3f3f3f #define MOD 1000000007 #define PII pair<int, int> int h,w,a,b; ll f[100010]; ll finv[100010]; ll c(ll n,ll m) { ll ret=f[n]; ret=(ret*finv[n-m])%MOD; ret=(ret*finv[m])%MOD; return ret; } ll calc(ll i,ll j) { return c(i+j-2,i-1); } ll qp(ll x,ll n) { ll ret=1; while (n) { if (n&1) ret=(ret*x)%MOD; n=n>>1; x=(x*x)%MOD; } return ret; } int main() { scanf("%d%d%d%d",&h,&w,&a,&b); memset(f,0,sizeof(f)); memset(finv,0,sizeof(finv)); f[0]=invf[0]=1; for (int i=1;i<=100000;i++) { f[i]=(f[i-1]*i)%MOD; finv[i]=qp(f[i],MOD-2); } ll ans=0; for (int i=1;i<=w-b;i++) { ans=(ans+(calc(a,i)*calc(h-a,w-i+1))%MOD)%MOD; } printf("%lld\n",ans); }
a.cc: In function 'int main()': a.cc:45:10: error: 'invf' was not declared in this scope 45 | f[0]=invf[0]=1; | ^~~~
s555771810
p04040
C++
#include<iostream> #include<vector> #include<algorithm> #include<numeric> #include<iomanip> #include<boost/multi_array.hpp> typedef unsigned long long uint64; typedef long long int64; template<uint64 Mod>class mod_t { uint64 val; public: mod_t(uint64_t v) :val(v%Mod) { } mod_t(int64 v) :val(v%Mod) { } mod_t(int v = 0) : val(v%Mod) { } mod_t(unsigned v) :val(v%Mod) { } uint64 operator*()const { return val; } }; template<uint64 Mod>mod_t<Mod> operator+(mod_t<Mod> lhs, mod_t<Mod> rhs) { return (*lhs + *rhs); } template<uint64 Mod>mod_t<Mod> operator+(mod_t<Mod> lhs, int rhs) { return (*lhs + rhs); } template<uint64 Mod>mod_t<Mod> operator+(int lhs, mod_t<Mod> rhs) { return (lhs + *rhs); } template<uint64 Mod>mod_t<Mod> operator-(mod_t<Mod> lhs, mod_t<Mod> rhs) { return (*lhs - *rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator-(mod_t<Mod> lhs, int rhs) { return (*lhs - rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator-(int lhs, mod_t<Mod> rhs) { return (lhs - *rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator*(mod_t<Mod> lhs, mod_t<Mod> rhs) { return (*lhs * *rhs); } template<uint64 Mod>mod_t<Mod> operator*(mod_t<Mod> lhs, int rhs) { return (*lhs * rhs); } template<uint64 Mod>mod_t<Mod> operator*(int lhs, mod_t<Mod> rhs) { return (lhs * *rhs); } typedef mod_t<1000000007> mod197; void Main(); int main() { std::cin.sync_with_stdio(false); std::cout << std::setprecision(std::numeric_limits<long double>::digits10 + 1); Main(); } void Main() { int H, W, A, B; std::cin >> H >> W >> A >> B; auto max = std::max(W + H - A, W + H - B); boost::multi_array<mod197, 2> C(boost::extents[max + 1][max + 1]); for (int i{};i <= max;++i) { C[i][0] = 1; C[i][i] = 1; } for (int i = 1;i <= max;++i) { for (int j = 1;j < i;++j) { C[i][j] = C[i - 1][j - 1] + C[i - 1][j]; } } mod197 ret; for (int k = B + 1;k <= W;++k) { ret = ret + C[k + H - A - 2][k - 1] * C[A + W - k - 1][A - 1]; } std::cout << *ret << std::endl; }
a.cc:6:9: fatal error: boost/multi_array.hpp: No such file or directory 6 | #include<boost/multi_array.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s919551064
p04040
C++
#include<iostream> #include<vector> #include<algorithm> #include<numeric> #include<iomanip> #include<boost/multi_array.hpp> typedef unsigned long long uint64; typedef long long int64; template<uint64 Mod>class mod_t { uint64 val; public: explicit mod_t(uint64_t v) :val(v%Mod) { } explicit mod_t(int64 v) :val(v%Mod) { } mod_t(int v = 0) : val(v%Mod) { } explicit mod_t(unsigned v) :val(v%Mod) { } uint64 operator*()const { return val; } }; template<uint64 Mod>mod_t<Mod> operator+(mod_t<Mod> lhs, mod_t<Mod> rhs) { return mod_t<Mod>(*lhs + *rhs); } template<uint64 Mod>mod_t<Mod> operator+(mod_t<Mod> lhs, int rhs) { return mod_t<Mod>(*lhs + rhs); } template<uint64 Mod>mod_t<Mod> operator+(int lhs, mod_t<Mod> rhs) { return mod_t<Mod>(lhs + *rhs); } template<uint64 Mod>mod_t<Mod> operator-(mod_t<Mod> lhs, mod_t<Mod> rhs) { return mod_t<Mod>(*lhs - *rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator-(mod_t<Mod> lhs, int rhs) { return mod_t<Mod>(*lhs - rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator-(int lhs, mod_t<Mod> rhs) { return mod_t<Mod>(lhs - *rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator*(mod_t<Mod> lhs, mod_t<Mod> rhs) { return mod_t<Mod>(*lhs * *rhs); } template<uint64 Mod>mod_t<Mod> operator*(mod_t<Mod> lhs, int rhs) { return mod_t<Mod>(*lhs * rhs); } template<uint64 Mod>mod_t<Mod> operator*(int lhs, mod_t<Mod> rhs) { return mod_t<Mod>(lhs * *rhs); } typedef mod_t<1000000007> mod197; void Main(); int main() { std::cin.sync_with_stdio(false); std::cout << std::setprecision(std::numeric_limits<long double>::digits10 + 1); Main(); } void Main() { int H, W, A, B; std::cin >> H >> W >> A >> B; auto max = std::max(W + H - A, W + H - B); boost::multi_array<mod197, 2> C(boost::extents[max + 1][max + 1]); for (int i{};i <= max;++i) { C[i][0] = 1; C[i][i] = 1; } for (int i = 1;i <= max;++i) { for (int j = 1;j < i;++j) { C[i][j] = C[i - 1][j - 1] + C[i - 1][j]; } } mod197 ret; for (int k = B + 1;k <= W;++k) { ret = ret + C[k + H - A - 2][k - 1] * C[A + W - k - 1][A - 1]; } std::cout << *ret << std::endl; }
a.cc:6:9: fatal error: boost/multi_array.hpp: No such file or directory 6 | #include<boost/multi_array.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s795197737
p04040
C++
#include<iostream> #include<vector> #include<algorithm> #include<numeric> #include<iomanip> #include<boost/multi_array.hpp> typedef unsigned long long uint64; typedef long long int64; template<uint64 Mod>class mod_t { uint64 val; public: mod_t(uint64_t v) :val(v%Mod) { } mod_t(int64 v) :val(v%Mod) { } mod_t(int v = 0) : val(v%Mod) { } mod_t(unsigned v) :val(v%Mod) { } uint64 operator*()const { return val; } }; template<uint64 Mod>mod_t<Mod> operator+(mod_t<Mod> lhs, mod_t<Mod> rhs) { return mod_t<Mod>(*lhs + *rhs); } template<uint64 Mod>mod_t<Mod> operator+(mod_t<Mod> lhs, int rhs) { return mod_t<Mod>(*lhs + rhs); } template<uint64 Mod>mod_t<Mod> operator+(int lhs, mod_t<Mod> rhs) { return mod_t<Mod>(lhs + *rhs); } template<uint64 Mod>mod_t<Mod> operator-(mod_t<Mod> lhs, mod_t<Mod> rhs) { return mod_t<Mod>(*lhs - *rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator-(mod_t<Mod> lhs, int rhs) { return mod_t<Mod>(*lhs - rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator-(int lhs, mod_t<Mod> rhs) { return mod_t<Mod>(lhs - *rhs + Mod); } template<uint64 Mod>mod_t<Mod> operator*(mod_t<Mod> lhs, mod_t<Mod> rhs) { return mod_t<Mod>(*lhs * *rhs); } template<uint64 Mod>mod_t<Mod> operator*(mod_t<Mod> lhs, int rhs) { return mod_t<Mod>(*lhs * rhs); } template<uint64 Mod>mod_t<Mod> operator*(int lhs, mod_t<Mod> rhs) { return mod_t<Mod>(lhs * *rhs); } typedef mod_t<1000000007> mod197; void Main(); int main() { std::cin.sync_with_stdio(false); std::cout << std::setprecision(std::numeric_limits<long double>::digits10 + 1); Main(); } void Main() { int H, W, A, B; std::cin >> H >> W >> A >> B; auto max = std::max(W + H - A, W + H - B); boost::multi_array<mod197, 2> C(boost::extents[max + 1][max + 1]); for (int i{};i <= max;++i) { C[i][0] = 1; C[i][i] = 1; } for (int i = 1;i <= max;++i) { for (int j = 1;j < i;++j) { C[i][j] = C[i - 1][j - 1] + C[i - 1][j]; } } mod197 ret; for (int k = B + 1;k <= W;++k) { ret = ret + C[k + H - A - 2][k - 1] * C[A + W - k - 1][A - 1]; } std::cout << *ret << std::endl; }
a.cc:6:9: fatal error: boost/multi_array.hpp: No such file or directory 6 | #include<boost/multi_array.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s527486724
p04040
C++
#include<iostream> #include<iomanip> #include<map> #include<set> #include<vector> #include<string> #include<stack> #include<array> #include<queue> #include<algorithm> #include<cassert> #include<functional> #include<numeric> #include<random> #define int int64_t #define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++) #define rep(i, a) REP(i, 0, a) #define EACH(i, a) for (auto i: a) #define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++) #define ALL(a) (a.begin()), (a.end()) #define HAS(a, x) (a.find(x) != a.end()) using namespace std; //MODが素数であることを前提として実装してあるが、その判定はしていない。 //あまりが出るような除算をしてはいけない。 template<int MOD = 1000000007>class modint { public: modint() { this->number = 0; } modint(int src) { this->number = src; } modint<MOD> operator + (modint<MOD> obj) { modint re((this->number + obj.number) % MOD); return re; } modint<MOD> operator + (int n) { modint re((this->number + opposit(n)) % MOD); return re; } modint<MOD>& operator += (modint<MOD>& obj) { this->number = (this->number + obj.number) % MOD; return *this; } modint<MOD>& operator += (int n) { this->number = (this->number + opposit(n)) % MOD; return *this; } modint<MOD> operator - (modint<MOD> obj) { modint re((this->number - obj.number + MOD) % MOD); return re; } modint<MOD> operator - (int n) { modint re((this->number - opposit(n) + MOD) % MOD); return re; } modint<MOD>& operator -= (modint<MOD>& obj) { this->number = (this->number - obj.number + MOD) % MOD; return *this; } modint<MOD>& operator -= (int n) { this->number = (this->number - opposit(n) + MOD) % MOD; return *this; } modint<MOD> operator * (modint<MOD> obj) { modint re((this->number * obj.number) % MOD); return re; } modint<MOD> operator * (int n) { modint re((this->number * opposit(n)) % MOD); return re; } modint<MOD>& operator *= (modint<MOD>& obj) { this->number = (this->number * obj.number) % MOD; return *this; } modint<MOD>& operator *= (int n) { this->number = (this->number * opposit(n)) % MOD; return *this; } modint<MOD> operator / (modint<MOD> obj) { modint re((this->number * inverse(obj.number)) % MOD); return re; } modint<MOD> operator / (int n) { modint re((this->number * inverse(n)) % MOD); return re; } modint<MOD>& operator /= (modint<MOD>& obj) { this->number = (this->number * inverse(obj.number)) % MOD; return *this; } modint<MOD>& operator /= (int n) { this->number = (this->number * inverse(n)) % MOD; return *this; } modint operator = (int n) { this->number = opposit(n) % MOD; return *this; } int get() { return number; } private: int number; int opposit(int n) { if (n < 0)n = MOD - ((-n) % MOD); return n % MOD; } int inverse(int n) { n = opposit(n); int result = 1; for (int i = MOD - 2; i; i /= 2) { if (i % 2)result = (result * n) % MOD; n = (n * n) % MOD; } return result; } }; signed main() { cin.tie(0); ios::sync_with_stdio(false); int H, W, A, B; cin >> H >> W >> A >> B; vector<modint<>>facto(H + W + 1); facto[0] = 1; REP(i, 1, facto.size())facto[i] = facto[i - 1] * i; int edgeh = H - A - 1; int edgew = B; modint<> result(0); while (0 <= edgeh && edgew < W) { //初期位置からedgeまでのパターン modint<>ans1 = facto[edgeh + edgew] / (facto[edgeh] * facto[edgew]); //edgeからゴールまでのパターン int eh2 = H - edgeh - 1; int ew2 = W - edgew - 1; modint<>ans2 = facto[eh2 + ew2] / (facto[eh2] * facto[ew2]); result += (ans1 * ans2); edgeh--; edgew++; } cout << result.get() << endl; }
a.cc: In function 'int main()': a.cc:151:33: error: cannot bind non-const lvalue reference of type 'modint<>&' to an rvalue of type 'modint<>' 151 | result += (ans1 * ans2); | ~~~~~~^~~~~~~ a.cc:42:48: note: initializing argument 1 of 'modint<MOD>& modint<MOD>::operator+=(modint<MOD>&) [with long int MOD = 1000000007]' 42 | modint<MOD>& operator += (modint<MOD>& obj) { | ~~~~~~~~~~~~~^~~
s790619251
p04040
C++
#include <iostream> using namespace std; #define MAX_H 100000 #define MAX_W 100000 #define MOD 1000000007 bool visited[MAX_H][MAX_W]; int memo[MAX_H][MAX_W]; int h,w,a,b,top; int solve(int y,int x){ if(x < b && top <= y) return 0; if(x == 0 || y == 0) return 1; if(visited[y][x]) return memo[y][x]; visited[y][x] = true; return memo[y][x] = (solve(y-1,x) + solve(y,x-1)) % MOD; } int main(){ cin >> h >> w >> a >> b; top = h - a; cout << solve(h-1,w-1) << endl; return 0; }
/tmp/cchIJVN7.o: in function `solve(int, int)': a.cc:(.text+0x11): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x8b): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x125): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x14c): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cchIJVN7.o /tmp/cchIJVN7.o: in function `main': a.cc:(.text+0x160): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x17c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x191): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x1b7): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/cchIJVN7.o a.cc:(.text+0x1bd): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s811378529
p04040
C++
//ここからテンプレート //#define PLASMA_NO_BOOST #if 1 #include<iostream> #include<list> #include<algorithm> #include<utility> #include<type_traits> #include<tuple> #include<memory> #include<iterator> #include<string> #include<functional> #include<list> #include<array> #include<complex> #include<numeric> #include<iomanip> #include<vector> #include<queue> #include<random> #include<map> #include<chrono> #include<stack> #include<set> #ifndef PLASMA_NO_BOOST #include<boost/optional.hpp> #include<boost/optional/optional_io.hpp> #include<boost/variant.hpp> #include<boost/range/adaptor/transformed.hpp> #include<boost/range/adaptor/indexed.hpp> #include<boost/range/adaptor/filtered.hpp> #include<boost/range/algorithm.hpp> #include<boost/range/irange.hpp> #include<boost/multi_array.hpp> #include<boost/preprocessor.hpp> #endif typedef long long int int64; typedef unsigned long long uint64; typedef long double double64; #ifdef PLASMA_NO_BOOST struct none_t {}; constexpr none_t none{}; template<class T>class optional { union inside_t { T value; none_t ignore; constexpr inside_t(T const& v) :value(v) {} constexpr inside_t(T&& v) : value(std::move(v)) {} constexpr inside_t(none_t) : ignore(none) {} constexpr inside_t() : ignore(none) {} constexpr inside_t(inside_t const&) = default; inside_t(inside_t&&) = default; inside_t& operator=(inside_t const&) = default; inside_t& operator=(inside_t&&) = default; ~inside_t() = default; }; inside_t inside; bool flag; public: void swap(optional&& v) { std::swap(this->inside, v.inside); std::swap(this->flag, v.flag); } void reset() { if (flag) { inside.value.~T(); inside.ignore = none; flag = false; } } constexpr optional(T const& v) :inside(v), flag(true) {} constexpr optional(T&& v) : inside(std::move(v)), flag(true) {} constexpr optional(none_t) : inside(), flag(false) {} constexpr optional() : inside(), flag(false) {} constexpr optional(optional const& v) : inside(v.inside), flag(v.flag) {} optional(optional&& v) : optional() { swap(std::move(v)); } optional& operator=(optional const& v) { this->inside = v.inside; this->flag = v.flag; return *this; } optional& operator=(optional&& v) { swap(std::move(v)); v.reset(); return *this; } optional& operator=(T const& v) { reset(); inside.value = v; flag = true; return *this; } optional& operator=(T&& v) { reset(); inside.value = std::move(v); flag = true; return *this; } optional& operator=(none_t) { reset(); return *this; } constexpr operator bool()const { return flag; } constexpr T const& operator*()const { return flag ? inside.value : throw std::domain_error("optional error: dont have value"); } }; template<class T>constexpr optional<typename std::remove_reference<typename std::remove_const<T>::type>::type>make_optional(T&& v) { return optional<std::remove_reference_t<std::remove_const_t<T>>>(std::forward<T>(v)); } #else using boost::optional; using boost::none_t; using boost::none; #endif #ifndef PLASMA_NO_BOOST namespace adaptor { using namespace boost::adaptors; } namespace algorithm { using namespace boost::range; template<class SinglePassRange, class Pred>bool any_of(SinglePassRange const& range, Pred pred) { return std::any_of(std::begin(range), std::end(range), pred); } template<class SinglePassRange, class Pred>bool all_of(SinglePassRange const& range, Pred pred) { return std::all_of(std::begin(range), std::end(range), pred); } } #endif namespace math { template<class T>constexpr T pow(T p, int n) { return n == 0 ? T(1) : n == 1 ? p : n == 2 ? p*p : n % 2 == 0 ? pow(pow(p, n / 2), 2) : pow(pow(p, n / 2), 2)*p; } int log(long long int p, int n) { int64 t = n; for (int i = 0;;++i) { if (t > p) return i; t *= n; } } constexpr double pi = 3.141592653589793; namespace detail { int gcd(int larger, int less) { return less == 0 ? larger : gcd(less, larger%less); } } int gcd(int lhs, int rhs) { return lhs < rhs ? detail::gcd(rhs, lhs) : detail::gcd(lhs, rhs); } void fourier_transform( std::vector<std::complex<double>>& vec, std::size_t N) { std::vector<std::complex<double>> butterfly; vec.resize(N); butterfly.resize(N); std::complex<double> half(std::cos(pi), std::sin(pi)); for (uint64 i = 1, k = N / 2;i < N;[&]() {i *= 2;k /= 2;}())//i*k == N/4 { std::complex<double> circle(std::cos(pi / i), std::sin(pi / i)); std::complex<double> c(1.0, 0); for (auto count = 0ull; count < i;++count) { for (auto j = 0ull;j < k;++j) { butterfly[count*k + j] = vec[2 * count*k + j] + vec[2 * count*k + j + k] * c; butterfly[count*k + j + N / 2] = vec[2 * count*k + j] + vec[2 * count*k + j + k] * c*half; } c *= circle; } std::swap(vec, butterfly); } } class polynomial { std::vector<std::complex<double>> value; void swap(polynomial&& p) { std::swap(value, p.value); } public: polynomial() :value{ 0.0 } {} polynomial(polynomial const&) = default; polynomial(std::vector<std::complex<double>>&& vec) :value(std::move(vec)) {} polynomial(polynomial&& p) :polynomial() { swap(std::move(p)); } polynomial(std::initializer_list<std::complex<double>> lis) :value(lis) {} polynomial(std::complex<double> c) :polynomial({ c }) {} polynomial& operator=(polynomial const&) = default; polynomial& operator=(polynomial&& p) { value = std::vector<std::complex<double>>{ 0.0 }; swap(std::move(p)); return *this; } ~polynomial() = default; std::complex<double> operator[](std::size_t deg)const { return deg >= value.size() ? 0.0 : value[deg]; } std::size_t degree()const { return value.size() - 1; } void strict_degree_set() { std::size_t N = degree(); for (;N > 0;--N) { if (value[N] != 0.0) break; } value.resize(N + 1); } void integer_degree_set() { std::size_t N = degree(); for (;N > 0;--N) { std::cout << value[N] << " " << (std::norm(value[N]) > (1.0e-20)) << std::endl; if (std::norm(value[N]) > (1.0e-20)) break; } value.resize(N + 1); } friend polynomial operator*(polynomial const& lhs, polynomial const& rhs) { std::size_t N = 1; while (true) { N *= 2; if (N > (lhs.degree() + rhs.degree())) break; } auto lhs_ = lhs.value; auto rhs_ = rhs.value; fourier_transform(lhs_, N); fourier_transform(rhs_, N); std::vector<std::complex<double>> vec; vec.reserve(N); for (std::size_t i = 0;i < N;++i) { vec.push_back(lhs_[i] * rhs_[i]); } for (auto& v : vec) { v = 2 * v.real() - v; } fourier_transform(vec, N); for (auto& v : vec) { v = (2 * v.real() - v)*(1.0 / N); } std::size_t k = N; for (;k > 0;--k) { if (std::norm(vec[k]) > 1.0e-23) break; } vec.resize(k + 1); return polynomial(std::move(vec)); } }; int real_integer(std::complex<double> c) { int v = static_cast<int>(c.real()); double u = c.real() - v; return v + static_cast<int>(2 * u); } template<class T>polynomial make_poly(std::vector<T> const& vec) { auto range = vec | adaptor::transformed([](T const& v) {return static_cast<std::complex<double>>(v);}); std::vector<std::complex<double>> ret(std::begin(range), std::end(range)); return polynomial(std::move(ret)); } polynomial make_poly(std::initializer_list<double>init) { std::vector<std::complex<double>> vec; for (auto v : init) { vec.emplace_back(v); } return polynomial(std::move(vec)); } polynomial make_poly(std::initializer_list<int> init) { std::vector<std::complex<double>> vec; for (auto v : init) { vec.emplace_back(v); } return polynomial(std::move(vec)); } template<class T>class infinite_value { optional<T> val; public: infinite_value(T const& v) :val(v) {} infinite_value(T&& v) :val(std::move(v)) {} infinite_value(none_t = none) :val() {} infinite_value(infinite_value const&) = default; infinite_value(infinite_value&&) = default; ~infinite_value() = default; infinite_value& operator=(T const& v) { val = v; return *this; } infinite_value& operator=(T&& v) { val = std::move(v); return *this; } infinite_value& operator=(none_t) { val = boost::none; return *this; } infinite_value& operator=(infinite_value const&) = default; infinite_value& operator=(infinite_value&&) = default; operator bool()const { return static_cast<bool>(val); } T const& operator*()const { return *val; } friend infinite_value operator+(infinite_value const& lhs, infinite_value const& rhs) { return lhs&&rhs ? infinite_value<T>(*lhs + *rhs) : infinite_value<T>(none); } friend infinite_value operator+(infinite_value const& lhs, T const& rhs) { return lhs ? infinite_value<T>(*lhs + rhs) : infinite_value<T>(none); } friend infinite_value operator+(T const& lhs, infinite_value const& rhs) { return lhs&&rhs ? infinite_value<T>(*lhs + *rhs) : infinite_value<T>(none); } friend bool operator==(infinite_value const& lhs, infinite_value const& rhs) { return (!lhs&&!rhs) || (lhs&&rhs && (*lhs == *rhs)); } friend bool operator==(infinite_value const& lhs, T const& rhs) { return lhs && (*lhs == rhs); } friend bool operator==(T const& lhs, infinite_value const& rhs) { return rhs && (lhs == *rhs); } friend bool operator<(infinite_value const& lhs, infinite_value const& rhs) { return !lhs ? false : !rhs ? true : *lhs < *rhs; } friend bool operator<(infinite_value const& lhs, T const& rhs) { return !lhs ? false : *lhs < rhs; } friend bool operator<(T const& lhs, infinite_value const& rhs) { return !rhs ? true : lhs < *rhs; } friend bool operator<=(infinite_value const& lhs, infinite_value const& rhs) { return (lhs < rhs) || (lhs == rhs); } friend bool operator<=(infinite_value const& lhs, T const& rhs) { return (lhs < rhs) || (lhs == rhs); } friend bool operator<=(T const& lhs, infinite_value const& rhs) { return (lhs < rhs) || (lhs == rhs); } friend bool operator>(infinite_value const& lhs, infinite_value const& rhs) { return !rhs ? false : !lhs ? true : *lhs > *rhs; } friend bool operator>(infinite_value const& lhs, T const& rhs) { return !lhs ? true : *lhs > rhs; } friend bool operator>(T const& lhs, infinite_value const& rhs) { return !rhs ? false : lhs > *rhs; } friend bool operator>=(infinite_value const& lhs, infinite_value const& rhs) { return (lhs > rhs) || (lhs == rhs); } friend bool operator>=(infinite_value const& lhs, T const& rhs) { return (lhs > rhs) || (lhs == rhs); } friend bool operator>=(T const& lhs, infinite_value const& rhs) { return (lhs > rhs) || (lhs == rhs); } }; template<std::size_t Mod>class modulo_number { uint64 val = {}; static constexpr uint64 abs(int64 n) { return n <= -1 ? n + Mod : n; } public: modulo_number(modulo_number const&) = default; modulo_number(modulo_number&&) = default; modulo_number& operator=(modulo_number const&) = default; modulo_number& operator=(modulo_number&&) = default; ~modulo_number() = default; constexpr modulo_number(uint64 num = {}) : val(num%Mod) {} constexpr modulo_number(unsigned int num) : val(num%Mod) {} constexpr modulo_number(int64 num) : val(abs(num%Mod)) {} constexpr modulo_number(int num) : val(abs(num%Mod)) {} modulo_number& operator=(uint64 num) { val = num%Mod; return *this; } modulo_number& operator=(int64 num) { val = abs(num%Mod); return *this; } modulo_number& operator=(unsigned int num) { val = num%Mod; return *this; } modulo_number& operator=(int num) { val = abs(num%Mod); return *this; } constexpr uint64 get()const { return val; } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>((lhs.val + rhs.val) % Mod); } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, int const& rhs) { return lhs + modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, unsigned int const& rhs) { return lhs + modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, int64 const& rhs) { return lhs + modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator+(modulo_number<Mod>const& lhs, uint64 const& rhs) { return lhs + modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator+(int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) + rhs; } friend constexpr modulo_number<Mod> operator+(unsigned int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) + rhs; } friend constexpr modulo_number<Mod> operator+(int64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) + rhs; } friend constexpr modulo_number<Mod> operator+(uint64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) + rhs; } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>((lhs.val + Mod - rhs.val) % Mod); } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, int const& rhs) { return lhs - modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, unsigned int const& rhs) { return lhs - modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, int64 const& rhs) { return lhs - modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator-(modulo_number<Mod>const& lhs, uint64 const& rhs) { return lhs - modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator-(int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) - rhs; } friend constexpr modulo_number<Mod> operator-(unsigned int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) - rhs; } friend constexpr modulo_number<Mod> operator-(int64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) - rhs; } friend constexpr modulo_number<Mod> operator-(uint64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) - rhs; } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>((lhs.val*rhs.val) % Mod); } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, int const& rhs) { return lhs * modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, unsigned int const& rhs) { return lhs * modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, int64 const& rhs) { return lhs * modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator*(modulo_number<Mod>const& lhs, uint64 const& rhs) { return lhs * modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator*(int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) * rhs; } friend constexpr modulo_number<Mod> operator*(unsigned int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) * rhs; } friend constexpr modulo_number<Mod> operator*(int64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) * rhs; } friend constexpr modulo_number<Mod> operator*(uint64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) * rhs; } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, modulo_number<Mod>const& rhs) { return lhs*math::pow(rhs, Mod - 2); } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, int const& rhs) { return lhs / modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, unsigned int const& rhs) { return lhs / modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, int64 const& rhs) { return lhs / modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator/(modulo_number<Mod>const& lhs, uint64 const& rhs) { return lhs / modulo_number<Mod>(rhs); } friend constexpr modulo_number<Mod> operator/(int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) / rhs; } friend constexpr modulo_number<Mod> operator/(unsigned int const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) / rhs; } friend constexpr modulo_number<Mod> operator/(int64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) / rhs; } friend constexpr modulo_number<Mod> operator/(uint64 const& lhs, modulo_number<Mod>const& rhs) { return modulo_number<Mod>(lhs) / rhs; } template<class Rhs>decltype(auto) operator+=(Rhs const& rhs) { return *this = *this + rhs; } template<class Rhs>decltype(auto) operator*=(Rhs const& rhs) { return *this = *this * rhs; } template<class Rhs>decltype(auto) operator-=(Rhs const& rhs) { return *this = *this - rhs; } template<class Rhs>decltype(auto) operator/=(Rhs const& rhs) { return *this = *this / rhs; } }; template<class T>constexpr T factorial(std::size_t n, std::size_t goal = 1) { return n == goal ? T(n) : n == 0 ? T(1) : factorial<T>(n, (n + goal) / 2 + 1)*factorial<T>((n + goal) / 2, goal); } namespace detail { constexpr uint64 integral_sqrt_i(uint64 v, uint64 start, uint64 end) { return start == end ? start : pow((start + end) / 2 + 1, 2) <= v ? integral_sqrt_i(v, (start + end) / 2 + 1, end) : integral_sqrt_i(v, start, (start + end) / 2); } } constexpr uint64 integral_sqrt(uint64 v) { return v == 0 ? 0 : v == 1 ? 1 : detail::integral_sqrt_i(v, 1, 0b100000000000000000000000000000000ull); } namespace detail { constexpr bool is_prime_i(uint64 v, uint64 start, uint64 end) { return start == end ? v%end != 0 : is_prime_i(v, start, (start + end) / 2) && is_prime_i(v, (start + end) / 2 + 1, end); } } constexpr bool is_prime(uint64 v) { return v == 0 ? false : v == 1 ? false : v == 2 ? true : v == 3 ? true : detail::is_prime_i(v, 2, integral_sqrt(v)); } class dynamic_modulo { uint64 value; uint64 mod; static constexpr uint64 abs(int64 v, uint64 mod) { return v <= -1 ? v + mod : v; } public: constexpr dynamic_modulo() :value(), mod(2) {} constexpr dynamic_modulo(uint64 v, uint64 m) : value(v), mod(m) {} dynamic_modulo(dynamic_modulo const&) = default; dynamic_modulo(dynamic_modulo&&) = default; dynamic_modulo& operator=(dynamic_modulo const&) = default; dynamic_modulo& operator=(dynamic_modulo&&) = default; ~dynamic_modulo() = default; constexpr uint64 get()const { return value; } constexpr friend auto operator+(dynamic_modulo const& lhs, dynamic_modulo const& rhs) { return lhs.mod != rhs.mod ? throw std::logic_error("math::dynamic_modulo mod number error") : dynamic_modulo((lhs.value + rhs.value) % lhs.mod, lhs.mod); } constexpr friend auto operator+(dynamic_modulo const& lhs, uint64 const& rhs) { return dynamic_modulo((lhs.value + rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator+(dynamic_modulo const& lhs, int64 const& rhs) { return dynamic_modulo(abs((lhs.value + rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator+(dynamic_modulo const& lhs, unsigned int const& rhs) { return dynamic_modulo((lhs.value + rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator+(dynamic_modulo const& lhs, int const& rhs) { return dynamic_modulo(abs((lhs.value + rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator+(uint64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo((lhs.value + rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator+(int64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value + rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator+(unsigned int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo((lhs.value + rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator+(int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value + rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, dynamic_modulo const& rhs) { return lhs.mod != rhs.mod ? throw std::logic_error("math::dynamic_modulo mod number error") : dynamic_modulo((lhs.value * rhs.value) % lhs.mod, lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, uint64 const& rhs) { return dynamic_modulo((lhs.value * rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, int64 const& rhs) { return dynamic_modulo(abs((lhs.value * rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, unsigned int const& rhs) { return dynamic_modulo((lhs.value * rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator*(dynamic_modulo const& lhs, int const& rhs) { return dynamic_modulo(abs((lhs.value * rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator*(uint64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo((lhs.value * rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator*(int64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value * rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator*(unsigned int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo((lhs.value * rhs) % lhs.mod, lhs.mod); } constexpr friend auto operator*(int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value * rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, dynamic_modulo const& rhs) { return lhs.mod != rhs.mod ? throw std::logic_error("math::dynamic_modulo mod number error") : dynamic_modulo(abs((lhs.value - rhs.value) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, uint64 const& rhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, int64 const& rhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, unsigned int const& rhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(dynamic_modulo const& lhs, int const& rhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(uint64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(int64 const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(unsigned int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } constexpr friend auto operator-(int const& rhs, dynamic_modulo const& lhs) { return dynamic_modulo(abs((lhs.value - rhs) % lhs.mod, lhs.mod), lhs.mod); } template<class Rhs>dynamic_modulo& operator+=(Rhs const& rhs) { return *this = *this + rhs; } template<class Rhs>dynamic_modulo& operator-=(Rhs const& rhs) { return *this = *this - rhs; } template<class Rhs>dynamic_modulo& operator*=(Rhs const& rhs) { return *this = *this * rhs; } }; } namespace geometry { template<class Type>struct point { Type x, y; }; template<class Type>auto make_point(Type x, Type y) { return point<Type>{x, y}; } template<class Type>auto operator+(point<Type>const& lhs, point<Type>const& rhs) { return make_point(lhs.x + rhs.x, lhs.y + rhs.y); } template<class Type>auto operator-(point<Type>const& lhs, point<Type>const& rhs) { return make_point(lhs.x - rhs.x, lhs.y - rhs.y); } template<class Point>struct box { Point small, large; }; template<class Point>auto make_box(Point a, Point b) { return box<Point>{ make_point(std::min(a.x, b.x), std::min(a.y, b.y)), make_point(std::max(a.x, b.x), std::max(a.y, b.y))}; } #ifndef PLASMA_NO_BOOST template<class Point>boost::optional<box<Point>> hit_check(box<Point> a, box<Point> b) { if (a.small.x > b.small.x) std::swap(a, b); if (a.large.x < b.small.x) return boost::none; auto small_x = b.small.x; auto large_x = std::min(b.large.x, a.large.x); if (a.small.y < b.small.y) { if (b.small.y < a.large.y) return make_box( make_point(small_x, b.small.y), make_point(large_x, std::min(a.large.y, b.large.y))); else return boost::none; } else { if (a.small.y < b.large.y) return make_box( make_point(small_x, a.small.y), make_point(large_x, std::min(a.large.y, b.large.y))); else return boost::none; } } #endif } namespace graph_traits { class graph { std::vector<int64> node_data; std::vector<std::vector<std::pair<int, int64>>> edge_data; public: graph() = default; graph(std::vector<int64>&& n) :node_data(std::move(n)), edge_data{} { edge_data.resize(node_data.size()); } graph(std::size_t size) :node_data(size), edge_data{} { } void resize(int size) { node_data.resize(size); edge_data.resize(size); } void edge_reserve(int size) { for (auto& v : edge_data) { v.reserve(size); } } void add_node(int64 data) { node_data.emplace_back(data); edge_data.emplace_back(); } void add_edge(int from, int to, int64 data) { edge_data[from].emplace_back(to, data); } std::vector<math::infinite_value<int64>> dijkstra(int from)const { struct compare { bool operator()( std::pair<int, math::infinite_value<int64>>const& lhs, std::pair<int, math::infinite_value<int64>>const& rhs)const { return lhs.second > rhs.second; } }; std::priority_queue< std::pair<int, math::infinite_value<int64>>, std::vector<std::pair<int, math::infinite_value<int64>>>, compare>nodes; std::vector<math::infinite_value<int64>> ret(node_data.size()); for (int i{};i < node_data.size();++i) { nodes.emplace(i, math::infinite_value<int64>()); } nodes.emplace(from, int()); while (nodes.size()) { auto p = nodes.top(); nodes.pop(); if (ret[p.first] <= p.second) continue; ret[p.first] = p.second; for (auto const& d : edge_data[p.first]) { nodes.emplace(d.first, std::min(ret[d.first], ret[p.first] + d.second)); } } return ret; } int64 operator[](int n)const { return node_data[n]; } }; } void Main(std::integral_constant<int, 1>); void Main(std::integral_constant<int, 2>); void Main(std::integral_constant<int, 3>); void Main(std::integral_constant<int, 4>); void Main(std::integral_constant<int, 5>); #endif//テンプレートここまで //ここを書き換える constexpr int problem = 2; //ここは書き換えない int main() { std::cin.sync_with_stdio(false); std::cout << std::setprecision(std::numeric_limits<long double>::digits10 + 1); Main(std::integral_constant<int, problem>{}); } void Main(std::integral_constant<int, 1>) { std::vector<int> vec; int N, K; std::cin >> N >> K; for (int i{};i < K;++i) { int C; std::cin >> C; vec.emplace_back(C); } for (int i = N;i < 10000;++i) { int v = i; while (v) { if (algorithm::count(vec, v % 10)) goto next; v /= 10; } std::cout << i << std::endl; break; next:; } } typedef math::modulo_number<1000000007> number_t; number_t helper(number_t k,number_t n) { number_t ret = 1; for (int i{};i < n.get();++i) { ret *= (k + i); } return ret / n; } std::vector<number_t> check(std::vector<number_t>const& data, std::size_t H) { std::vector<number_t> ret; int W = data.size(); for (int i{};i < W;++i) { number_t num; for (int index = 1;index <= i;++index) { num += data[i - index] * helper(H - 1, index); } } return ret; } void Main(std::integral_constant<int, 2>) { int H, W, A, B; std::cin >> H >> W >> A >> B; std::vector<math::modulo_number<1000000007>> data(W, number_t(1)); auto vec = check(data, H - A); auto ite = std::next(vec.begin(), B); vec.erase(vec.begin(), ite); auto ret = check(vec, A + 1); std::cout << ret.back().get() << std::endl; } void Main(std::integral_constant<int, 3>) { } void Main(std::integral_constant<int, 4>) { } void Main(std::integral_constant<int, 5>) { }
a.cc:29:9: fatal error: boost/optional.hpp: No such file or directory 29 | #include<boost/optional.hpp> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s671034869
p04040
C++
#include <bits/stdc++.h> // #include <iostream> // #include <algorithm> // #include <string> // #include <vector> // #include <queue> // #include <stack> // #include <set> // #include <map> #define rep(i,a,n) for(int i=a; i<n; i++) #define repr(i,a,n) for(int i=a;i >= n;i--) #define INF 999999999 #define pb(a) push_back(a) #define MOD 1000000007 int dy[]={0, 0, 1, -1}; int dx[]={1, -1, 0, 0}; using namespace std; typedef pair<int, int> pii; typedef long long int ll; typedef vector<pii> VP; ll frac(ll x, ll mod) { if(x == 0) return 1; return (x * frac(x-1, mod)) % mod; } ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while(n > 0) { if(n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき) x = (x * x) % mod; n >>= 1; //右シフト(n = n >> 1) } return res; } int main(void) { ll h, w, a, b; cin >> h >> w >> a >> b; ll x = h - a; ll y = w - b; ll A = frac(x+b,MOD) * mod_pow(frac(x,MOD) * frac(b,MOD) % MOD, MOD-2); ll B = frac(x+y,MOD) * mod_pow(frac(x,MOD) * frac(y,MOD) % MOD, MOD-2); ll C = frac(a+y,MOD) * mod_pow(frac(a,MOD) * frac(y,MOD) % MOD, MOD-2); cout << ((A * C % MOD) + B) % MOD << endl; return 0; }
a.cc: In function 'int main()': a.cc:46:35: error: too few arguments to function 'll mod_pow(ll, ll, ll)' 46 | ll A = frac(x+b,MOD) * mod_pow(frac(x,MOD) * frac(b,MOD) % MOD, MOD-2); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:4: note: declared here 30 | ll mod_pow(ll x, ll n, ll mod) { | ^~~~~~~ a.cc:47:35: error: too few arguments to function 'll mod_pow(ll, ll, ll)' 47 | ll B = frac(x+y,MOD) * mod_pow(frac(x,MOD) * frac(y,MOD) % MOD, MOD-2); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:4: note: declared here 30 | ll mod_pow(ll x, ll n, ll mod) { | ^~~~~~~ a.cc:48:35: error: too few arguments to function 'll mod_pow(ll, ll, ll)' 48 | ll C = frac(a+y,MOD) * mod_pow(frac(a,MOD) * frac(y,MOD) % MOD, MOD-2); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:4: note: declared here 30 | ll mod_pow(ll x, ll n, ll mod) { | ^~~~~~~