submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s338643076
p03832
C++
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) #define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--) #define chmin(a,b) (a)=min((a),(b)); #define chmax(a,b) (a)=max((a),(b)); #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl; #define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;} #define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;} #define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl; #define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;} inline void output(){ cerr << endl; } template<typename First, typename... Rest> inline void output(const First& first, const Rest&... rest) { cerr << first << " "; output(rest...); } using ll = long long; using Pii = pair<int, int>; using TUPLE = tuple<int, int, int>; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; const int inf = 1ll << 60; const int mod = 1e9 + 7; using Graph = vector<vector<int>>; ll powmod (ll a, ll p) { ll ans = 1; ll mul = a; for (; p > 0; p >>= 1, mul = (mul * mul) % mod) { if ((p & 1) == 1) ans = (ans * mul) % mod; } return ans; } const int MAX_N = 5000; ll fact[MAX_N]; ll revFact[MAX_N]; // !!!!!!!!SET FACT!!!!!!! void setFact(int N) { fact[0] = 1; for (int i = 1; i < N; i++) { fact[i] = fact[i - 1] * i; fact[i] %= mod; } revFact[N - 1] = powmod(fact[N - 1], mod - 2); for (int i = N - 2; i >= 0; i--) { revFact[i] = revFact[i + 1] * (i + 1); revFact[i] %= mod; } } ll getC(int a, int b) { assert(a >= 0 && b >= 0); return (((fact[a] * revFact[b]) % mod) * revFact[a - b]) % mod; } ll revmod(ll x) { return powmod(x, mod - 2); } int n, a, b, c, d; // using State = tuple<int, int, int>; using State = int; const int B = 10000; unordered_map<State, int> dp; inline int makeState(int i, int j, int k) { return B * B * i + B * j + k; } inline void getState(State state, int& i, int& j, int& k) { k = state % B; state /= B; j = state % B; state /= B; i = state % B; } // void printState(State state) { // int i, j, k; // tie(i, j, k) = state; // output(i, j, k); // } // 残りi人で、ちょうどj人のグループがk個できたときの場合の数 int f(State state) { // printState(state); if (dp.count(state)) return dp[state]; int i, j, k; // tie(i, j, k) = state; getState(state, i, j, k); if (i == 0) { // printState(state); if (k >= c) { // output("A1"); return 1; } else { // output("A2"); return 0; } } if (i < j) { // printState(state); // output("B"); return 0; } if (j > b) { // printState(state); // output("C"); return 0; } if (k > d) { // printState(state); // output("D"); return 0; } if (i % j != 0 && (j + 1) * c > i) { return 0; } // int &ret = dp[state]; int ret = 0; // 人数jのグループを作る // 人数の同じグループは区別しない // if (k + 1 <= d && i - j >= 0) (ret += (f(State(i - j, j, k + 1)) * getC(i, j))) % mod; if (k + 1 <= d && i - j >= 0) { // printState(state); // output("E"); int hoge = f(makeState(i - j, j, k + 1)); (hoge *= getC(i, j)) %= mod; (hoge *= revmod(k + 1)) %= mod; ret += hoge; // (ret += (f(State(i - j, j, k + 1)) * getC(i, j))) % mod; } // 人数j+1に移行する // if (j + 1 <= b && c <= k && k <= d) (ret *= f(State(i, j + 1, 0))) %= mod; if (j + 1 <= b && (k == 0 || c <= k && k <= d)) { // printState(state); // output("F"); (ret += f(makeState(i, j + 1, 0))) %= mod; } return dp[state] = ret; } signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); setFact(MAX_N); while (cin >> n >> a >> b >> c >> d) { // dp.clear(); cout << f(makeState(n, a, 0)) << endl; // for (auto p : dp) { // int i, j, k; // tie(i, j, k) = p.first; // output(i, j, k, p.second); // } // cout << "-------------" << endl; } } #include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) #define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--) #define chmin(a,b) (a)=min((a),(b)); #define chmax(a,b) (a)=max((a),(b)); #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl; #define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;} #define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;} #define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl; #define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;} inline void output(){ cerr << endl; } template<typename First, typename... Rest> inline void output(const First& first, const Rest&... rest) { cerr << first << " "; output(rest...); } using ll = long long; using Pii = pair<int, int>; using TUPLE = tuple<int, int, int>; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; const int inf = 1ll << 60; const int mod = 1e9 + 7; using Graph = vector<vector<int>>; ll powmod (ll a, ll p) { ll ans = 1; ll mul = a; for (; p > 0; p >>= 1, mul = (mul * mul) % mod) { if ((p & 1) == 1) ans = (ans * mul) % mod; } return ans; } const int MAX_N = 5000; ll fact[MAX_N]; ll revFact[MAX_N]; // !!!!!!!!SET FACT!!!!!!! void setFact(int N) { fact[0] = 1; for (int i = 1; i < N; i++) { fact[i] = fact[i - 1] * i; fact[i] %= mod; } revFact[N - 1] = powmod(fact[N - 1], mod - 2); for (int i = N - 2; i >= 0; i--) { revFact[i] = revFact[i + 1] * (i + 1); revFact[i] %= mod; } } ll getC(int a, int b) { assert(a >= 0 && b >= 0); return (((fact[a] * revFact[b]) % mod) * revFact[a - b]) % mod; } ll revmod(ll x) { return powmod(x, mod - 2); } int n, a, b, c, d; // using State = tuple<int, int, int>; using State = int; const int B = 10000; unordered_map<State, int> dp; inline int makeState(int i, int j, int k) { return B * B * i + B * j + k; } inline void getState(State state, int& i, int& j, int& k) { k = state % B; state /= B; j = state % B; state /= B; i = state % B; } // void printState(State state) { // int i, j, k; // tie(i, j, k) = state; // output(i, j, k); // } // 残りi人で、ちょうどj人のグループがk個できたときの場合の数 int f(State state) { // printState(state); if (dp.count(state)) return dp[state]; int i, j, k; // tie(i, j, k) = state; getState(state, i, j, k); if (i == 0) { // printState(state); if (k >= c) { // output("A1"); return 1; } else { // output("A2"); return 0; } } if (i < j) { // printState(state); // output("B"); return 0; } if (j > b) { // printState(state); // output("C"); return 0; } if (k > d) { // printState(state); // output("D"); return 0; } if (i % j != 0 && (j + 1) * c > i) { return 0; } // int &ret = dp[state]; int ret = 0; // 人数jのグループを作る // 人数の同じグループは区別しない // if (k + 1 <= d && i - j >= 0) (ret += (f(State(i - j, j, k + 1)) * getC(i, j))) % mod; if (k + 1 <= d && i - j >= 0) { // printState(state); // output("E"); int hoge = f(makeState(i - j, j, k + 1)); (hoge *= getC(i, j)) %= mod; (hoge *= revmod(k + 1)) %= mod; ret += hoge; // (ret += (f(State(i - j, j, k + 1)) * getC(i, j))) % mod; } // 人数j+1に移行する // if (j + 1 <= b && c <= k && k <= d) (ret *= f(State(i, j + 1, 0))) %= mod; if (j + 1 <= b && (k == 0 || c <= k && k <= d)) { // printState(state); // output("F"); (ret += f(makeState(i, j + 1, 0))) %= mod; } return dp[state] = ret; } signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); setFact(MAX_N); while (cin >> n >> a >> b >> c >> d) { // dp.clear(); cout << f(makeState(n, a, 0)) << endl; // for (auto p : dp) { // int i, j, k; // tie(i, j, k) = p.first; // output(i, j, k, p.second); // } // cout << "-------------" << endl; } }
a.cc:196:13: error: redefinition of 'void output()' 196 | inline void output(){ cerr << endl; } | ^~~~~~ a.cc:19:13: note: 'void output()' previously defined here 19 | inline void output(){ cerr << endl; } | ^~~~~~ a.cc:198:13: error: redefinition of 'template<class First, class ... Rest> void output(const First&, const Rest& ...)' 198 | inline void output(const First& first, const Rest&... rest) { | ^~~~~~ a.cc:21:13: note: 'template<class First, class ... Rest> void output(const First&, const Rest& ...)' previously declared here 21 | inline void output(const First& first, const Rest&... rest) { | ^~~~~~ a.cc:208:11: error: redefinition of 'const long long int inf' 208 | const int inf = 1ll << 60; | ^~~ a.cc:31:11: note: 'const long long int inf' previously defined here 31 | const int inf = 1ll << 60; | ^~~ a.cc:209:11: error: redefinition of 'const long long int mod' 209 | const int mod = 1e9 + 7; | ^~~ a.cc:32:11: note: 'const long long int mod' previously defined here 32 | const int mod = 1e9 + 7; | ^~~ a.cc:212:4: error: redefinition of 'll powmod(ll, ll)' 212 | ll powmod (ll a, ll p) { | ^~~~~~ a.cc:35:4: note: 'll powmod(ll, ll)' previously defined here 35 | ll powmod (ll a, ll p) { | ^~~~~~ a.cc:221:11: error: redefinition of 'const long long int MAX_N' 221 | const int MAX_N = 5000; | ^~~~~ a.cc:44:11: note: 'const long long int MAX_N' previously defined here 44 | const int MAX_N = 5000; | ^~~~~ a.cc:222:4: error: redefinition of 'll fact [5000]' 222 | ll fact[MAX_N]; | ^~~~ a.cc:45:4: note: 'll fact [5000]' previously declared here 45 | ll fact[MAX_N]; | ^~~~ a.cc:223:4: error: redefinition of 'll revFact [5000]' 223 | ll revFact[MAX_N]; | ^~~~~~~ a.cc:46:4: note: 'll revFact [5000]' previously declared here 46 | ll revFact[MAX_N]; | ^~~~~~~ a.cc:225:6: error: redefinition of 'void setFact(long long int)' 225 | void setFact(int N) { | ^~~~~~~ a.cc:48:6: note: 'void setFact(long long int)' previously defined here 48 | void setFact(int N) { | ^~~~~~~ a.cc:238:4: error: redefinition of 'll getC(long long int, long long int)' 238 | ll getC(int a, int b) { | ^~~~ a.cc:61:4: note: 'll getC(long long int, long long int)' previously defined here 61 | ll getC(int a, int b) { | ^~~~ a.cc:243:4: error: redefinition of 'll revmod(ll)' 243 | ll revmod(ll x) { | ^~~~~~ a.cc:66:4: note: 'll revmod(ll)' previously defined here 66 | ll revmod(ll x) { | ^~~~~~ a.cc:247:5: error: redefinition of 'long long int n' 247 | int n, a, b, c, d; | ^ a.cc:70:5: note: 'long long int n' previously declared here 70 | int n, a, b, c, d; | ^ a.cc:247:8: error: redefinition of 'long long int a' 247 | int n, a, b, c, d; | ^ a.cc:70:8: note: 'long long int a' previously declared here 70 | int n, a, b, c, d; | ^ a.cc:247:11: error: redefinition of 'long long int b' 247 | int n, a, b, c, d; | ^ a.cc:70:11: note: 'long long int b' previously declared here 70 | int n, a, b, c, d; | ^ a.cc:247:14: error: redefinition of 'long long int c' 247 | int n, a, b, c, d; | ^ a.cc:70:14: note: 'long long int c' previously declared here 70 | int n, a, b, c, d; | ^ a.cc:247:17: error: redefinition of 'long long int d' 247 | int n, a, b, c, d; | ^ a.cc:70:17: note: 'long long int d' previously declared here 70 | int n, a, b, c, d; | ^ a.cc:250:11: error: redefinition of 'const long long int B' 250 | const int B = 10000; | ^ a.cc:73:11: note: 'const long long int B' previously defined here 73 | const int B = 10000; | ^ a.cc:252:27: error: redefinition of 'std::unordered_map<long long int, long long int> dp' 252 | unordered_map<State, int> dp; | ^~ a.cc:75:27: note: 'std::unordered_map<long long int, long long int> dp' previously declared here 75 | unordered_map<State, int> dp; | ^~ a.cc:254:12: error: redefinition of 'long long int makeState(long long int, long long int, long long int)' 254 | inline int makeState(int i, int j, int k) { | ^~~~~~~~~ a.cc:77:12: note: 'long long int makeState(long long int, long long int, long long int)' previously defined here 77 | inline int makeState(int i, int j, int k) { | ^~~~~~~~~ a.cc:258:13: error: redefinition of 'void getState(State, long long int&, long long int&, long long int&)' 258 | inline void getState(State state, int& i, int& j, int& k) { | ^~~~~~~~ a.cc:81:13: note: 'void getState(State, long long int&, long long int&, long long int&)' previously defined here 81 | inline void getState(State state, int& i, int& j, int& k) { | ^~~~~~~~ a.cc:273:5: error: redefinition of 'long long int f(State)' 273 | int f(State state) { | ^ a.cc:96:5: note: 'long long int f(State)' previously defined here 96 | int f(State state) { | ^ a.cc:339:8: error: redefinition of 'int main()' 339 | signed main() { | ^~~~ a.cc:162:8: note: 'int main()' previously defined here 162 | signed main() { | ^~~~
s728117939
p03832
C++
#include <cstdio> #include <algorithm> #include <cmath> #include <queue> #include <vector> #include <map> #include <set> using namespace std; typedef pair<int , int> P2; typedef pair<pair<int , int> , int> P3; typedef pair<pair<int , int> , pair<int , int> > P4; #define Fst first #define Snd second #define PB(a) push_back(a) #define MP(a , b) make_pair((a) , (b)) #define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c)) #define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d))) #define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i) #define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i) #define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it) //typedef long long LL; typedef __int64 LL; int N,A,B,C,D; LL mod = 1e9 + 7; LL con[1010][1010]; LL dp[1010][1010]; LL r[1010]; int main(){ scanf("%d%d%d%d%d" , &N , &A , &B , &C , &D); con[0][0] = 1; repp(i,1,N+1){ con[i][0] = con[i][i] = 1; repp(j,1,i){ con[i][j] = (con[i-1][j-1] + con[i-1][j]) % mod; } } { int x = mod - 2; r[N] = 1; repp(i,2,N+1){ (r[N] *= i) %= mod; } LL y = r[N]; r[N] = 1; while(x > 0){ if(x%2==1) (r[N] *= y) %= mod; (y *= y) %= mod; x /= 2; } } repm(i,N,0){ r[i-1] = r[i] * i % mod; } dp[0][A-1] = 1; repp(i,0,N+1){ repp(j,A,B+1){ (dp[i][j] += dp[i][j-1]) %= mod; //printf("%d %d %I64lld\n" , i , j , dp[i][j]); if(i+j*C>N) continue; LL z = 1; repp(k,0,C){ (z *= con[N-i-j*k][j]) %= mod; } repp(k,C,D){ dp[i+j*k][j+1] += dp[i][j] * z % mod * r[k] % mod; if(i+j+j*k>N) break; (z *= con[N-i-j*k][j]) %= mod; } if(i+j*D<=N) dp[i+j*D][j+1] += dp[i][j] * z % mod * r[D] % mod; } }/* LL ans = 0; repp(j,A,B+1){ (ans += dp[N][j][1]) %= mod; } printf("%lld\n" , ans);*/ printf("%lld\n" , dp[N][B] + dp[N][B+1]); return 0; }
a.cc:25:9: error: '__int64' does not name a type; did you mean '__int64_t'? 25 | typedef __int64 LL; | ^~~~~~~ | __int64_t a.cc:28:1: error: 'LL' does not name a type 28 | LL mod = 1e9 + 7; | ^~ a.cc:29:1: error: 'LL' does not name a type 29 | LL con[1010][1010]; | ^~ a.cc:30:1: error: 'LL' does not name a type 30 | LL dp[1010][1010]; | ^~ a.cc:31:1: error: 'LL' does not name a type 31 | LL r[1010]; | ^~ a.cc: In function 'int main()': a.cc:35:9: error: 'con' was not declared in this scope; did you mean 'cos'? 35 | con[0][0] = 1; | ^~~ | cos a.cc:39:69: error: 'mod' was not declared in this scope; did you mean 'modf'? 39 | con[i][j] = (con[i-1][j-1] + con[i-1][j]) % mod; | ^~~ | modf a.cc:43:25: error: 'mod' was not declared in this scope; did you mean 'modf'? 43 | int x = mod - 2; | ^~~ | modf a.cc:44:17: error: 'r' was not declared in this scope 44 | r[N] = 1; | ^ a.cc:48:17: error: 'LL' was not declared in this scope 48 | LL y = r[N]; | ^~ a.cc:51:45: error: 'y' was not declared in this scope 51 | if(x%2==1) (r[N] *= y) %= mod; | ^ a.cc:52:26: error: 'y' was not declared in this scope 52 | (y *= y) %= mod; | ^ a.cc:57:17: error: 'r' was not declared in this scope 57 | r[i-1] = r[i] * i % mod; | ^ a.cc:57:37: error: 'mod' was not declared in this scope; did you mean 'modf'? 57 | r[i-1] = r[i] * i % mod; | ^~~ | modf a.cc:59:9: error: 'dp' was not declared in this scope 59 | dp[0][A-1] = 1; | ^~ a.cc:62:53: error: 'mod' was not declared in this scope; did you mean 'modf'? 62 | (dp[i][j] += dp[i][j-1]) %= mod; | ^~~ | modf a.cc:65:25: error: 'LL' was not declared in this scope 65 | LL z = 1; | ^~ a.cc:67:34: error: 'z' was not declared in this scope 67 | (z *= con[N-i-j*k][j]) %= mod; | ^ a.cc:70:62: error: 'z' was not declared in this scope 70 | dp[i+j*k][j+1] += dp[i][j] * z % mod * r[k] % mod; | ^ a.cc:70:72: error: 'r' was not declared in this scope 70 | dp[i+j*k][j+1] += dp[i][j] * z % mod * r[k] % mod; | ^ a.cc:74:67: error: 'z' was not declared in this scope 74 | if(i+j*D<=N) dp[i+j*D][j+1] += dp[i][j] * z % mod * r[D] % mod; | ^ a.cc:74:77: error: 'r' was not declared in this scope 74 | if(i+j*D<=N) dp[i+j*D][j+1] += dp[i][j] * z % mod * r[D] % mod; | ^
s156588461
p03832
C++
#include<bits/stdc++.h> using namespace std; class combination { public: //Nの最大値がわかれば代入する combination( long long int combinationThreshold = 1e7 ) { (*this).combinationThreshold = combinationThreshold + 2; } //a^p % mod long long int powmod( long long int A, long long int P, long long int M = LLONG_MAX ) { long long int ans = 1; long long int mul = A; for( ; P > 0; P >>= 1, mul = (mul*mul) % M ) { if( (P & 1) == 1 ) ans = (ans*mul) % M; } return ans; } //nCk mod m long long int cb( long long int N, long long int K, long long int M = LLONG_MAX ) { if( N < combinationThreshold ) {// 事前計算O(N)、答えるのはO(1) if( inv.size() == 0 ) { inv = vector<long long int>( combinationThreshold ); inv[1] = 1; for( long long int i = 2; i < combinationThreshold; i++ ) { inv[i] = M - (M / i)*inv[M%i] % M; } fact = vector<long long int>( combinationThreshold ); fact[0] = 1; revFact = vector<long long int> ( combinationThreshold ); revFact[0] = 1; for( long long int i = 1; i < combinationThreshold; i++ ) { fact[i] = (fact[i - 1] * i) % M; revFact[i] = (revFact[i - 1] * inv[i]) % M; } } return (((fact[N] * revFact[K]) % M)*revFact[N - K]) % M; } else { return cbOnce( N, K, M ); } } //一回だけなら最速 O(K + log(M)) long long int cbOnce( long long int N, long long int K, long long int M = LLONG_MAX ) { if( K > N / 2 ) return cb( N, N - K, M ); long long int ans = 1; long long int div = 1; for( long long int i = 0; i < K; i++ ) { ans *= N - i; ans %= M; div *= i + 1; div %= M; } ans *= powmod( div, M - 2, M ); return ans%M; } private: vector<vector<long long int>>C;//3000以下の答え vector<long long int>fact;//階乗 vector<long long int>revFact;//階乗の逆元 vector<long long int>inv;//mod pでの逆元 long long int combinationThreshold;//Nの最大値がわかれば入れる。 }; combination cb; map<pair<long long int, long long int>, long long int>memo; long long int saiki( long long int N, long long int A, long long int B, long long int C, long long int D ) { long long int ret = 0; if( N == 0 ) { return 1; } if( N < A*C ) { return 0; } if( memo.count( make_pair( N, A ) ) != 0 ) { return memo[make_pair( N, A )]; } for( long long int i = A; i <= B; i++ ) { for( long long int j = C; j <= D && j*i <= N; j++ ) { long long int memox = saiki( N - i*j, i + 1, B, C, D )*cb.cb( N, i*j, 1e9L + 7 ); long long int xxx = 1; for( size_t k = 1; k <= j; k++ ) { xxx *= cb.cb( k*i, i, 1e9 + 7 ); xxx %= (long long int)1e9 + 7; xxx *= cb.powmod( k, 1e9 + 5, 1e9 + 7 ); xxx %= (long long int)1e9 + 7; } //cout << xxx << endl; memox *= xxx; ret += memox; ret %= (long long int)1e9L + 7; } } return memo[make_pair( N, A )] = ret; }
/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
s442036760
p03832
C++
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> using namespace std; #define REP(i,n) for(int i=0; i<n; ++i) #define FOR(i,a,b) for(int i=a; i<=b; ++i) #define FORR(i,a,b) for (int i=a; i>=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef pair<int,int> P; typedef pair<ll,ll> PL; const ll MOD = 1e9+7; ll add(ll x, ll y){ return (x+y)%MOD; } ll mul(ll x, ll y){ return (x%MOD)*(y%MOD)%MOD; } ll powll(ll x, ll y){ ll res = 1LL; while(y){ if (y & 1LL) res *= x; res %= MOD; x = (x*x) % MOD; y >>= 1LL; } return res; } ll div(ll x, ll y){ return (x * powll(y,MOD-2)) % MOD; } ll nPr(ll n, ll r){ ll res = 1LL; FOR(i,1,r){ res = (res * ((n-i+1) % MOD)) % MOD; } return res; } ll nCr(ll n, ll r){ ll res = nPr(n,r); FOR(i,1,r){ res = (res * powll(i,MOD-2)) % MOD; } return res; } ll dp[1001][1001]; ll a, b, c, d; ll calc(int n, ll x){ if (dp[n][x] > 0) return dp[n][x]; if (n == 0) return dp[n][x] = 1; if (x > n || x > b) return 0; ll res = calc(n,x+1), p = 1; // cout << n << " " << x << endl; FOR(i,c,d){ ll y = x * i; if (y > n) break; if (i == c){ REP(j,c){ p = (p * nCr(n-j*x, x)) % MOD; } p = div(p, (ll)c); }else{ ll m = n - x*(i-1); p = (p * nCr(m, x)) % MOD; p = div(p, (ll)i); } // printf("%d %lld %d %lld %lld\n", n, x, i, p, calc(n-y,x+1)); res = (res + p * calc(n-y, x+1)) % MOD; } return dp[n][x] = res; } int main() { int n; cin >> n >> a >> b >> c >> d; ll ans = 0; ans = calc(n,a); cout << ans << endl; // REP(i,n+1){ // REP(j,n+1){ // cout << dp[i][j] << " "; // } // cout << endl; // } return 0; }
a.cc: In function 'll calc(int, ll)': a.cc:85:20: error: call of overloaded 'div(ll&, ll)' is ambiguous 85 | p = div(p, (ll)c); | ~~~^~~~~~~~~~ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, 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/stdlib.h:992:14: note: candidate: 'div_t div(int, int)' 992 | extern div_t div (int __numer, int __denom) | ^~~ a.cc:49:4: note: candidate: 'll div(ll, ll)' 49 | ll div(ll x, ll y){ | ^~~ /usr/include/c++/14/cstdlib:219:3: note: candidate: 'lldiv_t __gnu_cxx::div(long long int, long long int)' 219 | div(long long __n, long long __d) | ^~~ /usr/include/c++/14/cstdlib:181:3: note: candidate: 'ldiv_t std::div(long int, long int)' 181 | div(long __i, long __j) _GLIBCXX_NOTHROW { return ldiv(__i, __j); } | ^~~ a.cc:89:20: error: call of overloaded 'div(ll&, ll)' is ambiguous 89 | p = div(p, (ll)i); | ~~~^~~~~~~~~~ /usr/include/stdlib.h:992:14: note: candidate: 'div_t div(int, int)' 992 | extern div_t div (int __numer, int __denom) | ^~~ a.cc:49:4: note: candidate: 'll div(ll, ll)' 49 | ll div(ll x, ll y){ | ^~~ /usr/include/c++/14/cstdlib:219:3: note: candidate: 'lldiv_t __gnu_cxx::div(long long int, long long int)' 219 | div(long long __n, long long __d) | ^~~ /usr/include/c++/14/cstdlib:181:3: note: candidate: 'ldiv_t std::div(long int, long int)' 181 | div(long __i, long __j) _GLIBCXX_NOTHROW { return ldiv(__i, __j); } | ^~~
s907933630
p03832
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> #include <cstring> using namespace std; int n, a, b, c, d; using ll = long long; //負数がないMOD関数 inline long long imod(long long a, long long b) { return (a >= 0) ? (a % b) : (a % b + b); } //mint_base型用の累乗関数 template <long long MOD> class mint_base; template <long long MOD> mint_base<MOD> m_pow(mint_base<MOD> x, long long n); //mod計算を自動で行う整数テンプレートクラス template <long long MOD = 1000000007> class mint_base { public: mint_base<MOD> operator+(const mint_base<MOD> &other)const { return mint_base<MOD>(imod(a + other.a, MOD)); } mint_base<MOD> operator-(const mint_base<MOD> &other)const { return mint_base<MOD>(imod(a - other.a, MOD)); } mint_base<MOD> operator*(const mint_base<MOD> &other)const { return mint_base<MOD>(imod(a * other.a, MOD)); } mint_base<MOD> operator+=(const mint_base<MOD> &other) { a = imod(a + other.a, MOD); return mint_base<MOD>(a); } mint_base<MOD> operator-=(const mint_base<MOD> &other) { a = imod(a - other.a, MOD); return mint_base<MOD>(a); } mint_base<MOD> operator*=(const mint_base<MOD> &other) { a = imod(a * other.a, MOD); return mint_base<MOD>(a); } mint_base<MOD> operator+()const { return *this; } mint_base<MOD> operator-()const { return mint_base<MOD>(-a); } mint_base<MOD>& operator++() { *this += 1; return *this; } mint_base<MOD> operator++(int) { auto tmp = *this; *this += 1; return tmp; } mint_base<MOD>& operator--() { *this -= 1; return *this; } mint_base<MOD> operator--(int) { auto tmp = *this; *this -= 1; return tmp; } mint_base<MOD> operator~()const { return m_pow(a, (long long)e_phi - 1); } mint_base<MOD>& operator=(const mint_base<MOD> &other) { a = other.a; return *this; } explicit operator long long()const { return a; } explicit operator int()const { return (int)a; } //無効な数値を指定された場合 static_assert(MOD >= 2, "MOD cannot be below 2."); mint_base(long long a_) :a(imod(a_, MOD)) { if (e_phi > 0)return; //オイラー値の導出 e_phi = MOD; long long m_ = MOD; for (int i = 2; i * i <= m_; ++i) { if (m_ % i == 0) { e_phi = e_phi / i * (i - 1); for (; m_ % i == 0; m_ /= i); } } if (m_ != 1)e_phi = e_phi / m_ * (m_ - 1); } mint_base() :a(0) {} private: static long long e_phi; long long a; }; //mint_base型用の累乗関数 template<long long MOD>mint_base<MOD> m_pow(mint_base<MOD> x, long long n) { mint_base<MOD> res = 1; while (n > 0) { if (n & 1)res *= x; x *= x; n >>= 1; } return res; } //mint_baseの階乗計算 //O(x)時間が必要のため、fact_set関数を推奨する。 template<long long MOD>mint_base<MOD> fact(mint_base<MOD> x) { mint_base<MOD> res(1); for (long long i = 1; i <= (long long)x; ++i) { res *= i; } return res; } //mint_baseの階乗計算 //0からxまでの階乗をsetに出力する template<long long MOD>void fact_set(std::vector<mint_base<MOD>> &set, mint_base<MOD> x = mint_base<MOD>(-1)) { mint_base<MOD> res(1); set.push_back(1); for (long long i = 1; i <= (long long)x; ++i) { res *= i; set.push_back(res); } } template<long long MOD>long long mint_base<MOD>::e_phi = -1; //mint_base型のstreamへの出力 template<long long MOD> std::ostream& operator<<(std::ostream& os, mint_base<MOD> i) { os << (long long)i; return os; } //mint_base型のstreamからの入力 template<long long MOD> std::istream& operator >> (std::istream& is, mint_base<MOD>& i) { long long tmp; is >> tmp; i = tmp; return is; } typedef mint_base<> mint; vector<mint>infact; ll memo[1234][1234]; const ll MOD = 1000000007; ll dp(int i, int j) { if (i < 0)return 0; if (j == b + 1) { if (i != 0)return 0; return 1; } if (memo[i][j] >= 0)return memo[i][j]; ll ret = dp(i, j + 1); for (int a = c; a <= d; ++a) { if (i < 0 || i - j * a < 0 || j < 0)continue; mint mult = infact[i] * ~infact[i - j * a]; mult *= ~m_pow(infact[j], a); mult *= ~infact[a]; ret += dp(i - j * a, j + 1) * (ll)mult; ret %= MOD; } return memo[i][j] = ret; } int main(void) { memset(memo, 0xff, sizeof(memo)); fact_set(infact, mint(1234)); cin >> n >> a >> b >> c >> d; cout << dp(n, a) << endl; return 0; }
a.cc: In member function 'mint_base<MOD> mint_base<MOD>::operator~() const': a.cc:102:29: error: no matching function for call to 'm_pow(const long long int&, long long int)' 102 | return m_pow(a, (long long)e_phi - 1); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:36:41: note: candidate: 'template<long long int MOD> mint_base<MOD> m_pow(mint_base<MOD>, long long int)' 36 | template <long long MOD> mint_base<MOD> m_pow(mint_base<MOD> x, long long n); | ^~~~~ a.cc:36:41: note: template argument deduction/substitution failed: a.cc:102:29: note: mismatched types 'mint_base<MOD>' and 'long long int' 102 | return m_pow(a, (long long)e_phi - 1); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
s069725901
p03832
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> using namespace std; int n, a, b, c, d; using ll = long long; //負数がないMOD関数 inline long long imod(long long a, long long b) { return (a >= 0) ? (a % b) : (a % b + b); } //mint_base型用の累乗関数 template <long long MOD> class mint_base; template <long long MOD> mint_base<MOD> m_pow(mint_base<MOD> x, long long n); //mod計算を自動で行う整数テンプレートクラス template <long long MOD = 1000000007> class mint_base { public: mint_base<MOD> operator+(const mint_base<MOD> &other)const { return mint_base<MOD>(imod(a + other.a, MOD)); } mint_base<MOD> operator-(const mint_base<MOD> &other)const { return mint_base<MOD>(imod(a - other.a, MOD)); } mint_base<MOD> operator*(const mint_base<MOD> &other)const { return mint_base<MOD>(imod(a * other.a, MOD)); } mint_base<MOD> operator+=(const mint_base<MOD> &other) { a = imod(a + other.a, MOD); return mint_base<MOD>(a); } mint_base<MOD> operator-=(const mint_base<MOD> &other) { a = imod(a - other.a, MOD); return mint_base<MOD>(a); } mint_base<MOD> operator*=(const mint_base<MOD> &other) { a = imod(a * other.a, MOD); return mint_base<MOD>(a); } mint_base<MOD> operator+()const { return *this; } mint_base<MOD> operator-()const { return mint_base<MOD>(-a); } mint_base<MOD>& operator++() { *this += 1; return *this; } mint_base<MOD> operator++(int) { auto tmp = *this; *this += 1; return tmp; } mint_base<MOD>& operator--() { *this -= 1; return *this; } mint_base<MOD> operator--(int) { auto tmp = *this; *this -= 1; return tmp; } mint_base<MOD> operator~()const { return m_pow(mint(a), (long long)e_phi - 1); } mint_base<MOD>& operator=(const mint_base<MOD> &other) { a = other.a; return *this; } explicit operator long long()const { return a; } explicit operator int()const { return (int)a; } //無効な数値を指定された場合 static_assert(MOD >= 2, "MOD cannot be below 2."); mint_base(long long a_) :a(imod(a_, MOD)) { if (e_phi > 0)return; //オイラー値の導出 e_phi = MOD; long long m_ = MOD; for (int i = 2; i * i <= m_; ++i) { if (m_ % i == 0) { e_phi = e_phi / i * (i - 1); for (; m_ % i == 0; m_ /= i); } } if (m_ != 1)e_phi = e_phi / m_ * (m_ - 1); } mint_base() :a(0) {} private: static long long e_phi; long long a; }; //mint_base型用の累乗関数 template<long long MOD>mint_base<MOD> m_pow(mint_base<MOD> x, long long n) { mint_base<MOD> res = 1; while (n > 0) { if (n & 1)res *= x; x *= x; n >>= 1; } return res; } //mint_baseの階乗計算 //O(x)時間が必要のため、fact_set関数を推奨する。 template<long long MOD>mint_base<MOD> fact(mint_base<MOD> x) { mint_base<MOD> res(1); for (long long i = 1; i <= (long long)x; ++i) { res *= i; } return res; } //mint_baseの階乗計算 //0からxまでの階乗をsetに出力する template<long long MOD>void fact_set(std::vector<mint_base<MOD>> &set, mint_base<MOD> x = mint_base<MOD>(-1)) { mint_base<MOD> res(1); set.push_back(1); for (long long i = 1; i <= (long long)x; ++i) { res *= i; set.push_back(res); } } template<long long MOD>long long mint_base<MOD>::e_phi = -1; //mint_base型のstreamへの出力 template<long long MOD> std::ostream& operator<<(std::ostream& os, mint_base<MOD> i) { os << (long long)i; return os; } //mint_base型のstreamからの入力 template<long long MOD> std::istream& operator >> (std::istream& is, mint_base<MOD>& i) { long long tmp; is >> tmp; i = tmp; return is; } typedef mint_base<> mint; vector<mint>infact; ll memo[1234][1234]; const ll MOD = 1000000007; ll dp(int i, int j) { if (i < 0)return 0; if (j == b + 1) { if (i != 0)return 0; return 1; } if (memo[i][j] >= 0)return memo[i][j]; ll ret = dp(i, j + 1); for (int a = c; a <= d; ++a) { if (i < 0 || i - j * a < 0 || j < 0)continue; mint mult = infact[i] * ~infact[i - j * a]; mult *= ~m_pow(infact[j], a); mult *= ~infact[a]; ret += dp(i - j * a, j + 1) * (ll)mult; ret %= MOD; } return memo[i][j] = ret; } int main(void) { memset(memo, 0xff, sizeof(memo)); fact_set(infact, mint(1234)); cin >> n >> a >> b >> c >> d; cout << dp(n, a) << endl; return 0; }
a.cc: In member function 'mint_base<MOD> mint_base<MOD>::operator~() const': a.cc:101:30: error: there are no arguments to 'mint' that depend on a template parameter, so a declaration of 'mint' must be available [-fpermissive] 101 | return m_pow(mint(a), (long long)e_phi - 1); | ^~~~ a.cc:101:30: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) a.cc: In function 'int main()': a.cc:228:9: error: 'memset' was not declared in this scope 228 | memset(memo, 0xff, sizeof(memo)); | ^~~~~~ a.cc:20:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 19 | #include <queue> +++ |+#include <cstring> 20 | using namespace std; a.cc: In instantiation of 'mint_base<MOD> mint_base<MOD>::operator~() const [with long long int MOD = 1000000007]': a.cc:217:44: required from here 217 | mint mult = infact[i] * ~infact[i - j * a]; | ^ a.cc:101:34: error: expected primary-expression 101 | return m_pow(mint(a), (long long)e_phi - 1); | ~~~~^~~
s914577831
p03833
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) using namespace std; typedef pair<int,int> P; typedef long long int ll; #define dame { puts("-1"); return 0;} #define yn {puts("Yes");}else{puts("No");} const int MAX_N = 1 << 19; #define NUM 2147483647 int nn = 1; int data[MAX_N][210]; void init(int first_N){ nn = 1; if(first_N < 10) nn = 100; while(nn < first_N)nn *= 2; } // [left,right]の区間の値をvalueに更新する // update_(left,right,value,0,0,nn-1)のように呼ぶ void update_(int update_left,int update_right,int new_value,int node_id,int node_left,int node_right, int mm){ if(update_right < node_left || update_left > node_right)return; else if(update_left <= node_left && update_right >= node_right){ data[node_id][mm] = new_value; }else{ if(data[node_id][mm] >= 0){ data[2*node_id+1][mm] = data[node_id][mm]; data[2*node_id+2][mm] = data[node_id][mm]; data[node_id][mm] = -1; } update_(update_left,update_right,new_value,2*node_id+1,node_left,(node_left+node_right)/2,mm); update_(update_left,update_right,new_value,2*node_id+2,(node_left+node_right)/2+1,node_right,mm); } } // query_(ite,ite,0,0,nn-1)のように呼ぶ int query_(int search_left,int search_right,int node_id,int node_left,int node_right,int mm){ if(search_right < node_left || search_left > node_right){ return -1; }else if(node_left <= search_left && node_right >= search_right && data[node_id][mm] >= 0){ return data[node_id][mm]; }else{ int left = query_(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2,mm); int right = query_(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right,mm); return max(left,right); } } int main(){ int n, m; cin >> n >> m; init(n); ll a[n] = {}; srep(i,1,n)cin >> a[i]; ll b[n][m]; rep(i,n)rep(j,m)cin >> b[i][j]; ll sum[n] = {}; rep(i,n){ if(i>0)sum[i] += sum[i-1]; sum[i] += a[i]; } deque<int> que[m]; ll ans = 0; int now = n-1; drep(i,n){ // cout << endl; rep(j,m){ while(que[j].size()>0 && b[i][j] >= b[que[j][0]][j]){ que[j].pop_front(); } int r = n; if(que[j].size()>0){ r = que[j][0]; } update_(i,r-1,b[i][j],0,0,nn-1,j); que[j].push_front(i); } while(i<now){ ll bef = -(sum[now] - sum[i]); rep(j,m){ bef += query_(now,now,0,0,nn-1,j); // cout << query_(now,now,0,0,nn-1,j) << ' '; } // cout << endl; ll aft = -(sum[now-1] - sum[i]); rep(j,m) aft += query_(now-1,now-1,0,0,nn-1,j); // cout << i << ' ' << now << ' ' << bef << ' ' << aft << endl; if(aft >= bef){ now--; }else{ break; } } ll tmp = -(sum[now] - sum[i]); rep(j,m) tmp += query_(now,now,0,0,nn-1,j); ans = max(ans, tmp); } // cout << now << endl; // cout << m << endl; cout << ans << endl; return 0; }
a.cc: In function 'void update_(int, int, int, int, int, int, int)': a.cc:29:17: error: reference to 'data' is ambiguous 29 | data[node_id][mm] = new_value; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:16:5: note: 'int data [524288][210]' 16 | int data[MAX_N][210]; | ^~~~ a.cc:31:20: error: reference to 'data' is ambiguous 31 | if(data[node_id][mm] >= 0){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:16:5: note: 'int data [524288][210]' 16 | int data[MAX_N][210]; | ^~~~ a.cc:32:25: error: reference to 'data' is ambiguous 32 | data[2*node_id+1][mm] = data[node_id][mm]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:16:5: note: 'int data [524288][210]' 16 | int data[MAX_N][210]; | ^~~~ a.cc:32:49: error: reference to 'data' is ambiguous 32 | data[2*node_id+1][mm] = data[node_id][mm]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:16:5: note: 'int data [524288][210]' 16 | int data[MAX_N][210]; | ^~~~ a.cc:33:25: error: reference to 'data' is ambiguous 33 | data[2*node_id+2][mm] = data[node_id][mm]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:16:5: note: 'int data [524288][210]' 16 | int data[MAX_N][210]; | ^~~~ a.cc:33:49: error: reference to 'data' is ambiguous 33 | data[2*node_id+2][mm] = data[node_id][mm]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:16:5: note: 'int data [524288][210]' 16 | int data[MAX_N][210]; | ^~~~ a.cc:34:25: error: reference to 'data' is ambiguous 34 | data[node_id][mm] = -1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:16:5: note: 'int data [524288][210]' 16 | int data[MAX_N][210]; | ^~~~ a.cc: In function 'int query_(int, int, int, int, int, int)': a.cc:45:76: error: reference to 'data' is ambiguous 45 | }else if(node_left <= search_left && node_right >= search_right && data[node_id][mm] >= 0){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:16:5: note: 'int data [524288][210]' 16 | int data[MAX_N][210]; | ^~~~ a.cc:46:24: error: reference to 'data' is ambiguous 46 | return data[node_id][mm]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _
s509620102
p03833
C++
#include <iostream> #include <algorithm> #include <utility> #include <numeric> #include <vector> #include <array> #include <queue> template <class T, class U> inline bool chmin(T &lhs, const U &rhs) { if (lhs > rhs) { lhs = rhs; return true; } return false; } template <class T, class U> inline bool chmax(T &lhs, const U &rhs) { if (lhs < rhs) { lhs = rhs; return true; } return false; } struct range { using itr = int64_t; struct iterator { itr i; constexpr iterator(itr i_): i(i_) { } constexpr void operator ++ () { ++i; } constexpr itr operator * () const { return i; } constexpr bool operator != (iterator x) const { return i != x.i; } }; const iterator l, r; constexpr range(itr l_, itr r_): l(l_), r(std::max(l_, r_)) { } constexpr iterator begin() const { return l; } constexpr iterator end() const { return r; } }; struct revrange { using itr = int64_t; struct iterator { itr i; constexpr iterator(itr i_): i(i_) { } constexpr void operator ++ () { --i; } constexpr itr operator * () const { return i; } constexpr bool operator != (iterator x) const { return i != x.i; } }; const iterator l, r; constexpr revrange(itr l_, itr r_): l(l_ - 1), r(std::max(l_, r_) - 1) { } constexpr iterator begin() const { return r; } constexpr iterator end() const { return l; } }; template <class T> class disjoint_sparse_table { public: using value_type = typename T::value_type; static inline const auto op = typename T::value_operation(); private: std::vector<std::vector<value_type>> table; public: disjoint_sparse_table() = default; disjoint_sparse_table(const std::vector<value_type> &table_) { build(table_); } void build(const std::vector<value_type> &table_) { int height = 0, size = table_.size(); while ((1 << height) < size) ++height; if (size == 1) ++height; table.assign(height, std::vector<value_type>(size)); for (int i = 0; i < size; ++i) { table[0][i] = table_[i]; } for (int i = 1; i < height; ++i) { int bit = (1 << i); for (int l = 0; l < size; l += (bit << 1)) { int m = (l + bit < size ? l + bit : size); table[i][m - 1] = table_[m - 1]; for (int j = m - 2; j >= l; --j) { table[i][j] = op(table_[j], table[i][j + 1]); } if (m >= size) continue; int r = (m + bit < size ? m + bit : size); table[i][m] = table_[m]; for (int j = m + 1; j < r; ++j) { table[i][j] = op(table[i][j - 1], table_[j]); } } } } value_type fold(int l, int r) const { if (l >= --r) return table[0][l]; int h = 31 - __builtin_clz(l ^ r); return op(table[h][l], table[h][r]); } }; using i32 = int32_t; using i64 = int64_t; using u32 = uint32_t; using u64 = uint64_t; constexpr i32 inf32 = (i32(1) << 30) - 1; constexpr i64 inf64 = (i64(1) << 62) - 1; struct range_max { using value_type = i32; struct value_operation { value_type operator () (const value_type &x, const value_type &y) const { return std::max(x, y); } }; }; #ifdef LOCAL #include <iostream> #include <iomanip> #include <fstream> #include <sstream> #include <ctime> struct debug_support { std::ofstream file; std::stringstream to_str_helper; const std::clock_t start_time; debug_support(): start_time(std::clock()) { file.open("debug.txt"); if (!file.is_open()) { std::cerr << "\033[31m failed to open the file 'debug.txt' \033[0m \n"; std::exit(EXIT_FAILURE); } file << "\n<debug output file>\n\n"; to_str_helper << std::boolalpha; to_str_helper << std::fixed; } ~debug_support() { file.close(); } std::string to_str(char c) { return std::string("'") + c + "'"; } std::string to_str(const std::string &s) { return std::string("\"") + s + "\""; } std::string to_str(const char *s) { return std::string("\"") + s + "\""; } template <class T, class U> std::string to_str(const std::pair<T, U> &x) { return "(" + to_str(x.first) + ", " + to_str(x.second) + ")"; } template <class T, size_t I> typename std::enable_if<(I + 1 == std::tuple_size<T>::value), std::string>::type to_str_tuple(const T &x) { return to_str(std::get<I>(x)); } template <class T, size_t I> typename std::enable_if<(I + 1 != std::tuple_size<T>::value), std::string>::type to_str_tuple(const T &x) { return to_str(std::get<I>(x)) + ", " + to_str_tuple<T, I + 1>(x); } template <class... Args> std::string to_str(const std::tuple<Args...> &x) { return "(" + to_str_tuple<std::tuple<Args...>, 0>(x) + ")"; } template <class T> std::string to_str(const T &x) { to_str_helper << x; std::string s; std::getline(to_str_helper, s); to_str_helper.str(""); to_str_helper.clear(std::stringstream::goodbit); return s; } template <class T, class U, class... Args> std::string to_str(const T &x, const U &y, const Args&... args) { return x == y ? "__" : to_str(x, args...); } template <class T> void print(const T &x) { file << to_str(x) << std::endl; } template <class T, class... Args> void print(const T &x, const Args&... args) { file << to_str(x) << ", "; print(args...); } template<typename T, typename _ = void> struct has_iterator: public std::false_type {}; template<typename T> struct has_iterator<T, typename std::conditional<false, typename T::iterator, void>::type>: public std::true_type {}; template <class T, class... Args> typename std::enable_if<has_iterator<typename T::value_type>::value == true, std::string>::type to_str_container(const T &x, const Args&... args) { std::string s; for (const auto &v: x) { s += to_str_container(v, args...); } return s + '\n'; } template <class T, class... Args> typename std::enable_if<has_iterator<typename T::value_type>::value == false, std::string>::type to_str_container(const T &x, const Args&... args) { std::string s = "{ "; bool f = false; for (const auto &v: x) { if (f) s += ", "; f = true; s += to_str(v, args...); } return s + " }\n"; } template <class T, class... Args> void print_container(const T &x, const Args&... args) { file << to_str_container(x, args...) << std::flush; } void show_c_impl(const std::string &s) { auto i = s.begin(); while (i != s.end() && *i != ',') ++i; file << " [" << std::string(s.begin(), i) << "]"; if (i != s.end()) file << " (ignore" << std::string(i + 1, s.end()) << ")"; file << ":\n"; } } debugger; #define show(...)\ do {\ debugger.file << "<line:" << std::setw(4) << __LINE__ << "> [";\ debugger.file << #__VA_ARGS__ << "]: ";\ debugger.print(__VA_ARGS__);\ } while (false) #define show_c(...)\ do {\ debugger.file << "\n<line:" << std::setw(4) << __LINE__ << ">";\ debugger.show_c_impl(#__VA_ARGS__);\ debugger.print_container(__VA_ARGS__);\ debugger.file << std::endl;\ } while (false) #define showtime()\ do {\ double d = static_cast<double>(std::clock() - debugger.start_time);\ debugger.file << "<line:" << std::setw(4) << __LINE__ << ">";\ debugger.file << " elapsed time: " << d * 1000 / CLOCKS_PER_SEC << "ms" << std::endl;\ } while (false) #else #define show(...) ((void) 0) #define show_c(...) ((void) 0) #define showtime() ((void) 0) #endif int main() { size_t N, M; std::cin >> N >> M; std::vector<i32> A(N); for (auto i: range(1, N)) { std::cin >> A[i]; A[i] += A[i - 1]; } std::vector<std::vector<i32>> B_impl(M, std::vector<i32>(N)); for (auto i: range(0, N)) { for (auto j: range(0, M)) { std::cin >> B_impl[j][i]; } } std::vector<disjoint_sparse_table<range_max>> B(M); for (auto i: range(0, M)) { B[i].build(B_impl[i]); } struct query { i32 l, r, d, u; }; std::queue<query> que; que.push(query{ 0, N, 0, N - 1 }); i64 ans = -inf64; while (!que.empty()) { auto q = que.front(); que.pop(); i32 ml = (q.l + q.r) / 2; i64 max = -inf64; i32 mr = ml; for (auto i: range(std::max(ml, q.d), q.u + 1)) { i64 sum = A[ml] - A[i]; for (auto j: range(0, M)) { sum += B[j].fold(ml, i + 1); } show(ml, i, A[i], A[ml], sum); if (chmax(max, sum)) { mr = i; } } chmax(ans, max); if (q.r - q.l > 1) { que.push(query{ q.l, ml, q.d, mr }); que.push(query{ ml, q.r, mr, q.u }); } } std::cout << ans << '\n'; return 0; }
a.cc:102:13: error: 'uint32_t' does not name a type 102 | using u32 = uint32_t; | ^~~~~~~~ a.cc:9:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 8 | #include <queue> +++ |+#include <cstdint> 9 | a.cc:103:13: error: 'uint64_t' does not name a type 103 | using u64 = uint64_t; | ^~~~~~~~ a.cc:103:13: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc: In function 'int main()': a.cc:285:22: warning: narrowing conversion of 'N' from 'size_t' {aka 'long unsigned int'} to 'i32' {aka 'int'} [-Wnarrowing] 285 | que.push(query{ 0, N, 0, N - 1 }); | ^ a.cc:285:30: warning: narrowing conversion of '(N - 1)' from 'size_t' {aka 'long unsigned int'} to 'i32' {aka 'int'} [-Wnarrowing] 285 | que.push(query{ 0, N, 0, N - 1 }); | ~~^~~
s756382918
p03833
C++
5 3 1 2 3 4 10 1 1 1 1 1 1 10 1 1 1 1 1 1 10
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5 3 | ^
s044032444
p03833
C++
#include <bits/stdc++.h> using namespace std; // template {{{ #define pb push_back #define eb emplace_back #define mp make_pair #define mt make_tuple #define lb lower_bound #define ub upper_bound #define f first #define s second #define resz resize #define sz(x) int((x).size()) #define all(x) (x).begin(), (x).end() #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define F0R(i, a) for (int i = 0; i < (a); i++) #define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--) #define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--) #define trav(a, x) for (auto& a : x) #define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; }) using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using vb = vector<bool>; using vd = vector<double>; using vs = vector<string>; using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using vpii = vector<pii>; using vvpii = vector<vpii>; using vpll = vector<pll>; using vvpll = vector<vpll>; using vpdd = vector<pdd>; using vvpdd = vector<vpdd>; template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); } template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); } mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); namespace __input { template<class T1, class T2> void re(pair<T1,T2>& p); template<class T> void re(vector<T>& a); template<class T, size_t SZ> void re(array<T,SZ>& a); template<class T> void re(T& x) { cin >> x; } void re(double& x) { string t; re(t); x = stod(t); } template<class Arg, class... Args> void re(Arg& first, Args&... rest) { re(first); re(rest...); } template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); } template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); } template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); } } using namespace __input; namespace __output { template<class T1, class T2> void pr(const pair<T1,T2>& x); template<class T, size_t SZ> void pr(const array<T,SZ>& x); template<class T> void pr(const vector<T>& x); template<class T> void pr(const deque<T>& x); template<class T> void pr(const set<T>& x); template<class T1, class T2> void pr(const map<T1,T2>& x); template<class T> void pr(const T& x) { cout << x; } template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) { pr(first); pr(rest...); } template<class T1, class T2> void pr(const pair<T1,T2>& x) { pr("{",x.f,", ",x.s,"}"); } template<class T, bool pretty = true> void prContain(const T& x) { if (pretty) pr("{"); bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0; if (pretty) pr("}"); } template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); } template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); } template<class T> void pr(const vector<T>& x) { prContain(x); } template<class T> void pr(const deque<T>& x) { prContain(x); } template<class T> void pr(const set<T>& x) { prContain(x); } template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); } void ps() { pr("\n"); } template<class Arg> void ps(const Arg& first) { pr(first); ps(); } template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) { pr(first," "); ps(rest...); } } using namespace __output; #define TRACE(x) x #define __pn(x) pr(#x, " = ") #define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush namespace __algorithm { template<typename T> void dedup(vector<T>& v) { sort(all(v)); v.erase(unique(all(v)), v.end()); } template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) { auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end(); } template<typename T> size_t index(vector<T>& v, const T& x) { auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin(); } template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) { vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r; } template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) { vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r; } } using namespace __algorithm; struct monostate { friend istream& operator>>(istream& is, const __attribute__((unused))monostate& ms) { return is; } friend ostream& operator<<(ostream& os, const __attribute__((unused))monostate& ms) { return os; } } ms; template<typename W=monostate> struct wedge { int u, v, i; W w; wedge<W>(int _u=-1, int _v=-1, int _i=-1) : u(_u), v(_v), i(_i) {} int operator[](int loc) const { return u ^ v ^ loc; } friend void re(wedge& e) { re(e.u, e.v, e.w); --e.u, --e.v; } friend void pr(const wedge& e) { pr(e.u, "<-", e.w, "->", e.v); } }; namespace __io { void setIn(string s) { freopen(s.c_str(),"r",stdin); } void setOut(string s) { freopen(s.c_str(),"w",stdout); } void setIO(string s = "") { ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(15); if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } } } using namespace __io; // }}} // sparse_table {{{ template<typename T, typename F> struct sparse_table { int SZ; F tt; // idempotent vector<T> table; T& entry(int l, int i) { return table[l * SZ + i]; } const T& entry(int l, int i) const { return table[l * SZ + i]; } sparse_table() {} sparse_table(const vector<T>& elts, F _tt) : SZ(sz(elts)), tt(_tt) { const int L = 32 - __builtin_clz(max(SZ - 1, 1)); table.resize(L * SZ); copy(all(elts), table.begin()); for (int l = 0; l + 1 < L; l++) { for (int i = 0; i < SZ; i++) { entry(l + 1, i) = entry(l, i); if (i + (1 << l) < SZ) entry(l + 1, i) = tt(entry(l + 1, i), entry(l, i + (1 << l))); } } } // Accumulates the elements at indices in [i, j) in O(1) T operator()(int i, int j) const { assert(0 <= i && i < j && j <= SZ); int l = j - i - 1 ? 31 - __builtin_clz(j - i - 1) : 0; return tt(entry(l, i), entry(l, j - (1 << l))); } }; // }}} int main() { setIO(); int N, M; re(N, M); vi dist(N - 1); re(dist); vvi tval(M, vi(N)); F0R (i, N) F0R (t, M) re(tval[t][i]); auto MAX = [](int a, int b){ return max(a, b); }; vector<sparse_table<int, decltype(MAX)>> tables; F0R (t, M) tables.pb(sparse_table(tval[t], MAX)); vll locs = prefixes(dist, 0ll, plus<int>()); ll ans = 0; F0R (i, N) FOR (j, i, N) { ll cand = -(locs[j] - locs[i]); F0R (t, M) cand += tables[t](i, j+1); ckmax(ans, cand); } ps(ans); // did you check N=1? did you mix up N,M? return 0; }
a.cc:134:21: error: reference to 'monostate' is ambiguous 134 | template<typename W=monostate> struct wedge { | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80, from a.cc:1: /usr/include/c++/14/variant:1237:10: note: candidates are: 'struct std::monostate' 1237 | struct monostate { }; | ^~~~~~~~~ a.cc:129:8: note: 'struct monostate' 129 | struct monostate { | ^~~~~~~~~
s054208306
p03833
C++
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, int> pii; #define fi first #define se second #define mp make_pair #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count()); const int N = 5009; struct Node{ ll value; ll lazy; }; Node T[N * 4 + 512]; void push(int node, int cl, int cr){ T[node].value += T[node].lazy; if(cl != cr){ T[node * 2].lazy += T[node].lazy; T[node * 2 + 1].lazy += T[node].lazy; } T[node].lazy = 0; } void update(int node, int cl, int cr, int tl, int tr, ll vl){ push(node, cl, cr); if(cr < tl) return; if(cl > tr) return; if(cl >= tl && cr <= tr){ T[node].lazy = vl; push(node, cl, cr); return; } int mid = (cl + cr) / 2; update(node * 2, cl, mid, tl, tr, vl); update(node * 2 + 1, mid + 1, cr, tl, tr, vl); T[node].value = max(T[node * 2].value, T[node * 2 + 1].value); } const ll inf = (ll)1e16; int query(int node, int cl, int cr, int tl, int tr){ push(node, cl, cr); if(cr < tl) return -inf; if(cl > tr) return -inf; if(cl >= tl && cr <= tr) return T[node].value; int mid = (cl + cr) / 2; return max(query(node * 2, cl, mid, tl, tr), query(node * 2 + 1, mid + 1, cr, tl, tr)); } const int M = 209; ll c[N][M]; ll a[M]; stack<pii> ff[M]; int main(){ fastIO; int n, m; cin >> n >> m; for(int i = 2; i <= n; i ++ ) cin >> a[i]; for(int i = 1; i <= n ; i ++ ){ for(int j = 1; j <= m ; j ++ ) cin >> c[i][j]; } ll res = 0; int id; for(int i = 1; i <= n; i ++ ){ if(i) update(1, 1, n, 1, i - 1, -a[i]); for(int j = 1; j <= m ; j ++ ){ id = i; update(1, 1, n, id, id, c[i][j]); while(!ff[j].empty() && c[i][j] > ff[j].top().fi){ update(1, 1, n, ff[j].top().se, id - 1, c[i][j] - ff[j].top().fi); id = ff[j].top().se; ff[j].pop(); } ff[j].push(mp(c[i][j], i)); } res = max(res, query(1, 1, n, 1, i)); } cout << res << "\n"; return 0; }
a.cc: In function 'int query(int, int, int, int, int)': a.cc:56:16: warning: overflow in conversion from 'long long int' to 'int' changes value from '-10000000000000000' to '-1874919424' [-Woverflow] 56 | return -inf; | ^~~~ a.cc:58:16: warning: overflow in conversion from 'long long int' to 'int' changes value from '-10000000000000000' to '-1874919424' [-Woverflow] 58 | return -inf; | ^~~~ a.cc: In function 'int main()': a.cc:95:18: error: no matching function for call to 'max(ll&, int)' 95 | res = max(res, query(1, 1, n, 1, i)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:95:18: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 95 | res = max(res, query(1, 1, n, 1, i)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:95:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 95 | res = max(res, query(1, 1, n, 1, i)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s550815180
p03833
C++
#include <vector> #include <cstdio> #include <stack> #include <string> using namespace std; const int S = (1<<20)+5; char buf[S],*H,*T; inline char Get() { if(H==T) T=(H=buf)+fread(buf,1,S,stdin); if(H==T) return -1;return *H++; } inline int read() { int x=0;char c=Get(); while(!isdigit(c)) c=Get(); while(isdigit(c)) x=(x*10)+c-'0',c=Get(); return x; } inline long long relo() { long long x=0;char c=Get(); while(!isdigit(c)) c=Get(); while(isdigit(c)) x=(x*10)+c-'0',c=Get(); return x; } int main(){ long long marxism = -10000000000000; vector<stack<int> > ms; vector<long long> cf; vector< vector<int> > tickets; int shop = read(),tic = read(); cf.reserve(shop-1); tickets.assign(tic,vector<int>()); ms.assign(tic,stack<int>()); for (register int i = 1;i<shop;++i){ long long temp = relo(); cf.push_back(-temp); } for (register int i = 0;i<shop;++i){ for (register int j = 0;j<tic;++j){ int temp=read(); tickets[j].push_back(temp); } } for (register int i = shop-1;i>=0;--i){ long long result = 0; for (register int j = 0;j<ms.size();++j){ int cur = tickets[j][i],prev = 0; while (!ms[j].empty()){ if (cur>tickets[j][ms[j].top()]){ cf[ms[j].top()-1] -=(tickets[j][ms[j].top()]-prev); prev = tickets[j][ms[j].top()]; ms[j].pop(); } else{ cf[ms[j].top()-1] -=(cur-prev); break; } } result += cur; if (i) cf[i-1] +=cur; ms[j].push(i); } marxism = max(marxism,result); for (register int j = i;j<shop-1;++j){ result += dis[j]; marxism = max(marxism,result); } } printf("%lld",marxism); }
a.cc: In function 'int main()': a.cc:36:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 36 | for (register int i = 1;i<shop;++i){ | ^ a.cc:40:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 40 | for (register int i = 0;i<shop;++i){ | ^ a.cc:41:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 41 | for (register int j = 0;j<tic;++j){ | ^ a.cc:46:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 46 | for (register int i = shop-1;i>=0;--i){ | ^ a.cc:48:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 48 | for (register int j = 0;j<ms.size();++j){ | ^ a.cc:66:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 66 | for (register int j = i;j<shop-1;++j){ | ^ a.cc:67:24: error: 'dis' was not declared in this scope; did you mean 'div'? 67 | result += dis[j]; | ^~~ | div
s890890336
p03833
C++
#include <vector> #include <cstdio> #include <stack> #include <string> #define help cout<<"I don't want to die!"<<endl; using namespace std; inline char Get() { if(H==T) T=(H=buf)+fread(buf,1,S,stdin); if(H==T) return -1;return *H++; } inline int read() { int x=0;char c=Get(); while(!isdigit(c)) c=Get(); while(isdigit(c)) x=x*10+c-'0',c=Get(); return x; } int main(){ long long marxism = -10000000000000; vector<stack<int> > ms;//monotonic stack; vector<int> dis; vector<long long> cf;//distance between shops,0:0->1;chafenshuzu vector< vector<int> > tickets; int shop = read(),tic = read(); /*initialization*/ cf.assign(shop-1,0); tickets.assign(tic,vector<int>()); ms.assign(tic,stack<int>()); dis.reserve(shop); /*done*/ for (register int i = 1;i<shop;++i){ int temp = read(); dis.push_back(-temp); } //convert the distance into "chafen" form; for (register int i = 0;i<shop;++i){ for (register int j = 0;j<tic;++j){ int temp=read(); tickets[j].push_back(temp); } } //get the tickets'value //tickets[i][j]:the value of ticket i in the shop j for (register int i = shop-1;i>=0;--i){ long long result = 0; //enumerate start point from tail to head; for (register int j = 0;j<ms.size();++j){ //process the "chafenshuzu" of each ticket. int cur = tickets[j][i],prev = 0;//prev is the previous shop,used to determine how large to shrink in the next shop; while (!ms[j].empty()){ if (cur>tickets[j][ms[j].top()]){//the one we have is greater than the top of the stack; cf[ms[j].top()-1] -=(tickets[j][ms[j].top()]-prev); prev = tickets[j][ms[j].top()]; ms[j].pop(); } else{ cf[ms[j].top()-1] -=(cur-prev); break; } } result += cur; if (i) cf[i-1] +=cur; ms[j].push(i); } //update the 'chafen' completed; marxism = max(marxism,result); for (register int j = i;j<shop-1;++j){ result += dis[j]; result += cf[j]; marxism = max(marxism,result); } } printf("%lld",marxism); }
a.cc: In function 'char Get()': a.cc:9:8: error: 'H' was not declared in this scope 9 | if(H==T) T=(H=buf)+fread(buf,1,S,stdin); | ^ a.cc:9:11: error: 'T' was not declared in this scope 9 | if(H==T) T=(H=buf)+fread(buf,1,S,stdin); | ^ a.cc:9:19: error: 'buf' was not declared in this scope 9 | if(H==T) T=(H=buf)+fread(buf,1,S,stdin); | ^~~ a.cc:9:36: error: 'S' was not declared in this scope 9 | if(H==T) T=(H=buf)+fread(buf,1,S,stdin); | ^ a.cc:10:8: error: 'H' was not declared in this scope 10 | if(H==T) return -1;return *H++; | ^ a.cc:10:11: error: 'T' was not declared in this scope 10 | if(H==T) return -1;return *H++; | ^ a.cc:10:32: error: 'H' was not declared in this scope 10 | if(H==T) return -1;return *H++; | ^ a.cc: In function 'int main()': a.cc:32:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 32 | for (register int i = 1;i<shop;++i){ | ^ a.cc:37:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 37 | for (register int i = 0;i<shop;++i){ | ^ a.cc:38:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 38 | for (register int j = 0;j<tic;++j){ | ^ a.cc:45:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 45 | for (register int i = shop-1;i>=0;--i){ | ^ a.cc:48:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 48 | for (register int j = 0;j<ms.size();++j){ | ^ a.cc:68:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 68 | for (register int j = i;j<shop-1;++j){ | ^
s171191419
p03833
C++
N, M = gets.split.map(&:to_i) as = [0] + gets.split.map(&:to_i) + [0] (1...N).each do |i| as[i] += as[i-1] end bs = N.times.map{gets.split.map(&:to_i)} ans = 0 N.times do |l| (l...N).each do |r| result = as[l] - as[r] M.times do |j| result += (l..r).map{|i| bs[i][j]}.max end ans = [ans, result].max end end puts ans
a.cc:3:2: error: too many decimal points in number 3 | (1...N).each do |i| | ^~~~~ a.cc:1:1: error: 'N' does not name a type 1 | N, M = gets.split.map(&:to_i) | ^ a.cc:8:1: error: 'ans' does not name a type 8 | ans = 0 | ^~~ a.cc:13:47: error: expected unqualified-id before '.' token 13 | result += (l..r).map{|i| bs[i][j]}.max | ^
s072205405
p03833
Java
import java.io.*; import java.util.*; import jdk.internal.jline.internal.InputStreamReader; /* * Heart beats fast * Colors and promises * How to be brave * How can I love when I am afraid... */ public class Main { static class segtree { int n; int[][] tr; void build() { for(int i=n-1;i>0;i--) if(tr[0][i<<1]>tr[0][(i<<1)|1]) { tr[0][i]=tr[0][i<<1]; tr[1][i]=tr[1][i<<1]; } else { tr[0][i]=tr[0][(i<<1)|1]; tr[1][i]=tr[1][(i<<1)|1]; } } int[] query(int l,int r) { r++; // both are inclusive int[] res=new int[2]; for(l+=n,r+=n;l<r;l>>=1,r>>=1) { if(l%2!=0) { if(tr[0][l]>res[0]) { res[0]=tr[0][l]; res[1]=tr[1][l]; } l++; } if(r%2!=0) { r--; if(tr[0][r]>res[0]) { res[0]=tr[0][r]; res[1]=tr[1][r]; } } } return res; } } public static void main(String[]args) throws Exception { int n=ni(),m=ni(); long[]d=new long[n]; for(int i=1; i<n; i++) d[i]=d[i-1]+ni(); int[][]b=new int[n][m]; for(int i=0; i<n; i++) for(int j=0; j<m; j++) b[i][j]=ni(); long[][]grid=new long[n+1][n+1]; segtree a=new segtree(); a.tr=new int[2][2*n]; a.n=n; deque hol=new deque(); deque hor=new deque(); int l,r; for(int i=0; i<m; i++) { for(int j=0; j<n; j++) { a.tr[0][j+n]=b[j][i]; a.tr[1][j+n]=j; } a.build(); hol.add(0); hor.add(n-1); while(hol.notempty()) { l=hol.poll(); r=hor.poll(); if(l==r) { grid[l][l]+=b[l][i]; grid[l+1][l+1]+=b[l][i]; grid[l+1][l]-=b[l][i]; grid[l][l+1]-=b[l][i]; } else if(l<r) { int[]te=a.query(l,r); grid[l][te[1]]+=te[0]; grid[te[1]+1][r+1]+=te[0]; grid[l][r+1]-=te[0]; grid[te[1]+1][te[1]]-=te[0]; hol.add(l); hol.add(te[1]+1); hor.add(te[1]-1); hor.add(r); } } } for(int i=0; i<n; i++) for(int j=1; j<n; j++) grid[i][j]+=grid[i][j-1]; for(int i=1; i<n; i++) for(int j=0; j<n; j++) grid[i][j]+=grid[i-1][j]; long ans=0; for(int i=0; i<n; i++) for(int j=i; j<n; j++) ans=Math.max(ans,grid[i][j]+d[i]-d[j]); System.out.println(ans); } /////////////////////////////////////////// /////////////////////////////////////////// ///template from here // static final int mod=998_244_353; static final int mod=1000_000_007; static final double eps=1e-7; static final long inf=1000_000_000_000_000_000L; static class pair { int a,b; pair(){} pair(int c,int d){a=c;b=d;} @Override public int hashCode() { return (a+" "+b).hashCode(); } public boolean equals(Object c) { return (a==(((pair)c).a)&&b==(((pair)c).b)); } } public static void sort(int[][]a) { Arrays.sort(a, new Comparator<int[]>() { public int compare(int[]a,int[]b) { if(a[0]>b[0]) return 1; if(a[0]<b[0]) return -1; return 0; } }); } static interface combiner { public int combine(int a, int b); } static void pr(Object a){output.append(a+"\n");} static void pr(){output.append("\n");} static void p(Object a){output.append(a);} static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");} static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");} static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");} static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");} static void sop(Object a){System.out.println(a);} static void flush(){System.out.print(output);output=new StringBuilder();} static int ni(){return Integer.parseInt(in.next());} static long nl(){return Long.parseLong(in.next());} static String ns(){return in.next();} static double nd(){return Double.parseDouble(in.next());} static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;} static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;} static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;} static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;} static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;} static Reader in=new Reader(); static StringBuilder output=new StringBuilder(); static Random rn=new Random(); static void reverse(int[]a){for(int i=0; i<a.length/2; i++){a[i]^=a[a.length-i-1];a[a.length-i-1]^=a[i];a[i]^=a[a.length-i-1];}} static int log2n(long a) { int te=0; while(a>0) { a>>=1; ++te; } return te; } static class vectorl implements Iterable<Long> { long a[]; int size; vectorl(){a=new long[10];size=0;} vectorl(int n){a=new long[n];size=0;} public void add(long b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;} public void sort(){Arrays.sort(a, 0, size);} public void sort(int l, int r){Arrays.sort(a, l, r);} @Override public Iterator<Long> iterator() { Iterator<Long> hola=new Iterator<Long>() { int cur=0; @Override public boolean hasNext() { return cur<size; } @Override public Long next() { return a[cur++]; } }; return hola; } } static class vector implements Iterable<Integer> { int a[],size; vector(){a=new int[10];} vector(int n){a=new int[n];} public void add(int b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;} public void sort(){Arrays.sort(a, 0, size);} public void sort(int l, int r){Arrays.sort(a, l, r);} @Override public Iterator<Integer> iterator() { Iterator<Integer> hola=new Iterator<Integer>() { int cur=0; @Override public boolean hasNext() { return cur<size; } @Override public Integer next() { return a[cur++]; } }; return hola; } } static class deque { int a[]; int head,tail; deque(){a=new int[8];} void clear() { head=0;tail=0; } void add(int i) { head=(head+1)&(a.length-1); if(tail==head) { int[]b=new int[2*a.length]; System.arraycopy(a, tail, b, 0, a.length-tail); System.arraycopy(a, 0, b, a.length-tail, head); tail=0; a=b; head=(a.length>>>1); } a[(head-1)&(a.length-1)]=i; } int poll() { tail=(tail+1)&(a.length-1); return a[(tail-1)&(a.length-1)]; } boolean notempty() { return head!=tail; } } static void exit(){System.out.print(output);System.exit(0);} static int min(int... a){int min=a[0];for(int i:a)min=Math.min(min, i);return min;} static int max(int... a){int max=a[0];for(int i:a)max=Math.max(max, i);return max;} static int gcd(int... a){int gcd=a[0];for(int i:a)gcd=gcd(gcd, i);return gcd;} static long min(long... a){long min=a[0];for(long i:a)min=Math.min(min, i);return min;} static long max(long... a){long max=a[0];for(long i:a)max=Math.max(max, i);return max;} static long gcd(long... a){long gcd=a[0];for(long i:a)gcd=gcd(gcd, i);return gcd;} static String pr(String a, long b){String c="";while(b>0){if(b%2==1)c=c.concat(a);a=a.concat(a);b>>=1;}return c;} static long powm(long a, long b, long mod2){long an=1;long c=a%mod2;while(b>0){if(b%2==1)an=(an*c)%mod2;c=(c*c)%mod2;b>>=1;}return an;} static long pow(long a, long b){long an=1;long c=a;while(b>0){if(b%2==1)an*=c;c*=c;b>>=1;}return an;} static int gcd(int a, int b){if(b==0)return a;return gcd(b, a%b);} static long gcd(long a, long b){if(b==0)return a;return gcd(b, a%b);} static class Reader{ public BufferedReader reader; public StringTokenizer tokenizer; public Reader() { reader = new BufferedReader(new InputStreamReader(System.in)); 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(); } } }
Main.java:3: error: package jdk.internal.jline.internal does not exist import jdk.internal.jline.internal.InputStreamReader; ^ 1 error
s046146730
p03833
C++
#include<bits/stdc++.h> #define ll long long using namespace std; int getint() { int i=0,f=1;char c; for(c=getchar();(c!='-')&&(c<'0'||c>'9');c=getchar()); if(c=='-')c=getchar(),f=-1; for(;c>='0'&&c<='9';c=getchar())i=(i<<3)+(i<<1)+c-'0'; return i*f; } const int N=200005,mod=1e9+7; const ll INF=1e18; int n,m,A,B,q[N]; ll f[N<<2],g[N<<2],h[N<<2],tag[N<<2]; void add(int k,ll v){if(f[k]!=INF)f[k]+=v,g[k]+=v,h[k]+=v,tag[k]+=v;} void pushdown(int k){add(k<<1,tag[k]),add(k<<1|1,tag[k]);tag[k]=0;} void update(int k) { f[k]=min(f[k<<1],f[k<<1|1]); g[k]=min(g[k<<1],g[k<<1|1]); h[k]=min(h[k<<1],h[k<<1|1]); } void build(int k,int l,int r) { f[k]=g[k]=h[k]=INF; if(l==r)return; int mid=l+r>>1; build(k<<1,l,mid),build(k<<1|1,mid+1,r); } void chkmin(int k,int l,int r,int p,ll v) { if(l==r) { if(v<f[k])f[k]=v,g[k]=v-l,h[k]=v+l; return; } if(tag[k])pushdown(k); int mid=l+r>>1; p<=mid?chkmin(k<<1,l,mid,p,v):chkmin(k<<1|1,mid+1,r,p,v); update(k); } ll query(int k,int l,int r,int x,int y,int op) { if(x>y)return INF; if(x<=l&&r<=y)return op?h[k]:g[k]; if(tag[k])pushdown(k); int mid=l+r>>1; if(y<=mid)return query(k<<1,l,mid,x,y,op); else if(x>mid)return query(k<<1|1,mid+1,r,x,y,op); else return min(query(k<<1,l,mid,x,mid,op),query(k<<1|1,mid+1,r,mid+1,y,op)); } int main() { //freopen("lx.in","r",stdin); n=getint(),m=getint(),A=getint(),B=getint(); build(1,1,n); for(int i=1;i<=m;i++)q[i]=getint(); q[0]=B;chkmin(1,1,n,A,0); for(int i=1;i<=m;i++) { ll tmp=min(query(1,1,n,1,q[i],0)+q[i],query(1,1,n,q[i]+1,n,1)-q[i]); add(1,abs(q[i]-q[i-1]));chkmin(1,1,n,q[i-1],tmp); } cout<<f[1]<<'\n'; return 0; } --------------------- 本文来自 cdsszjj 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/cdsszjj/article/details/80291399?utm_source=copy
a.cc:69:1: error: expected unqualified-id before '--' token 69 | --------------------- | ^~
s772983203
p03833
C++
#include<cstdio> #include<algorithm> using namespace std; typedef long long ll; int n,m,b[5010][210],nxt[5010][210]; ll ans,sum[5010],d[5010]; char buffer[20000010],*head; inline char Getchar(){ return *head++; } inline int rd(){ register int x=0; register char c; do c=Getchar(); while(!isdigit(c)); do{ x=(x<<1)+(x<<3)+(c^48); c=Getchar(); }while(isdigit(c)); return x; } signed main(){ fread(buffer,1,20000000,stdin); head=buffer; n=rd(),m=rd(); for(register int i=2;i<=n;i++){ int x=rd(); sum[i]=sum[i-1]+x; } for(register int i=1;i<=n;i++) for(register int j=1;j<=m;j++) b[i][j]=rd(); for(register int i=n;i;i--){ ll now=0; for(int j=1;j<=m;j++){ now+=b[i][j]; nxt[i][j]=i+1; d[i+1]+=b[i+1][j]-b[i][j]; for(int &k=nxt[i][j];k<=n&&b[k][j]<=b[i][j];k=nxt[k][j]){ d[k]+=b[i][j]-b[k][j]; d[nxt[k][j]]+=b[k][j]-b[i][j]; } } for(int j=i;j<=n;j++){ now+=d[j]; ans=max(ans,now-(sum[j]-sum[i])); } } printf("%lld",ans); return 0; }
a.cc: In function 'int rd()': a.cc:12:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 12 | register int x=0; | ^ a.cc:13:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 13 | register char c; | ^ a.cc:15:16: error: 'isdigit' was not declared in this scope 15 | while(!isdigit(c)); | ^~~~~~~ a.cc: In function 'int main()': a.cc:26:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 26 | for(register int i=2;i<=n;i++){ | ^ a.cc:30:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 30 | for(register int i=1;i<=n;i++) | ^ a.cc:31:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 31 | for(register int j=1;j<=m;j++) | ^ a.cc:33:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 33 | for(register int i=n;i;i--){ | ^
s695433900
p03833
C++
#include <bits/stdc++.h> #define ll long long #define INF (1LL << 60) #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)(n);++i) #define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i) #define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i) #define each(a,b) for(auto& (a): (b)) #define all(v) (v).begin(),(v).end() #define len(v) (int)(v).size() #define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end()) #define cmx(x,y) x=max(x,y) #define cmn(x,y) x=min(x,y) #define fi first #define se second #define pb push_back #define show(x) cout<<#x<<" = "<<(x)<<endl #define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl #define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl #define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl #define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl #define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl #define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl using namespace std; typedef pair<int,int> P; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<double> vd; typedef vector<P> vp; typedef vector<string> vs; const int MAX_N = 5003; int b[MAX_N][200]; ll dp[MAX_N][MAX_N]; ll sm[MAX_N]; int n,m; template<typename T> class SparseTable { private: vector<T> arr; vector<int> logTable; vector<vector<int> > table; //最小値のインデックスを保持 int sz; public: SparseTable(vector<T>& v){ sz = (int)v.size(); arr = v; logTable.resize(sz+1); for(int i = 2; i < sz + 1; i++){ logTable[i] = logTable[i >> 1] + 1; } table.resize(sz,vector<T>(logTable[sz]+1)); for(int i = 0; i < sz; i++){ table[i][0] = i; } for(int k = 1; (1 << k) <= sz; k++){ for(int i = 0; i + (1 << k) <= sz; i++){ int s = table[i][k-1]; int t = table[i + (1 << (k-1))][k-1]; if(arr[s] < arr[t]){ table[i][k] = s; }else{ table[i][k] = t; } } } } pair<T,int> query(int l,int r){ int k = logTable[r-l]; if(arr[table[l][k]] < arr[table[r-(1<<k)][k]]){ return make_pair(arr[table[l][k]],table[l][k]); }else{ return make_pair(arr[table[r-(1<<k)][k]],table[r-(1<<k)][k]); } } }; inline void dfs(int l, int r, SparseTable<int>& sp) { if(r <= l) return; P p = sp.query(l,r); dp[l][r] += p.fi, dp[l][p.se] -= p.fi, dp[p.se+1][r] -= p.fi, dp[p.se+1][p.se] += p.fi; dfs(l,p.se,sp), dfs(p.se+1,r,sp); } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n >> m; rep(i,n-1){ int a; cin >> a; sm[i+2] = sm[i+1] + a; } rep(i,n){ rep(j,m){ cin >> b[i][j]; } } rep(i,m){ SparseTable<int> sp(i); dfs(0,n,sp); } rep(i,n+1){ rrep(j,n+1){ dp[i][j] += dp[i][j+1]; } } rrep(j,n+1){ rep(i,n+1){ dp[i+1][j] += dp[i][j]; } } ll ans = -INF; rep(i,n){ srep(j,i+1,n+1){ cmx(ans,dp[i][j]-(sm[j]-sm[i+1])); } } cout << ans << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:109:30: error: no matching function for call to 'SparseTable<int>::SparseTable(int&)' 109 | SparseTable<int> sp(i); | ^ a.cc:52:5: note: candidate: 'SparseTable<T>::SparseTable(std::vector<_Tp>&) [with T = int]' 52 | SparseTable(vector<T>& v){ | ^~~~~~~~~~~ a.cc:52:28: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&' 52 | SparseTable(vector<T>& v){ | ~~~~~~~~~~~^ a.cc:45:28: note: candidate: 'SparseTable<int>::SparseTable(const SparseTable<int>&)' 45 | template<typename T> class SparseTable { | ^~~~~~~~~~~ a.cc:45:28: note: no known conversion for argument 1 from 'int' to 'const SparseTable<int>&' a.cc:45:28: note: candidate: 'SparseTable<int>::SparseTable(SparseTable<int>&&)' a.cc:45:28: note: no known conversion for argument 1 from 'int' to 'SparseTable<int>&&'
s788306603
p03833
C++
#include<bits/stdc++.h> #define int long long using namespace std; int n,m,a[5001],b[5000][200]; signed main(){ cin>>n>>m; for(int i=1;i<n;i++)cin>>a[i]; for(int i=1;i<n;i++)a[i]+=a[i-1]; for(int i=0;i<n;i++) for(int j=0;j<m;j++)scanf("%lld",&b[i][j]); int ans=0; for(int i=0;i<n;i++){ vector<int> v; int t=0; for(int j=0;j<m;j++)v.push_back(b[i][j]),t+=b[i][j]; for(int j=i+1;j<n;j++){ int nt=0; for(int k=0;k<m;k++){ int x=max(b[j][k],v[k]); v[k]=x; nt+=x; } t=max(t,nt-(a[j]-a[i])); } ans=max(ans,t); } cout<<ans<<endl; return 0; } #include<bits/stdc++.h> #define int long long using namespace std; int n,m,a[5001],b[5000][200]; signed main(){ cin>>n>>m; for(int i=1;i<n;i++)cin>>a[i]; for(int i=1;i<n;i++)a[i]+=a[i-1]; for(int i=0;i<n;i++) for(int j=0;j<m;j++)scanf("%lld",&b[i][j]); int ans=0; for(int i=0;i<n;i++){ vector<int> v; int t=0; for(int j=0;j<m;j++)v.push_back(b[i][j]),t+=b[i][j]; for(int j=i+1;j<n;j++){ int nt=0; for(int k=0;k<m;k++){ int x=max(b[j][k],v[k]); v[k]=x; nt+=x; } t=max(t,nt-(a[j]-a[i])); } ans=max(ans,t); } cout<<ans<<endl; return 0; }
a.cc:36:5: error: redefinition of 'long long int n' 36 | int n,m,a[5001],b[5000][200]; | ^ a.cc:4:5: note: 'long long int n' previously declared here 4 | int n,m,a[5001],b[5000][200]; | ^ a.cc:36:7: error: redefinition of 'long long int m' 36 | int n,m,a[5001],b[5000][200]; | ^ a.cc:4:7: note: 'long long int m' previously declared here 4 | int n,m,a[5001],b[5000][200]; | ^ a.cc:36:9: error: redefinition of 'long long int a [5001]' 36 | int n,m,a[5001],b[5000][200]; | ^ a.cc:4:9: note: 'long long int a [5001]' previously declared here 4 | int n,m,a[5001],b[5000][200]; | ^ a.cc:36:17: error: redefinition of 'long long int b [5000][200]' 36 | int n,m,a[5001],b[5000][200]; | ^ a.cc:4:17: note: 'long long int b [5000][200]' previously declared here 4 | int n,m,a[5001],b[5000][200]; | ^ a.cc:38:8: error: redefinition of 'int main()' 38 | signed main(){ | ^~~~ a.cc:6:8: note: 'int main()' previously defined here 6 | signed main(){ | ^~~~
s645346056
p03833
Java
import java.io.*; import java.util.*; public class MainF { static final StdIn in = new StdIn(); static final PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { int n=in.nextInt(), m=in.nextInt(); long[] a=in.readLongArray(n-1, 0); long[][] b = new long[n][m]; for(int i=0; i<n; ++i) b[i]=in.readLongArray(m, 0); SegTree st = new SegTree(n); long[] ini = new long[n], mx1 = new long[m]; long ps=0, ans=0; for(int i=0; i<n; ++i) { for(int j=0; j<m; ++j) ini[i]+=mx1[j]=Math.max(b[i][j], mx1[j]); ini[i]-=ps; if(i<n-1) ps+=a[i]; } st.build(ini); int[][] nxt = new int[n][m]; for(int i=n-1; i>=0; --i) { for(int j=0; j<m; ++j) { nxt[i][j]=i+1; while(nxt[i][j]<n&&b[nxt[i][j]][j]<b[i][j]) nxt[i][j]=nxt[nxt[i][j]][j]; } } ps=0; for(int i=0; i<n; ++i) { ans=Math.max(st.get(i, n-1)+ps, ans); for(int j=0; j<m; ++j) { st.add(i, nxt[i][j]-1, -b[i][j]); for(int k=i+1; k<n&&b[k][j]<b[i][j]; k=nxt[k][j]) st.add(k, nxt[k][j]-1, b[k][j]); } if(i<n-1) ps+=a[i]; } out.println(ans); out.close(); } static class SegTree { int n, l1, r1; long v; long[] a, lazy; SegTree(int n) { this.n=n; a = new long[4*n]; lazy = new long[4*n]; } void build(long[] b) { build2(1, 0, n-1, b); } private void build2(int i, int l2, int r2, long[] b) { if(l2<r2) { int mid=(l2+r2)/2; build2(2*i, l2, mid, b); build2(2*i+1, mid+1, r2, b); a[i]=Math.max(a[2*i], a[2*i+1]); } else a[i]=b[l2]; } void add(int l, int r, long x) { l1=l; r1=r; v=x; add2(1, 0, n-1); } private void add2(int i, int l2, int r2) { if(l1<=l2&&r2<=r1) { a[i]+=v; if(l2<r2) { lazy[2*i]+=v; lazy[2*i+1]+=v; } } else { int mid=(l2+r2)/2; push(i*2, l2, mid); push(i*2+1, mid+1, r2); if(l1<=mid) add2(i*2, l2, mid); if(mid<r1) add2(i*2+1, mid+1, r2); a[i]=Math.max(a[i*2], a[i*2+1]); } } void push(int i, int l, int r) { a[i]+=lazy[i]; if(l<r) { lazy[2*i]+=lazy[i]; lazy[2*i+1]+=lazy[i]; } lazy[i]=0; } long get(int l, int r) { l1=l; r1=r; return get2(1, 0, n-1); } private long get2(int i, int l2, int r2) { push(i, l2, r2); if(l1<=l2&&r2<=r1) return a[i]; else { int mid=(l2+r2)/2; long res=Long.MIN_VALUE; if(l1<=mid) res = Math.max(get2(2*i, l2, mid), res); if(mid<r1) res = Math.max(get2(2*i+1, mid+1, r2), res); return res; } } } static class StdIn { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public StdIn() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public StdIn(InputStream in) { try{ din = new DataInputStream(in); } catch(Exception e) { throw new RuntimeException(); } buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String next() { int c; while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r')); StringBuilder s = new StringBuilder(); while (c != -1) { if (c == ' ' || c == '\n'||c=='\r') break; s.append((char)c); c=read(); } return s.toString(); } public String nextLine() { int c; while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r')); StringBuilder s = new StringBuilder(); while (c != -1) { if (c == '\n'||c=='\r') break; s.append((char)c); c = read(); } return s.toString(); } public int nextInt() { int ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do ret = ret * 10 + c - '0'; while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public int[] readIntArray(int n, int os) { int[] ar = new int[n]; for(int i=0; i<n; ++i) ar[i]=nextInt()+os; return ar; } public long nextLong() { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do ret = ret * 10 + c - '0'; while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public long[] readLongArray(int n, long os) { long[] ar = new long[n]; for(int i=0; i<n; ++i) ar[i]=nextLong()+os; return ar; } public double nextDouble() { double ret = 0, div = 1; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do ret = ret * 10 + c - '0'; while ((c = read()) >= '0' && c <= '9'); if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10); if (neg) return -ret; return ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() { try{ if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } catch(IOException e) { throw new RuntimeException(); } } public void close() throws IOException { if (din == null) return; din.close(); } } }
Main.java:4: error: class MainF is public, should be declared in a file named MainF.java public class MainF { ^ 1 error
s238254948
p03833
C++
#include<cstdio> #include<cstring> #include<algorithm> #define ll long long using namespace std; int read(){ int s=0,t=1;char c; while(!isdigit(c=getchar()))if(c=='-')t=-1; do{s=s*10+c-'0';}while(isdigit(c=getchar())); return s*t; } const int maxn=5010; int n,m,a[210][maxn],f[210][maxn],s[maxn],w[maxn]; ll A[maxn],g[maxn]; int main(){ n=read();m=read(); for(int i=2;i<=n;i++)A[i]=read(); for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)a[j][i]=read(); int top=0; /*for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++)printf("%d ",a[i][j]); puts(""); }*/ for(int i=1;i<=m;i++){ top=0; for(int j=n;j>=1;j--){ while(top&&a[i][j]>=s[top])top--; if(top)f[i][j]=w[top];else f[i][j]=n+1; s[++top]=a[i][j];w[top]=j; //printf("[%d][%d]%d\n",i,j,f[i][j]); } } for(int i=1;i<=m;i++){ int j=1;g[1]+=a[i][1]; while(f[i][j]<=n)g[f[i][j]]+=a[i][f[i][j]]-a[i][j],j=f[i][j]; } ll ans=-1ll<<60,sum=g[1];ans=max(ans,sum); //for(int j=1;j<=n;j++)printf("%lld ",g[j]);puts(""); for(int i=2;i<=n;i++)ans=max(ans,sum=sum-A[i]+g[i]);//,printf("sum=%lld\n",sum); for(int k=2;k<=n;k++){ for(int i=1;i<=m;i++){ int j=k,pre=0;//g[k]+=a[i][k]; //while(f[i][j]<=n&&f[i][j]!=f[i][k-1])g[f[i][j]]+=a[i][f[i][j]]-a[i][j],j=f[i][j]; while(j<=n&&j!=f[i][k-1])g[j]+=a[i][j]-a[i][pre],pre=j,j=f[i][j]; //printf("[%d]",j); //g[f[i][j]]-=a[i][f[i][j]]-a[i][k-1];g[f[i][j]]+=a[i][f[i][j]]-a[i][j]; g[j]-=a[i][j]-a[i][k-1];g[j]+=a[i][j]-a[i][pre]; }//puts(""); sum=g[k];ans=max(ans,sum); for(int j=k+1;j<=n;j++)ans=max(ans,sum=sum-A[j]+g[j]); //for(int j=1;j<=n;j++)printf("%lld ",g[j]);puts(""); } printf("%lld",ans); return 0; }
a.cc: In function 'int read()': a.cc:8:16: error: 'isdigit' was not declared in this scope 8 | while(!isdigit(c=getchar()))if(c=='-')t=-1; | ^~~~~~~ a.cc:9:32: error: 'isdigit' was not declared in this scope 9 | do{s=s*10+c-'0';}while(isdigit(c=getchar())); | ^~~~~~~
s618324366
p03833
C++
#include <bits/stdc++.h> #define show(x) cerr << #x << " = " << x << endl using namespace std; using ll = long long; template <typename T> constexpr T INF = numeric_limits<T>::max() / 10; using P = pair<ll, int>; struct Max { using T = P; T operator()(const T& a, const T& b) const { return max(a, b); } static constexpr T identity() { return P{-INF<ll>, -INF<int>}; } }; template <typename Base> class SparseTable { public: using T = typename Base::T; using SemiLattice = Base; SparseTable(const vector<T>& val) : size(val.size()), lg2(size + 1, 0) { for (int i = 2; i <= size; i++) { lg2[i] = lg2[i / 2] + 1; } table.resize(size, vector<T>(lg2[size] + 1)); for (int i = 0; i < size; i++) { table[i][0] = val[i]; } for (int j = 0; j < lg2[size]; j++) { const int w = 1 << j; for (int i = 0; i <= size - (w << 1); i++) { T tl = table[i][j], tr = table[i + w][j]; table[i][j + 1] = op(tl, tr); } } } T accumulate(const int l, const int r) const { assert(0 <= l and l < r and r <= size); const int j = lg2[r - l]; return op(table[l][j], table[r - (1 << j)][j]); } private: const int size; vector<int> lg2; vector<vector<T>> table; const SemiLattice op{}; }; using ST = SparseTable<Max>; int N, M; void rec(const int inf, const int sup, vector<vector<ll>>& imos, const ST& stable) { if (inf >= sup) return; const auto p = stable.accumulate(inf, sup); const int ind = p.second; const ll v = p.first; imos[ind][ind] += v; if (inf > 0) { imos[ind][inf - 1] -= v; if (sup < N) { imos[sup][inf - 1] += v; } } if (sup < N) { imos[sup][ind] -= v; } rec(inf, ind, imos, stable); rec(ind + 1, sup, imos, stable); } int main() { cin >> N >> M; vector<ll> pos(N, 0); for (int i = 1; i < N; i++) { ll A; cin >> A; pos[i] = pos[i - 1] + A; } vector<vector<ll>> imos(N, vector<ll>(N, 0)); vector<vector<P>> vs(M, vector<P>(N)); for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { cin >> vs[j][i].first; vs[j][i].second = i; } } for (int i = 0; i < M; i++) { ST stable{vs[i]}; rec(0, N, imos, stable); } show(imos); for (int y = 0; y < N; y++) { for (int x = N - 2; x >= 0; x--) { imos[y][x] += imos[y][x + 1]; } } for (int x = 0; x < N; x++) { for (int y = 1; y < N; y++) { imos[y][x] += imos[y - 1][x]; } } ll ans = -INF<ll>; for (int i = 0; i < N; i++) { for (int j = i; j < N; j++) { const ll cost = pos[j] - pos[i]; const ll yam = imos[j][i]; ans = max(ans, yam - cost); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:2:37: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and 'std::vector<std::vector<long long int> >') 2 | #define show(x) cerr << #x << " = " << x << endl | ~~~~~~~~~~~~~~~~~~~ ^~ | | | std::basic_ostream<char> a.cc:93:5: note: in expansion of macro 'show' 93 | show(imos); | ^~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<std::vector<long long int> >' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note
s396877036
p03833
C++
#include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int MAXN = 5005; const int MAXM = 205; int a[MAXN][MAXM], suf[MAXN][MAXM], c[MAXM]; int n, m, i, j, k, LG[MAXN]; long long tot, ans, d[MAXN]; inline int get() { char c; while ((c = getchar()) < 48 || c > 57); int res = c - 48; while ((c = getchar()) >= 48 && c <= 57) res = res * 10 + c - 48; return res; } int main() { LG[0] = -1; for(i = 1; i <= 5000; i ++) LG[i] = LG[i >> 1] + 1; cin >> n >> m; for(i = 2; i <= n; i ++) d[i] = get(), d[i] += d[i - 1]; for(i = 1; i <= n; i ++) for(j = 1; j <= m; j ++) a[i][j] = get(), f[] for(i = 1; i <= n; i ++) { for(j = 1; j <= m; j ++) c[j] = 0; tot = 0; for(j = i; j <= n; j ++) { for(k = 1; k <= m; k ++) if (a[j][k] > c[k]) tot += a[j][k] - c[k], c[k] = a[j][k]; ans = max(ans, tot - (d[j] - d[i])); int tt = 0; for(k = 1; k <= m; k ++) if (a[i][k] < c[k]) tt ++; if (tt == m) break; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:31:42: error: 'f' was not declared in this scope 31 | a[i][j] = get(), f[] | ^ a.cc:31:44: error: expected primary-expression before ']' token 31 | a[i][j] = get(), f[] | ^ a.cc:32:32: error: expected ';' before ')' token 32 | for(i = 1; i <= n; i ++) | ^ | ;
s660344301
p03833
C++
#include <bits/stdc++.h> typedef long long ll; const ll maxn = 5e3 + 1e2; const ll maxk = 205; ll val[maxk][maxn]; ll v[maxn]; ll best[maxk]; int main(){ ll n, k; std::cin >> n >> k; for(ll i = 1; i < n; i++){ std::cin >> v[i]; } for(ll i = 0; i < n; i++){ for(ll j = 0; j < k; j++){ std::cin >> val[j][i]; } } ll res = 0; for(ll i = 0; i < n; i++){ std::fill(best, best + k, 0); ll sum = 0; std::cout << sum << '\n'; if(j != i){ sum -= v[j]; } for(ll curr_k = 0; curr_k < k; curr_k++){ if(best[curr_k] < val[curr_k][j]){ sum += val[curr_k][j] - best[curr_k]; best[curr_k] = val[curr_k][j]; } } res = std::max(res, sum); } } std::cout << res << '\n'; }
a.cc: In function 'int main()': a.cc:30:28: error: 'j' was not declared in this scope 30 | if(j != i){ | ^ a.cc:35:63: error: 'j' was not declared in this scope 35 | if(best[curr_k] < val[curr_k][j]){ | ^ a.cc: At global scope: a.cc:45:14: error: 'cout' in namespace 'std' does not name a type 45 | std::cout << res << '\n'; | ^~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:46:1: error: expected declaration before '}' token 46 | } | ^
s985345160
p03833
C++
#include<bits/stdc++.h> #define myp pair<int,int> #define ll long long using namespace std; const int N=5010,M=210; int n,m,maxp,pow2[16]; int d[N][M]; ll dis[N],a[N][N],ans=0; myp st[M][N<<1][16]; myp que(int l,int r,int k){ int p=log2(r-l+1); return st[k][l][p].first>st[k][r-pow2[p]+1][p].first?st[k][l][p]:st[k][r-pow2[p]+1][p]; } void fill(int l,int r,int k){ if(l>r||l<=0||r>n) return; myp temp=que(l,r,k); int tempk=temp.second; a[l][tempk]+=temp.first,a[tempk+1][tempk]-=temp.first,a[l][r+1]-=temp.first,a[tempk+1][r+1]+=temp.first; fill(l,tempk-1,k);fill(tempk+1,r,k); return; } int main(){ scanf("%d%d",&n,&m); maxp=log2(n)+1; pow2[0]=1; for(int i=1;i<=maxp;i++) pow2[i]=2*pow2[i-1]; for(int i=2;i<=n;i++) scanf("%lld",&dis[i]); for(int i=2;i<=n;i++) dis[i]+=dis[i-1]; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) scanf("%d",&d[i][j]); for(int i=1;i<=m;i++){ for(int k=1;k<=n;k++) st[i][k][0]=make_pair(d[k][i],k); for(int j=1;j<=maxp;j++) for(int k=1;k<=n;k++){ if(st[i][k][j-1].first>=st[i][k+pow2[j-1]][j-1].first)st[i][k][j]=st[i][k][j-1]; else st[i][k][j]=st[i][k+pow2[j-1]][j-1]; } fill(1,n,i); } // for(int i=1;i<=n;i++){ // for(int j=1;j<=n;j++) cout<<a[i][j]<<" "; // cout<<endl; // } // cout<<endl; for(int i=1;i<=n;i++) for(int j=2;j<=n;j++) a[i][j]+=a[i][j-1]; for(int j=1;j<=n;j++) for(int i=2;i<=n;i++) a[i][j]+=a[i-1][j]; // for(int i=1;i<=n;i++){ // for(int j=1;j<=n;j++) cout<<a[i][j]<<" "; // cout<<endl; // } for(int i=1;i<=n;i++) for(int j=i;j<=n;j++) ans=max(ans,a[i][j]-sum_dis[j]+sum_dis[i-1]); cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:55:45: error: 'sum_dis' was not declared in this scope 55 | ans=max(ans,a[i][j]-sum_dis[j]+sum_dis[i-1]); | ^~~~~~~
s997440845
p03833
Java
//通ったことにする。糞問。 #include <cstdio> #include <algorithm> #define Rep(i, n) for (int i = 1; i <= n; i ++) #define Rep0(i, n) for (int i = 0; i <= n; i ++) #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) using namespace std; typedef long long LL; const int N = 5010; const int M = 210; int n, m, b[N][M], a[N], st[N], nxt[M][N], f[M]; LL sa[N]; struct T{ LL x, tg;} t[N * 4]; void up(int x) { t[x].x = max(t[x << 1].x, t[x << 1 | 1].x);} void pushdown(int x) { t[x << 1].x += t[x].tg, t[x << 1 | 1].x += t[x].tg; t[x << 1].tg += t[x].tg, t[x << 1 | 1].tg += t[x].tg; t[x].tg = 0; } void modify(int x, int l, int r, int l0, int r0, LL c) { if (l0 <= l && r <= r0){ t[x].x += c, t[x].tg += c; return; } pushdown(x); int mid = (l + r) >> 1; if (l0 <= mid) modify(x << 1, l, mid, l0, r0, c); if (r0 > mid) modify(x << 1 | 1, mid + 1, r, l0, r0, c); up(x); } LL query(int x, int l, int r, int l0, int r0) { if (l0 <= l && r <= r0) return t[x].x; pushdown(x); int mid = (l + r) >> 1; LL ret = -1e18; if (l0 <= mid) ret = query(x << 1, l, mid, l0, r0); if (r0 > mid) ret = max(query(x << 1 | 1, mid + 1, r, l0, r0), ret); return ret; } int main() { //freopen("bar.in", "r", stdin); //freopen("bar.out", "w", stdout); scanf("%d%d", &n, &m); for (int i = 2; i <= n; i ++) scanf("%d", &a[i]); Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); Rep(k, m) { int top = 0; for (int i = n; i; i --) { while (top && b[st[top]][k] <= b[i][k]) top --; if (top) nxt[k][i] = st[top]; else nxt[k][i] = n + 1; st[++ top] = i; } } Rep(i, n) { LL sum = 0; Rep(k, m){ f[k] = max(f[k], b[i][k]); sum += f[k]; } sa[i] = sa[i - 1] + a[i], sum -= sa[i]; modify(1, 1, n, i, i, sum); } LL ans = query(1, 1, n, 1, n); Rep(i, n - 1) { Rep(k, m) for (int j = i + 1; j != nxt[k][i]; j = nxt[k][j]) modify(1, 1, n, j, nxt[k][j] - 1, b[j][k] - b[i][k]); LL tmp = query(1, 1, n, i + 1, n) + sa[i + 1]; ans = max(ans, tmp); } printf("%lld\n", ans); return 0; }
Main.java:3: error: illegal character: '#' #include <cstdio> ^ Main.java:4: error: illegal character: '#' #include <algorithm> ^ Main.java:6: error: illegal character: '#' #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:6: error: class, interface, enum, or record expected #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:6: error: class, interface, enum, or record expected #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:7: error: illegal character: '#' #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:7: error: class, interface, enum, or record expected #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:7: error: class, interface, enum, or record expected #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:8: error: illegal character: '#' #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:8: error: class, interface, enum, or record expected #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:8: error: class, interface, enum, or record expected #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:12: error: class, interface, enum, or record expected typedef long long LL; ^ Main.java:14: error: class, interface, enum, or record expected const int N = 5010; ^ Main.java:15: error: class, interface, enum, or record expected const int M = 210; ^ Main.java:17: error: class, interface, enum, or record expected int n, m, b[N][M], a[N], st[N], nxt[M][N], f[M]; ^ Main.java:19: error: class, interface, enum, or record expected LL sa[N]; ^ Main.java:21: error: class, interface, enum, or record expected struct T{ LL x, tg;} t[N * 4]; ^ Main.java:21: error: class, interface, enum, or record expected struct T{ LL x, tg;} t[N * 4]; ^ Main.java:23: error: unnamed classes are a preview feature and are disabled by default. void up(int x) { t[x].x = max(t[x << 1].x, t[x << 1 | 1].x);} ^ (use --enable-preview to enable unnamed classes) Main.java:27: error: ';' expected t[x << 1].x += t[x].tg, t[x << 1 | 1].x += t[x].tg; ^ Main.java:28: error: ';' expected t[x << 1].tg += t[x].tg, t[x << 1 | 1].tg += t[x].tg; ^ Main.java:35: error: ';' expected t[x].x += c, t[x].tg += c; ^ Main.java:60: error: illegal start of expression scanf("%d%d", &n, &m); ^ Main.java:60: error: illegal start of expression scanf("%d%d", &n, &m); ^ Main.java:62: error: illegal start of expression for (int i = 2; i <= n; i ++) scanf("%d", &a[i]); ^ Main.java:63: error: ';' expected Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:63: error: ';' expected Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:63: error: illegal start of expression Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:65: error: ';' expected Rep(k, m) { ^ Main.java:75: error: ';' expected Rep(i, n) { ^ Main.java:77: error: ';' expected Rep(k, m){ ^ Main.java:81: error: ';' expected sa[i] = sa[i - 1] + a[i], sum -= sa[i]; ^ Main.java:87: error: ';' expected Rep(i, n - 1) { ^ Main.java:88: error: ';' expected Rep(k, m) for (int j = i + 1; j != nxt[k][i]; j = nxt[k][j]) ^ 34 errors
s578560523
p03833
Java
//通ったことにする。糞問。 #include <cstdio> #include <algorithm> #define Rep(i, n) for (int i = 1; i <= n; i ++) #define Rep0(i, n) for (int i = 0; i <= n; i ++) #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) using namespace std; typedef long long LL; const int N = 5010; const int M = 210; int n, m, b[N][M], a[N], st[N], nxt[M][N], f[M]; LL sa[N]; struct T{ LL x, tg;} t[N * 4]; void up(int x) { t[x].x = max(t[x << 1].x, t[x << 1 | 1].x);} void pushdown(int x) { t[x << 1].x += t[x].tg, t[x << 1 | 1].x += t[x].tg; t[x << 1].tg += t[x].tg, t[x << 1 | 1].tg += t[x].tg; t[x].tg = 0; } void modify(int x, int l, int r, int l0, int r0, LL c) { if (l0 <= l && r <= r0){ t[x].x += c, t[x].tg += c; return; } pushdown(x); int mid = (l + r) >> 1; if (l0 <= mid) modify(x << 1, l, mid, l0, r0, c); if (r0 > mid) modify(x << 1 | 1, mid + 1, r, l0, r0, c); up(x); } LL query(int x, int l, int r, int l0, int r0) { if (l0 <= l && r <= r0) return t[x].x; pushdown(x); int mid = (l + r) >> 1; LL ret = -1e18; if (l0 <= mid) ret = query(x << 1, l, mid, l0, r0); if (r0 > mid) ret = max(query(x << 1 | 1, mid + 1, r, l0, r0), ret); return ret; } int main() { //freopen("bar.in", "r", stdin); //freopen("bar.out", "w", stdout); scanf("%d%d", &n, &m); for (int i = 2; i <= n; i ++) scanf("%d", &a[i]); Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); Rep(k, m) { int top = 0; for (int i = n; i; i --) { while (top && b[st[top]][k] <= b[i][k]) top --; if (top) nxt[k][i] = st[top]; else nxt[k][i] = n + 1; st[++ top] = i; } } Rep(i, n) { LL sum = 0; Rep(k, m){ f[k] = max(f[k], b[i][k]); sum += f[k]; } sa[i] = sa[i - 1] + a[i], sum -= sa[i]; modify(1, 1, n, i, i, sum); } LL ans = query(1, 1, n, 1, n); Rep(i, n - 1) { Rep(k, m) for (int j = i + 1; j != nxt[k][i]; j = nxt[k][j]) modify(1, 1, n, j, nxt[k][j] - 1, b[j][k] - b[i][k]); LL tmp = query(1, 1, n, i + 1, n) + sa[i + 1]; ans = max(ans, tmp); } printf("%lld\n", ans); return 0; }
Main.java:3: error: illegal character: '#' #include <cstdio> ^ Main.java:4: error: illegal character: '#' #include <algorithm> ^ Main.java:6: error: illegal character: '#' #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:6: error: class, interface, enum, or record expected #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:6: error: class, interface, enum, or record expected #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:7: error: illegal character: '#' #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:7: error: class, interface, enum, or record expected #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:7: error: class, interface, enum, or record expected #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:8: error: illegal character: '#' #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:8: error: class, interface, enum, or record expected #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:8: error: class, interface, enum, or record expected #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:12: error: class, interface, enum, or record expected typedef long long LL; ^ Main.java:14: error: class, interface, enum, or record expected const int N = 5010; ^ Main.java:15: error: class, interface, enum, or record expected const int M = 210; ^ Main.java:17: error: class, interface, enum, or record expected int n, m, b[N][M], a[N], st[N], nxt[M][N], f[M]; ^ Main.java:19: error: class, interface, enum, or record expected LL sa[N]; ^ Main.java:21: error: class, interface, enum, or record expected struct T{ LL x, tg;} t[N * 4]; ^ Main.java:21: error: class, interface, enum, or record expected struct T{ LL x, tg;} t[N * 4]; ^ Main.java:23: error: unnamed classes are a preview feature and are disabled by default. void up(int x) { t[x].x = max(t[x << 1].x, t[x << 1 | 1].x);} ^ (use --enable-preview to enable unnamed classes) Main.java:27: error: ';' expected t[x << 1].x += t[x].tg, t[x << 1 | 1].x += t[x].tg; ^ Main.java:28: error: ';' expected t[x << 1].tg += t[x].tg, t[x << 1 | 1].tg += t[x].tg; ^ Main.java:35: error: ';' expected t[x].x += c, t[x].tg += c; ^ Main.java:60: error: illegal start of expression scanf("%d%d", &n, &m); ^ Main.java:60: error: illegal start of expression scanf("%d%d", &n, &m); ^ Main.java:62: error: illegal start of expression for (int i = 2; i <= n; i ++) scanf("%d", &a[i]); ^ Main.java:63: error: ';' expected Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:63: error: ';' expected Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:63: error: illegal start of expression Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:65: error: ';' expected Rep(k, m) { ^ Main.java:75: error: ';' expected Rep(i, n) { ^ Main.java:77: error: ';' expected Rep(k, m){ ^ Main.java:81: error: ';' expected sa[i] = sa[i - 1] + a[i], sum -= sa[i]; ^ Main.java:87: error: ';' expected Rep(i, n - 1) { ^ Main.java:88: error: ';' expected Rep(k, m) for (int j = i + 1; j != nxt[k][i]; j = nxt[k][j]) ^ 34 errors
s279254768
p03833
Java
//通ったことにする。糞問。 #include <cstdio> #include <algorithm> #define Rep(i, n) for (int i = 1; i <= n; i ++) #define Rep0(i, n) for (int i = 0; i <= n; i ++) #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) using namespace std; typedef long long LL; const int N = 5010; const int M = 210; int n, m, b[N][M], a[N], st[N], nxt[M][N], f[M]; LL sa[N]; struct T{ LL x, tg;} t[N * 4]; void up(int x) { t[x].x = max(t[x << 1].x, t[x << 1 | 1].x);} void pushdown(int x) { t[x << 1].x += t[x].tg, t[x << 1 | 1].x += t[x].tg; t[x << 1].tg += t[x].tg, t[x << 1 | 1].tg += t[x].tg; t[x].tg = 0; } void modify(int x, int l, int r, int l0, int r0, LL c) { if (l0 <= l && r <= r0){ t[x].x += c, t[x].tg += c; return; } pushdown(x); int mid = (l + r) >> 1; if (l0 <= mid) modify(x << 1, l, mid, l0, r0, c); if (r0 > mid) modify(x << 1 | 1, mid + 1, r, l0, r0, c); up(x); } LL query(int x, int l, int r, int l0, int r0) { if (l0 <= l && r <= r0) return t[x].x; pushdown(x); int mid = (l + r) >> 1; LL ret = -1e18; if (l0 <= mid) ret = query(x << 1, l, mid, l0, r0); if (r0 > mid) ret = max(query(x << 1 | 1, mid + 1, r, l0, r0), ret); return ret; } int main() { //freopen("bar.in", "r", stdin); //freopen("bar.out", "w", stdout); scanf("%d%d", &n, &m); for (int i = 2; i <= n; i ++) scanf("%d", &a[i]); Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); Rep(k, m) { int top = 0; for (int i = n; i; i --) { while (top && b[st[top]][k] <= b[i][k]) top --; if (top) nxt[k][i] = st[top]; else nxt[k][i] = n + 1; st[++ top] = i; } } Rep(i, n) { LL sum = 0; Rep(k, m){ f[k] = max(f[k], b[i][k]); sum += f[k]; } sa[i] = sa[i - 1] + a[i], sum -= sa[i]; modify(1, 1, n, i, i, sum); } LL ans = query(1, 1, n, 1, n); Rep(i, n - 1) { Rep(k, m) for (int j = i + 1; j != nxt[k][i]; j = nxt[k][j]) modify(1, 1, n, j, nxt[k][j] - 1, b[j][k] - b[i][k]); LL tmp = query(1, 1, n, i + 1, n) + sa[i + 1]; ans = max(ans, tmp); } printf("%lld\n", ans); return 0; }
Main.java:3: error: illegal character: '#' #include <cstdio> ^ Main.java:4: error: illegal character: '#' #include <algorithm> ^ Main.java:6: error: illegal character: '#' #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:6: error: class, interface, enum, or record expected #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:6: error: class, interface, enum, or record expected #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:7: error: illegal character: '#' #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:7: error: class, interface, enum, or record expected #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:7: error: class, interface, enum, or record expected #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:8: error: illegal character: '#' #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:8: error: class, interface, enum, or record expected #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:8: error: class, interface, enum, or record expected #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:12: error: class, interface, enum, or record expected typedef long long LL; ^ Main.java:14: error: class, interface, enum, or record expected const int N = 5010; ^ Main.java:15: error: class, interface, enum, or record expected const int M = 210; ^ Main.java:17: error: class, interface, enum, or record expected int n, m, b[N][M], a[N], st[N], nxt[M][N], f[M]; ^ Main.java:19: error: class, interface, enum, or record expected LL sa[N]; ^ Main.java:21: error: class, interface, enum, or record expected struct T{ LL x, tg;} t[N * 4]; ^ Main.java:21: error: class, interface, enum, or record expected struct T{ LL x, tg;} t[N * 4]; ^ Main.java:23: error: unnamed classes are a preview feature and are disabled by default. void up(int x) { t[x].x = max(t[x << 1].x, t[x << 1 | 1].x);} ^ (use --enable-preview to enable unnamed classes) Main.java:27: error: ';' expected t[x << 1].x += t[x].tg, t[x << 1 | 1].x += t[x].tg; ^ Main.java:28: error: ';' expected t[x << 1].tg += t[x].tg, t[x << 1 | 1].tg += t[x].tg; ^ Main.java:35: error: ';' expected t[x].x += c, t[x].tg += c; ^ Main.java:60: error: illegal start of expression scanf("%d%d", &n, &m); ^ Main.java:60: error: illegal start of expression scanf("%d%d", &n, &m); ^ Main.java:62: error: illegal start of expression for (int i = 2; i <= n; i ++) scanf("%d", &a[i]); ^ Main.java:63: error: ';' expected Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:63: error: ';' expected Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:63: error: illegal start of expression Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:65: error: ';' expected Rep(k, m) { ^ Main.java:75: error: ';' expected Rep(i, n) { ^ Main.java:77: error: ';' expected Rep(k, m){ ^ Main.java:81: error: ';' expected sa[i] = sa[i - 1] + a[i], sum -= sa[i]; ^ Main.java:87: error: ';' expected Rep(i, n - 1) { ^ Main.java:88: error: ';' expected Rep(k, m) for (int j = i + 1; j != nxt[k][i]; j = nxt[k][j]) ^ 34 errors
s577671986
p03833
Java
//通ったことにする。糞問。 #include <cstdio> #include <algorithm> #define Rep(i, n) for (int i = 1; i <= n; i ++) #define Rep0(i, n) for (int i = 0; i <= n; i ++) #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) using namespace std; typedef long long LL; const int N = 5010; const int M = 210; int n, m, b[N][M], a[N], st[N], nxt[M][N], f[M]; LL sa[N]; struct T{ LL x, tg;} t[N * 4]; void up(int x) { t[x].x = max(t[x << 1].x, t[x << 1 | 1].x);} void pushdown(int x) { t[x << 1].x += t[x].tg, t[x << 1 | 1].x += t[x].tg; t[x << 1].tg += t[x].tg, t[x << 1 | 1].tg += t[x].tg; t[x].tg = 0; } void modify(int x, int l, int r, int l0, int r0, LL c) { if (l0 <= l && r <= r0){ t[x].x += c, t[x].tg += c; return; } pushdown(x); int mid = (l + r) >> 1; if (l0 <= mid) modify(x << 1, l, mid, l0, r0, c); if (r0 > mid) modify(x << 1 | 1, mid + 1, r, l0, r0, c); up(x); } LL query(int x, int l, int r, int l0, int r0) { if (l0 <= l && r <= r0) return t[x].x; pushdown(x); int mid = (l + r) >> 1; LL ret = -1e18; if (l0 <= mid) ret = query(x << 1, l, mid, l0, r0); if (r0 > mid) ret = max(query(x << 1 | 1, mid + 1, r, l0, r0), ret); return ret; } int main() { //freopen("bar.in", "r", stdin); //freopen("bar.out", "w", stdout); scanf("%d%d", &n, &m); for (int i = 2; i <= n; i ++) scanf("%d", &a[i]); Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); Rep(k, m) { int top = 0; for (int i = n; i; i --) { while (top && b[st[top]][k] <= b[i][k]) top --; if (top) nxt[k][i] = st[top]; else nxt[k][i] = n + 1; st[++ top] = i; } } Rep(i, n) { LL sum = 0; Rep(k, m){ f[k] = max(f[k], b[i][k]); sum += f[k]; } sa[i] = sa[i - 1] + a[i], sum -= sa[i]; modify(1, 1, n, i, i, sum); } LL ans = query(1, 1, n, 1, n); Rep(i, n - 1) { Rep(k, m) for (int j = i + 1; j != nxt[k][i]; j = nxt[k][j]) modify(1, 1, n, j, nxt[k][j] - 1, b[j][k] - b[i][k]); LL tmp = query(1, 1, n, i + 1, n) + sa[i + 1]; ans = max(ans, tmp); } printf("%lld\n", ans); return 0; }
Main.java:3: error: illegal character: '#' #include <cstdio> ^ Main.java:4: error: illegal character: '#' #include <algorithm> ^ Main.java:6: error: illegal character: '#' #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:6: error: class, interface, enum, or record expected #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:6: error: class, interface, enum, or record expected #define Rep(i, n) for (int i = 1; i <= n; i ++) ^ Main.java:7: error: illegal character: '#' #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:7: error: class, interface, enum, or record expected #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:7: error: class, interface, enum, or record expected #define Rep0(i, n) for (int i = 0; i <= n; i ++) ^ Main.java:8: error: illegal character: '#' #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:8: error: class, interface, enum, or record expected #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:8: error: class, interface, enum, or record expected #define RepG(i, x) for (int i = head[x]; i; i = edge[i].next) ^ Main.java:12: error: class, interface, enum, or record expected typedef long long LL; ^ Main.java:14: error: class, interface, enum, or record expected const int N = 5010; ^ Main.java:15: error: class, interface, enum, or record expected const int M = 210; ^ Main.java:17: error: class, interface, enum, or record expected int n, m, b[N][M], a[N], st[N], nxt[M][N], f[M]; ^ Main.java:19: error: class, interface, enum, or record expected LL sa[N]; ^ Main.java:21: error: class, interface, enum, or record expected struct T{ LL x, tg;} t[N * 4]; ^ Main.java:21: error: class, interface, enum, or record expected struct T{ LL x, tg;} t[N * 4]; ^ Main.java:23: error: unnamed classes are a preview feature and are disabled by default. void up(int x) { t[x].x = max(t[x << 1].x, t[x << 1 | 1].x);} ^ (use --enable-preview to enable unnamed classes) Main.java:27: error: ';' expected t[x << 1].x += t[x].tg, t[x << 1 | 1].x += t[x].tg; ^ Main.java:28: error: ';' expected t[x << 1].tg += t[x].tg, t[x << 1 | 1].tg += t[x].tg; ^ Main.java:35: error: ';' expected t[x].x += c, t[x].tg += c; ^ Main.java:60: error: illegal start of expression scanf("%d%d", &n, &m); ^ Main.java:60: error: illegal start of expression scanf("%d%d", &n, &m); ^ Main.java:62: error: illegal start of expression for (int i = 2; i <= n; i ++) scanf("%d", &a[i]); ^ Main.java:63: error: ';' expected Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:63: error: ';' expected Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:63: error: illegal start of expression Rep(i, n) Rep(j, m) scanf("%d", &b[i][j]); ^ Main.java:65: error: ';' expected Rep(k, m) { ^ Main.java:75: error: ';' expected Rep(i, n) { ^ Main.java:77: error: ';' expected Rep(k, m){ ^ Main.java:81: error: ';' expected sa[i] = sa[i - 1] + a[i], sum -= sa[i]; ^ Main.java:87: error: ';' expected Rep(i, n - 1) { ^ Main.java:88: error: ';' expected Rep(k, m) for (int j = i + 1; j != nxt[k][i]; j = nxt[k][j]) ^ 34 errors
s091063074
p03833
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <cstring> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <list> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> #include <unordered_set> #include <unordered_map> #include <array> #include <cassert> #include <bitset> using namespace std; using LL = long long; using P = pair<LL, LL>; template <class T> struct my_greater : std::greater<T> { static constexpr T defval = std::numeric_limits<T>::min(); }; template <> struct my_greater<P> : std::greater<P> { static constexpr P defval = P(std::numeric_limits<LL>::min(), std::numeric_limits<LL>::min()); }; //Base class for Segment Trees template <class T> class segtree_base { protected: size_t width; vector<T> vec; T def; virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0; public: segtree_base(size_t size_, const T& def_ = T()) : def(def_) { width = 1; while (width < size_)width *= 2; vec.resize(width * 2 - 1, def); } //Ask a query in ranges [left,right) T query(int left, int right) { return query_raw(left, right, 0, width, 0); } //Get the number of child nodes size_t treeWidth() { return width; } virtual ~segtree_base() {} }; //Range Minimum Tree template <class T, class Comp> class rmq_tree : public segtree_base<T> { public: rmq_tree(size_t size_) : segtree_base<T>(size_, Comp()::defval) {} //Do [] <= base void init(const vector<T>&base) { for (int i = 0; i < min(this->width, base.size()); i++) this->vec[i + this->width - 1] = base[i]; for (int i = this->width - 2; i >= 0; i--) this->vec[i] = std::min(this->vec[i * 2 + 1], this->vec[i * 2 + 2], Comp()); } //Make [index] <= val; void update(int index, T val) { auto &vec = this->vec; index += (this->width - 1); vec[index] = val; while (index > 0) { index = (index - 1) / 2; vec[index] = std::min(vec[index * 2 + 1], vec[index * 2 + 2], Comp()); } } private: T query_raw(int l_, int r_, int a_, int b_, int k_)override { const auto &vec = this->vec; if (l_ <= a_ && b_ <= r_) { return vec[k_]; } if (b_ <= l_ || r_ <= a_) { return this->def; } int m = (a_ + b_) / 2; return std::min( query_raw(l_, r_, a_, m, k_ + k_ + 1), query_raw(l_, r_, m, b_, k_ + k_ + 2), Comp()); } }; template<typename T> class imos2d { private: std::vector<std::vector<T>>buf; const int lim1, lim2; bool convert; inline bool valid(int x, int y, bool wide) { return (0 <= x && 0 <= y && x < lim1 + (wide ? 1 : 0) && y < lim2 + (wide ? 1 : 0)); } T rawsum(int i1, int i2) { assert(valid(i1, i2, true)); return buf[i1][i2]; } public: //サイズを指定してください imos2d(size_t width, size_t height) : lim1(width), lim2(height), convert(false) { buf.resize(width + 1, std::vector<T>(height + 1)); } //1マスをマーキングする(splatと併用不可) void mark(int first, int second, T value) { assert(!convert); assert(valid(first, second, false)); buf[first + 1][second + 1] += value; } //区域内でマーキングした和を求める(markのみに使用) T sumquery(int firstcor, int secondcor, int firstlen, int secondlen) { assert(convert); int px = firstcor, py = secondcor; int qx = px + firstlen, qy = py + secondlen; assert(valid(px, py, false) && valid(qx, qy, true)); return rawsum(px, py) + rawsum(qx, qy) - rawsum(px, qy) - rawsum(qx, py); } //範囲を塗りつぶす(markと併用不可) void splat(int firstcor, int secondcor, int firstlen, int secondlen, T value) { assert(!convert); int px = firstcor, py = secondcor; int qx = px + firstlen, qy = py + secondlen; assert(valid(px, py, false) && valid(qx, qy, true)); buf[px][py] += value; buf[qx][qy] += value; buf[px][qy] -= value; buf[qx][py] -= value; } //あるマスの重なりを調べる(splatのみに使用) T depth(int first, int second) { assert(convert); assert(valid(first, second, false)); return buf[first][second]; } //累積する void imos() { convert = true; for (int i = 0; i < lim1; ++i) { for (int j = 0; j <= lim2; ++j) { buf[i + 1][j] += buf[i][j]; } } for (int i = 0; i <= lim1; ++i) { for (int j = 0; j < lim2; ++j) { buf[i][j + 1] += buf[i][j]; } } } }; vector<rmq_tree<P, my_greater<P>>>vec; LL B[5678][234]; //k種類目のチケットを値域[i,j)においてみる void bury(imos2d<LL>&imos, int k, int i, int j) { if (i == j)return; auto ret = vec[k].query(i, j); LL val = ret.first; int index = ret.second; int lef = i; int upp = index; int wid = index - i + 1; int hei = j - index; imos.splat(lef, upp, wid, hei, val); bury(imos, k, i, index); bury(imos, k, index + 1, j); } int main(void) { LL N, M; vector<LL>dist(1, 0); cin >> N >> M; for (int i = 1; i < N; ++i) { LL a; cin >> a; dist.push_back(dist.back() + a); } for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) { cin >> B[i][j]; } } for (int j = 0; j < M; ++j) { vec.push_back(rmq_tree<P, my_greater<P>>(N)); auto& seg = vec.back(); vector<P>cash; for (int i = 0; i < N; ++i)cash.push_back({ B[i][j],i }); seg.init(cash); } imos2d<LL>base(N, N); for (int k = 0; k < M; ++k) { bury(base, k, 0, N); } base.imos(); LL ans = 0; for (int r = 0; r < N; ++r) { for (int l = 0; l <= r; ++l) { LL minus = dist[r] - dist[l]; LL cue = base.depth(l, r); cue -= minus; ans = max(ans, cue); } } cout << ans << endl; return 0; }
a.cc: In constructor 'rmq_tree<T, Comp>::rmq_tree(size_t)': a.cc:80:63: error: expected ')' before '::' token 80 | rmq_tree(size_t size_) : segtree_base<T>(size_, Comp()::defval) | ^~ a.cc:80:49: note: to match this '(' 80 | rmq_tree(size_t size_) : segtree_base<T>(size_, Comp()::defval) | ^ a.cc: In instantiation of 'rmq_tree<T, Comp>::rmq_tree(size_t) [with T = std::pair<long long int, long long int>; Comp = my_greater<std::pair<long long int, long long int> >; size_t = long unsigned int]': a.cc:245:45: required from here 245 | vec.push_back(rmq_tree<P, my_greater<P>>(N)); | ^ a.cc:80:71: error: no matching function for call to 'segtree_base<std::pair<long long int, long long int> >::segtree_base(size_t&, my_greater<std::pair<long long int, long long int> >)' 80 | rmq_tree(size_t size_) : segtree_base<T>(size_, Comp()::defval) | ^ a.cc:56:9: note: candidate: 'segtree_base<T>::segtree_base(size_t, const T&) [with T = std::pair<long long int, long long int>; size_t = long unsigned int]' 56 | segtree_base(size_t size_, const T& def_ = T()) : def(def_) | ^~~~~~~~~~~~ a.cc:56:45: note: no known conversion for argument 2 from 'my_greater<std::pair<long long int, long long int> >' to 'const std::pair<long long int, long long int>&' 56 | segtree_base(size_t size_, const T& def_ = T()) : def(def_) | ~~~~~~~~~^~~~~~~~~~ a.cc:48:7: note: candidate: 'segtree_base<std::pair<long long int, long long int> >::segtree_base(const segtree_base<std::pair<long long int, long long int> >&)' 48 | class segtree_base | ^~~~~~~~~~~~ a.cc:48:7: note: candidate expects 1 argument, 2 provided
s633933622
p03833
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <cstring> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <list> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> #include <unordered_set> #include <unordered_map> #include <array> #include <cassert> #include <bitset> using namespace std; using LL = long long; using P = pair<LL, LL>; template <> struct my_greater<P> : std::greater<P> { static constexpr P defval = P(std::numeric_limits<LL>::min(), std::numeric_limits<LL>::min()); }; //Base class for Segment Trees template <class T> class segtree_base { protected: size_t width; vector<T> vec; T def; virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0; public: segtree_base(size_t size_, const T& def_ = T()) : def(def_) { width = 1; while (width < size_)width *= 2; vec.resize(width * 2 - 1, def); } //Ask a query in ranges [left,right) T query(int left, int right) { return query_raw(left, right, 0, width, 0); } //Get the number of child nodes size_t treeWidth() { return width; } virtual ~segtree_base() {} }; //Range Minimum Tree template <class T, class Comp> class rmq_tree : public segtree_base<T> { public: rmq_tree(size_t size_) : segtree_base<T>(size_, Comp::defval) {} //Do [] <= base void init(const vector<T>&base) { for (int i = 0; i < min(this->width, base.size()); i++) this->vec[i + this->width - 1] = base[i]; for (int i = this->width - 2; i >= 0; i--) this->vec[i] = std::min(this->vec[i * 2 + 1], this->vec[i * 2 + 2], Comp()); } //Make [index] <= val; void update(int index, T val) { auto &vec = this->vec; index += (this->width - 1); vec[index] = val; while (index > 0) { index = (index - 1) / 2; vec[index] = std::min(vec[index * 2 + 1], vec[index * 2 + 2], Comp()); } } private: T query_raw(int l_, int r_, int a_, int b_, int k_)override { const auto &vec = this->vec; if (l_ <= a_ && b_ <= r_) { return vec[k_]; } if (b_ <= l_ || r_ <= a_) { return this->def; } int m = (a_ + b_) / 2; return std::min( query_raw(l_, r_, a_, m, k_ + k_ + 1), query_raw(l_, r_, m, b_, k_ + k_ + 2), Comp()); } }; template <class T> struct my_greater : std::greater<T> { static constexpr T defval = std::numeric_limits<T>::min(); }; template<typename T> class imos2d { private: std::vector<std::vector<T>>buf; const int lim1, lim2; bool convert; inline bool valid(int x, int y, bool wide) { return (0 <= x && 0 <= y && x < lim1 + (wide ? 1 : 0) && y < lim2 + (wide ? 1 : 0)); } T rawsum(int i1, int i2) { assert(valid(i1, i2, true)); return buf[i1][i2]; } public: //サイズを指定してください imos2d(size_t width, size_t height) : lim1(width), lim2(height), convert(false) { buf.resize(width + 1, std::vector<T>(height + 1)); } //1マスをマーキングする(splatと併用不可) void mark(int first, int second, T value) { assert(!convert); assert(valid(first, second, false)); buf[first + 1][second + 1] += value; } //区域内でマーキングした和を求める(markのみに使用) T sumquery(int firstcor, int secondcor, int firstlen, int secondlen) { assert(convert); int px = firstcor, py = secondcor; int qx = px + firstlen, qy = py + secondlen; assert(valid(px, py, false) && valid(qx, qy, true)); return rawsum(px, py) + rawsum(qx, qy) - rawsum(px, qy) - rawsum(qx, py); } //範囲を塗りつぶす(markと併用不可) void splat(int firstcor, int secondcor, int firstlen, int secondlen, T value) { assert(!convert); int px = firstcor, py = secondcor; int qx = px + firstlen, qy = py + secondlen; assert(valid(px, py, false) && valid(qx, qy, true)); buf[px][py] += value; buf[qx][qy] += value; buf[px][qy] -= value; buf[qx][py] -= value; } //あるマスの重なりを調べる(splatのみに使用) T depth(int first, int second) { assert(convert); assert(valid(first, second, false)); return buf[first][second]; } //累積する void imos() { convert = true; for (int i = 0; i < lim1; ++i) { for (int j = 0; j <= lim2; ++j) { buf[i + 1][j] += buf[i][j]; } } for (int i = 0; i <= lim1; ++i) { for (int j = 0; j < lim2; ++j) { buf[i][j + 1] += buf[i][j]; } } } }; vector<rmq_tree<P, my_greater<P>>>vec; LL B[5678][234]; //k種類目のチケットを値域[i,j)においてみる void bury(imos2d<LL>&imos, int k, int i, int j) { if (i == j)return; auto ret = vec[k].query(i, j); LL val = ret.first; int index = ret.second; int lef = i; int upp = index; int wid = index - i + 1; int hei = j - index; imos.splat(lef, upp, wid, hei, val); bury(imos, k, i, index); bury(imos, k, index + 1, j); } int main(void) { LL N, M; vector<LL>dist(1, 0); cin >> N >> M; for (int i = 1; i < N; ++i) { LL a; cin >> a; dist.push_back(dist.back() + a); } for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) { cin >> B[i][j]; } } for (int j = 0; j < M; ++j) { vec.emplace_back(N); auto& seg = vec.back(); vector<P>cash; for (int i = 0; i < N; ++i)cash.push_back({ B[i][j],i }); seg.init(cash); } imos2d<LL>base(N, N); for (int k = 0; k < M; ++k) { bury(base, k, 0, N); } base.imos(); LL ans = 0; for (int r = 0; r < N; ++r) { for (int l = 0; l <= r; ++l) { LL minus = dist[r] - dist[l]; LL cue = base.depth(l, r); cue -= minus; ans = max(ans, cue); } } cout << ans << endl; return 0; }
a.cc:34:8: error: 'my_greater' is not a class template 34 | struct my_greater<P> : std::greater<P> | ^~~~~~~~~~ a.cc:35:1: error: explicit specialization of non-template 'my_greater' 35 | { | ^ a.cc:115:8: error: 'my_greater' is not a template 115 | struct my_greater : std::greater<T> | ^~~~~~~~~~ a.cc:34:8: note: previous declaration here 34 | struct my_greater<P> : std::greater<P> | ^~~~~~~~~~ a.cc:203:20: error: 'my_greater' is not a template 203 | vector<rmq_tree<P, my_greater<P>>>vec; | ^~~~~~~~~~
s892860989
p03833
C++
#include <algorithm> #include <cassert> #include <iostream> #include <vector> #include <cstdio> #include <complex> #include <cstring> using namespace std; typedef long long LL; const int N = 5000 + 5; const int M = 200 + 5; const int INF = 1000000000 + 5; int n, m; int x[N]; int a[M]; LL tag[N << 2]; LL maxv[N << 2]; vector<pair<int, int> > st[M]; void modify(int t, int l, int r, int a, int b, LL v) { if (b < l || r < a) return; if (a <= l && r <= b) { tag[t] += v; maxv[t] += v; return; } if (tag[t]) { tag[t << 1] += tag[t]; maxv[t << 1] += tag[t]; tag[t << 1 | 1] += tag[t]; maxv[t << 1 | 1] += tag[t]; tag[t] = 0; } int mid = (l + r) >> 1; modify(t << 1, l, mid, a, b, v); modify(t << 1 | 1, mid + 1, r, a, b, v); maxv[t] = max(maxv[t << 1], maxv[t << 1 | 1]); } LL query(int t, int l, int r, int a, int b) { if (b < l || r < a) return 0; if (a <= l && r <= b) { return maxv[t]; } if (tag[t]) { tag[t << 1] += tag[t]; maxv[t << 1] += tag[t]; tag[t << 1 | 1] += tag[t]; maxv[t << 1 | 1] += tag[t]; tag[t] = 0; } int mid = (l + r) >> 1; return max(query(t << 1, l, mid, a, b), query(t << 1 | 1, mid + 1, r, a, b)); } void solve() { cin >> n >> m; for(int i = 0; i < n - 1; ++ i) { scanf("%d", x + i); } long long ans = 0; for(int j = 0; j < m; ++ j) { st[j].push_back(make_pair(INF, -1)); } for(int i = 0; i < n; ++ i) { long long tmp = 0; for(int j = 0; j < m; ++ j) { scanf("%d", a + j); tmp += a[j]; } ans = max(ans, tmp); for(int j = 0; j < m; ++ j) { while (a[j] >= st[j].back().first) { int r = st[j].back().second; int v = st[j].back().first; st[j].pop_back(); int l = st[j].back().second + 1; modify(1, 0, n - 1, l, r, -v); } } modify(1, 0, n - 1, st[j].back().second + 1, i, a[j]); st[j].push_back(make_pair(a[j], i)); } if (i > 0) { modify(1, 0, n - 1, 0, i - 1, -x[i - 1]); } ans = max(ans, query(1, 0, n - 1, 0, i)); } cout << ans << endl; } int main() { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:91:36: error: 'j' was not declared in this scope 91 | modify(1, 0, n - 1, st[j].back().second + 1, i, a[j]); | ^ a.cc:95:13: error: 'i' was not declared in this scope 95 | if (i > 0) { | ^ a.cc:98:46: error: 'i' was not declared in this scope 98 | ans = max(ans, query(1, 0, n - 1, 0, i)); | ^ a.cc: At global scope: a.cc:100:5: error: 'cout' does not name a type 100 | cout << ans << endl; | ^~~~ a.cc:101:1: error: expected declaration before '}' token 101 | } | ^
s304249722
p03833
C++
#include <algorithm> #include <cassert> #include <iostream> #include <vector> #include <cstdio> #include <complex> #include <cstring> using namespace std; typedef long long LL; const int N = 5000 + 5; const int M = 200 + 5; const int INF = 1000000000 + 5; int n, m; int x[N]; int a[M]; LL tag[N << 2]; LL maxv[N << 2]; vector<pair<int, int> > st[M]; void modify(int t, int l, int r, int a, int b, LL v) { if (b < l || r < a) return; if (a <= l && r <= b) { tag[t] += v; maxv[t] += v; return; } if (tag[t]) { tag[t << 1] += tag[t]; maxv[t << 1] += tag[t]; tag[t << 1 | 1] += tag[t]; maxv[t << 1 | 1] += tag[t]; tag[t] = 0; } int mid = (l + r) >> 1; modify(t << 1, l, mid, a, b, v); modify(t << 1 | 1, mid + 1, r, a, b, v); maxv[t] = max(maxv[t << 1], maxv[t << 1 | 1]); } LL query(int t, int l, int r, int a, int b) { if (b < l || r < a) return 0; if (a <= l && r <= b) { return maxv[t]; } if (tag[t]) { tag[t << 1] += tag[t]; maxv[t << 1] += tag[t]; tag[t << 1 | 1] += tag[t]; maxv[t << 1 | 1] += tag[t]; tag[t] = 0; } int mid = (l + r) >> 1; return max(query(t << 1, l, mid, a, b), query(t << 1 | 1, mid + 1, r, a, b)); } void solve() { cin >> n >> m; for(int i = 0; i < n - 1; ++ i) { scanf("%d", x + i); } long long ans = 0; for(int j = 0; j < m; ++ j) { st[j].push_back(make_pair(INF, -1)); } for(int i = 0; i < n; ++ i) { long long tmp = 0; for(int j = 0; j < m; ++ j) { scanf("%d", a + j); tmp += a[j]; } ans = max(ans, tmp); for(int j = 0; j < m; ++ j) { while (a[j] >= st[j].back().first) { int r = st[j].back().second; int v = st[j].back().first; st[j].pop_back(); int l = st[j].back().second + 1; modify(1, 0, n - 1, l, r, -v); } else { break; } } modify(1, 0, n - 1, st[j].back().second + 1, i, a[j]); st[j].push_back(make_pair(a[j], i)); } if (i > 0) { modify(1, 0, n - 1, 0, i - 1, -x[i - 1]); } ans = max(ans, query(1, 0, n - 1, 0, i)); } cout << ans << endl; } int main() { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:89:19: error: 'else' without a previous 'if' 89 | } else { | ^~~~ a.cc:93:36: error: 'j' was not declared in this scope 93 | modify(1, 0, n - 1, st[j].back().second + 1, i, a[j]); | ^ a.cc:97:13: error: 'i' was not declared in this scope 97 | if (i > 0) { | ^ a.cc:100:46: error: 'i' was not declared in this scope 100 | ans = max(ans, query(1, 0, n - 1, 0, i)); | ^ a.cc: At global scope: a.cc:102:5: error: 'cout' does not name a type 102 | cout << ans << endl; | ^~~~ a.cc:103:1: error: expected declaration before '}' token 103 | } | ^
s371772368
p03833
Java
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; static void solve() { int n = ni(); int m = ni(); int[] a = na(n-1); int[][] b = new int[n][]; for(int i = 0;i < n;i++){ b[i] = na(m); } long[][] imos = new long[n+2][n+2]; int[] row = new int[n]; int[] pw = new int[n]; int[] nw = new int[n]; for(int i = 0;i < m;i++){ for(int j = 0;j < n;j++)row[j] = b[j][i]; enumPrevWall(row, pw); enumNextWall(row, nw); for(int j = 0;j < n;j++){ // [pw[j]+1,j]*[j,nw[j]-1] add(imos, pw[j]+1, j, j, nw[j]-1, row[j]); } } for(int i = 0;i <= n;i++){ for(int j = 0;j <= n;j++){ imos[i][j+1] += imos[i][j]; } } for(int i = 0;i <= n;i++){ for(int j = 0;j <= n;j++){ imos[j+1][i] += imos[j][i]; } } long[] xs = new long[n]; for(int i = 0;i < n-1;i++){ xs[i+1] = xs[i] + a[i]; } long max = 0; for(int i = 0;i < n;i++){ for(int j = i;j < n;j++){ max = Math.max(max,-(xs[j]-xs[i])+imos[i][j]); } } out.println(max); } static void add(long[][] imos, int r1, int r2, int c1, int c2, long v) { imos[r1][c1] += v; imos[r1][c2+1] -= v; imos[r2+1][c1] -= v; imos[r2+1][c2+1] += v; } public static int[] enumPrevWall(int[] a, int[] L) { int n = a.length; for(int i = 0;i < n;i++){ L[i] = i-1; while(L[i] >= 0 && a[L[i]] < a[i])L[i] = L[L[i]]; } return L; } public static int[] enumNextWall(int[] a, int[] L) { int n = a.length; for(int i = n-1;i >= 0;i--){ L[i] = i+1; while(L[i] < n && a[L[i]] <= a[i])L[i] = L[L[i]]; } return L; } static long max = 0; // all, prefix, suffix static long[][] dfs(int l, int r, int[][] b, int[] a) { if(r-l == 1){ long[][] rets = new long[3][m+1]; long t = 0; for(int i = 1;i <= m;i++){ t += b[l][m-i]; rets[0][i] = t; rets[1][i] = t; rets[2][i] = t; } max = Math.max(max, rets[0][m]); tr(rets, l, max); return rets; } int h = (l+r)/2; long[][] L = dfs(l, h, b, a); long[][] R = dfs(h, r, b, a); tr("L", L); tr("R", R); for(int i = 1;i < m;i++){ int j = m-i; max = Math.max(max, L[2][i]+R[1][j]-a[h-1]); tr(l, r, max, i, j); } long[][] rets = new long[3][m+1]; for(int i = 0;i <= m;i++){ rets[0][i] = Long.MIN_VALUE; rets[1][i] = L[1][i]; rets[2][i] = R[2][i]; for(int j = 0;j <= i;j++){ rets[1][i] = Math.max(rets[1][i], L[0][j]+R[1][i-j]-a[h-1]); rets[2][i] = Math.max(rets[2][i], L[2][j]+R[0][i-j]-a[h-1]); rets[0][i] = Math.max(rets[0][i], L[0][j]+R[0][i-j]-a[h-1]); } } return rets; } public static void main(String[] args) throws Exception { long S = System.currentTimeMillis(); is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); solve(); out.flush(); long G = System.currentTimeMillis(); tr(G-S+"ms"); } private static boolean eof() { if(lenbuf == -1)return true; int lptr = ptrbuf; while(lptr < lenbuf)if(!isSpaceChar(inbuf[lptr++]))return false; try { is.mark(1000); while(true){ int b = is.read(); if(b == -1){ is.reset(); return true; }else if(!isSpaceChar(b)){ is.reset(); return false; } } } catch (IOException e) { return true; } } private static byte[] inbuf = new byte[1024]; static int lenbuf = 0, ptrbuf = 0; private static int readByte() { if(lenbuf == -1)throw new InputMismatchException(); if(ptrbuf >= lenbuf){ ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf <= 0)return -1; } return inbuf[ptrbuf++]; } private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } // private static boolean isSpaceChar(int c) { return !(c >= 32 && c <= 126); } private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; } private static double nd() { return Double.parseDouble(ns()); } private static char nc() { return (char)skip(); } private static String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while(!(isSpaceChar(b))){ sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private static char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while(p < n && !(isSpaceChar(b))){ buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private static char[][] nm(int n, int m) { char[][] map = new char[n][]; for(int i = 0;i < n;i++)map[i] = ns(m); return map; } private static int[] na(int n) { int[] a = new int[n]; for(int i = 0;i < n;i++)a[i] = ni(); return a; } private static int ni() { int num = 0, b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static long nl() { long num = 0; int b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); } }
Main.java:96: error: cannot find symbol long[][] rets = new long[3][m+1]; ^ symbol: variable m location: class Main Main.java:98: error: cannot find symbol for(int i = 1;i <= m;i++){ ^ symbol: variable m location: class Main Main.java:99: error: cannot find symbol t += b[l][m-i]; ^ symbol: variable m location: class Main Main.java:104: error: cannot find symbol max = Math.max(max, rets[0][m]); ^ symbol: variable m location: class Main Main.java:114: error: cannot find symbol for(int i = 1;i < m;i++){ ^ symbol: variable m location: class Main Main.java:115: error: cannot find symbol int j = m-i; ^ symbol: variable m location: class Main Main.java:119: error: cannot find symbol long[][] rets = new long[3][m+1]; ^ symbol: variable m location: class Main Main.java:120: error: cannot find symbol for(int i = 0;i <= m;i++){ ^ symbol: variable m location: class Main 8 errors
s316092928
p03833
C++
for( auto i : rnd ){ long long mx[200]={}; int id[200]={}; long long dist = 0; for(int j = i ; j < min(i+200,N) ; ){ for(int k = 0 ; k < M ; k++){ mx[k] = max(mx[k],B[j][k]); } long long sub = 0; for(int k = 0 ; k < M ; k++){ sub += mx[k]; } ans = max(sub-dist,ans); //cout << sub << "|" << dist << "[" << i << "," << j << "]" << endl; int nx = N; for(int k = 0 ; k < M ; k++) id[k] = max(id[k], idx[k][j]); for(int k = 0 ; k < M ; k++) nx = min(id[k],nx); dist += A[nx-1] - (j?A[j-1]:0); //cout << j << "->" << nx << " " << N << endl; j = nx; //cout << i << " " << nx << endl; } }
a.cc:1:1: error: expected unqualified-id before 'for' 1 | for( auto i : rnd ){ | ^~~
s068628490
p03833
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 5e3 + 1; int n, m; int d[N]; int a[N]; int c[N][N]; ll f(int s) { for (int i = 0; i < m; i++) { d[i] = 0; } ll sum = 0; ll res = 0; for (int i = s; i < n; i++) { ll t = 0; for (int cur = 0; cur < m; cur++) { d[cur] = max(d[cur], c[i][cur]); t += d[cur]; } res = max(res, t - sum); sum += a[i]; } return res; } int main() { #ifdef ONPC freopen("a.in", "r", stdin); //freopen("a.out", "w", stdout); #else //freopen("a.in", "r", stdin); //freopen("a.out", "w", stdout); #endif ios::sync_with_stdio(0); cin >> n >> m; for (int i = 0; i < n - 1; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> c[i][j]; } } ll ans = f(n - 1); for (int it = 0; it < min(n, 3500); it++) { ans = max(ans, f(i)); } cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:60:26: error: 'i' was not declared in this scope; did you mean 'it'? 60 | ans = max(ans, f(i)); | ^ | it
s891759178
p03833
C++
#include <bits/stdc++.h> #define N (1<<13) #define ll long long #define M 1000000007 #define INF 1000000007 #define pii pair<int, int> #define pb push_back #define F first #define S second #define L length() - 1 using namespace std; ll a[200][2 * N][13]; ll d[5000]; ínt x[5000]; inline ll query (const int k, const int i, const int j) { int l = x[j - i + 1]; return max(a[k][i][l], a[k][j - (1<<l) + 1][l]); } int main () { cin.sync_with_stdio(false); cin.tie(0); int n, m; cin>>n>>m; for (int i = 2; i < 5000; i++) { x[i] = x[i / 2] + 1; } for (int i = 1; i < n; i++) { cin>>d[i]; d[i] += d[i - 1]; } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin>>a[j][i][0]; } } for (int i = 0; i < m; i++) { for (int k = 1; k < 13; k++) { for (int j = 0; j < n; j++) { a[i][j][k] = max(a[i][j][k - 1], a[i][j + (1<<(k - 1))][k - 1]); } } } ll ans = 0; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { ll s = -(d[j] - d[i]); for (int k = 0; k < m; k++) { s += query(k, i, j); } ans = max(ans, s); } } cout<<ans<<endl; }
a.cc:17:1: error: '\U000000ednt' does not name a type 17 | ínt x[5000]; | ^~~ a.cc: In function 'long long int query(int, int, int)': a.cc:20:17: error: 'x' was not declared in this scope 20 | int l = x[j - i + 1]; | ^ a.cc: In function 'int main()': a.cc:31:17: error: 'x' was not declared in this scope 31 | x[i] = x[i / 2] + 1; | ^
s379255454
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; s[5]=’ ’,s[13]=’ ’; for (int i = 0; i < s.size(); i++) { if ( s.at(i) == ',' ) { s.at(i) = ' '; } } cout << s << endl; } #include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; s[5]=' ',s[13]=' '; for (int i = 0; i < s.size(); i++) { if ( s.at(i) == ',' ) { s.at(i) = ' '; } } cout << s << endl; } 提出情報
a.cc:10:8: error: extended character ’ is not valid in an identifier 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc:10:10: error: extended character ’ is not valid in an identifier 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc:10:18: error: extended character ’ is not valid in an identifier 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc:10:20: error: extended character ’ is not valid in an identifier 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc: In function 'int main()': a.cc:10:8: error: '\U00002019' was not declared in this scope 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc: At global scope: a.cc:23:5: error: redefinition of 'int main()' 23 | int main() { | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() { | ^~~~ a.cc:39:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type 39 | 提出情報 | ^~~~~~~~
s520547852
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; s[5]=’ ’,s[13]=’ ’; for (int i = 0; i < s.size(); i++) { if ( s.at(i) == ',' ) { s.at(i) = ' '; } } cout << s << endl; }
a.cc:10:8: error: extended character ’ is not valid in an identifier 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc:10:10: error: extended character ’ is not valid in an identifier 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc:10:18: error: extended character ’ is not valid in an identifier 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc:10:20: error: extended character ’ is not valid in an identifier 10 | s[5]=’ ’,s[13]=’ ’; | ^ a.cc: In function 'int main()': a.cc:10:8: error: '\U00002019' was not declared in this scope 10 | s[5]=’ ’,s[13]=’ ’; | ^
s653680689
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for (int i = 0; i < s.size(); i++) { if ( s.at(i) == "," ) { s.at(i) = " "; } } cout << s << endl; }
a.cc: In function 'int main()': a.cc:11:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if ( s.at(i) == "," ) { | ~~~~~~~~^~~~~~ a.cc:12:19: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 12 | s.at(i) = " "; | ^~~ | | | const char*
s696153541
p03834
C++
s = list(input()) s[5] = ' ' s[13] = ' ' print(''.join(s))
a.cc:5:7: error: empty character constant 5 | print(''.join(s)) | ^~ a.cc:1:1: error: 's' does not name a type 1 | s = list(input()) | ^
s849306468
p03834
C++
#include <bits/stdc++.h> using namespace std; string a; int main () { cin >> a; a[5]=' '; a[13]=' '; cout << s << endl; }
a.cc: In function 'int main()': a.cc:10:11: error: 's' was not declared in this scope 10 | cout << s << endl; | ^
s088491887
p03834
C++
#include<stdio.h> #include<string.h> int main() { char s[25]; scanf("%s",&s); s[5]=" "; s[13]=" "; printf("%s",s); }
a.cc: In function 'int main()': a.cc:7:10: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 7 | s[5]=" "; | ^~~ | | | const char* a.cc:8:11: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 8 | s[13]=" "; | ^~~ | | | const char*
s308395505
p03834
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; getline(cin, s); for(i : s){ if(i==',') i=' '; } cout << s; }
a.cc: In function 'int main()': a.cc:8:15: error: found ':' in nested-name-specifier, expected '::' 8 | for(i : s){ | ^ | :: a.cc:8:13: error: 'i' has not been declared 8 | for(i : s){ | ^ a.cc:13:1: error: expected primary-expression before '}' token 13 | } | ^ a.cc:12:19: error: expected ')' before '}' token 12 | cout << s; | ^ | ) 13 | } | ~ a.cc:8:12: note: to match this '(' 8 | for(i : s){ | ^ a.cc:13:1: error: expected primary-expression before '}' token 13 | } | ^
s744780602
p03834
C++
#include <iostream> #include <string> using namespace std; int main() { string s, a, b, c; cin >> s; for (int i = 0; i < 6; i++) a[i] = s[i]; for (int i = 6; i < 14; i++) for (int j = 0; j < 8; j++) b[j] = s[i]; for (int i = 14; i < 19; i++) for (int k = 0; k < 5; k++) c[k] = s[i]; cout << a[i] << b[j] << c[k] << "\n"; }
a.cc: In function 'int main()': a.cc:16:19: error: 'i' was not declared in this scope 16 | cout << a[i] << b[j] << c[k] << "\n"; | ^ a.cc:16:27: error: 'j' was not declared in this scope 16 | cout << a[i] << b[j] << c[k] << "\n"; | ^ a.cc:16:35: error: 'k' was not declared in this scope 16 | cout << a[i] << b[j] << c[k] << "\n"; | ^
s594894806
p03834
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int main(){ string a; cin>>a; for(int i=0;i<19;i++){ if(a,at(i)==',') a,at(i)=' '; } cout<<a; return 0; }
a.cc: In function 'int main()': a.cc:10:10: error: 'at' was not declared in this scope; did you mean 'a'? 10 | if(a,at(i)==',') | ^~ | a
s899507083
p03834
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; int main() { string s; cin >> s; s.replace(5, 1, " ") s.replace(13, 1, " ") cout << s << "\n"; }
a.cc: In function 'int main()': a.cc:8:29: error: expected ';' before 's' 8 | s.replace(5, 1, " ") | ^ | ; 9 | s.replace(13, 1, " ") | ~
s128317839
p03834
C++
#include <bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; S.at(5) = ' '; S.at(13) = ' ' cout << S << endl; }
a.cc: In function 'int main()': a.cc:8:19: error: expected ';' before 'cout' 8 | S.at(13) = ' ' | ^ | ; 9 | cout << S << endl; | ~~~~
s857353799
p03834
C++
#include <iostream> #include<String> using namespace std; int main() { char s[19]; for(int i=0;i<19;i++) { cin>>s[i]; if(s[i]==',') { s[i]=' '; } } for(int j=0;j<19;j++) { cout<<s[j]; } return 0; }
a.cc:2:9: fatal error: String: No such file or directory 2 | #include<String> | ^~~~~~~~ compilation terminated.
s663666462
p03834
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s = "s1,s2,s3"; cout<<s1<<s2<<s3<<endl; }
a.cc: In function 'int main()': a.cc:5:8: error: 's1' was not declared in this scope; did you mean 's'? 5 | cout<<s1<<s2<<s3<<endl; | ^~ | s a.cc:5:12: error: 's2' was not declared in this scope; did you mean 's'? 5 | cout<<s1<<s2<<s3<<endl; | ^~ | s a.cc:5:16: error: 's3' was not declared in this scope; did you mean 's'? 5 | cout<<s1<<s2<<s3<<endl; | ^~ | s
s047281994
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<char> s(19); for (int i = 0; i < 19; i++) { cin >> s.at(i); if (s.at(i) == ',') s.at(i) = ' '; if (i + 1 == 19) { cout << s.at(i) << endl; } else { cout << s.at(i); }
a.cc: In function 'int main()': a.cc:15:10: error: expected '}' at end of input 15 | } | ^ a.cc:6:34: note: to match this '{' 6 | for (int i = 0; i < 19; i++) { | ^ a.cc:15:10: error: expected '}' at end of input 15 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s938721853
p03834
C++
#include <iostream> using namespace std; int main() { string s; cin>>s; s[5]=" "; s[13]=" "; cout<<s; }
a.cc: In function 'int main()': a.cc:7:14: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 7 | s[5]=" "; | ^~~ | | | const char* a.cc:8:15: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 8 | s[13]=" "; | ^~~ | | | const char*
s614635897
p03834
C++
#include <iostream> using namespace std; int main() { string S; cin >> S; for (int i = 0; i < S.length() - 1; i ++){ if (S[i] == ","){ S[i] == " "; } } cout << S << '\n'; }
a.cc: In function 'int main()': a.cc:8:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 8 | if (S[i] == ","){ a.cc:9:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | S[i] == " ";
s070087511
p03834
C++
print(input().replace(',',' '));
a.cc:1:6: error: expected constructor, destructor, or type conversion before '(' token 1 | print(input().replace(',',' ')); | ^
s588112587
p03834
C++
print(input().replace(',',' '))
a.cc:1:6: error: expected constructor, destructor, or type conversion before '(' token 1 | print(input().replace(',',' ')) | ^
s362331983
p03834
C++
#include<iostream> using namespace std; int main(){ string a, b, c; while(cin >> a >> ',' >> b >> ',' >> c){ cout << a << " " << b << " " << c; } }
a.cc: In function 'int main()': a.cc:5:18: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>' and 'char') 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ~~~~~~~~ ^~ ~~~ | | | | | char | std::basic_istream<char> In file included from /usr/include/c++/14/iostream:42, 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:5:21: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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>]' (near match) 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed: a.cc:5:21: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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>]' (near match) 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed: a.cc:5:21: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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>]' (near match) 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed: a.cc:5:21: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'char' 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ /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:5:21: error: invalid conversion from 'char' to 'void*' [-fpermissive] 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ | | | char a.cc:5:21: error: cannot bind rvalue '(void*)44' to 'void*&' /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>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:5:21: error: invalid conversion from 'char' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ | | | char /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match) 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed: a.cc:5:21: error: invalid conversion from 'char' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive] 5 | while(cin >> a >> ',' >> b >> ',' >> c){ | ^~~ | | | char /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Tr
s019665739
p03834
C
#include<iostream> using namespace std; int main(){ string a, b, c; cout << a << " " << b << " " << c; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s710131246
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string A; cin >> A; A[5] = " "; A[13] = " "; cout << A << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:10: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 7 | A[5] = " "; | ^~~ | | | const char* a.cc:8:11: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 8 | A[13] = " "; | ^~~ | | | const char*
s327292646
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; s[6] = s[14] = " "; cout << s; }
a.cc: In function 'int main()': a.cc:6:18: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 6 | s[6] = s[14] = " "; | ^~~ | | | const char*
s978169974
p03834
C++
#include<bits/stdc++.h> using namespace std; int main { string s; cin>>s; s[5]=' '; s[13]=' '; cout<<s<<endl; }
a.cc:3:5: error: cannot declare '::main' to be a global variable 3 | int main | ^~~~ a.cc:5:16: error: expected primary-expression before 's' 5 | string s; | ^ a.cc:5:16: error: expected '}' before 's' a.cc:4:1: note: to match this '{' 4 | { | ^ a.cc:6:5: error: 'cin' does not name a type 6 | cin>>s; | ^~~ a.cc:7:5: error: 's' does not name a type 7 | s[5]=' '; | ^ a.cc:8:5: error: 's' does not name a type 8 | s[13]=' '; | ^ a.cc:9:5: error: 'cout' does not name a type 9 | cout<<s<<endl; | ^~~~ a.cc:10:1: error: expected declaration before '}' token 10 | } | ^
s734696293
p03834
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; s.at(5)==" "; s.at(13)==" "; cout<<s<<endl; }
a.cc: In function 'int main()': a.cc:6:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 6 | s.at(5)==" "; | ~~~~~~~^~~~~ a.cc:7:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | s.at(13)==" "; | ~~~~~~~~^~~~~
s066580535
p03834
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; s.at(5)==" "; s.at(13)==" "; cout<<s<<endl; }
a.cc: In function 'int main()': a.cc:5:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 5 | s.at(5)==" "; | ~~~~~~~^~~~~ a.cc:6:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 6 | s.at(13)==" "; | ~~~~~~~~^~~~~
s542430935
p03834
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define mod 1000000007 int main(){ string s; vector<string> ans; string temp=""; for(int i-0;i<s.length();i++){ if(i==','){ ans.push_back(temp); temp=""; }else{ temp=temp+s[i]; } } for(int i=0;i<ans.size();i++){ cout<<ans[i]<<" "; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:14:12: error: expected ';' before '-' token 14 | for(int i-0;i<s.length();i++){ | ^ | ; a.cc:14:27: error: expected ')' before ';' token 14 | for(int i-0;i<s.length();i++){ | ~ ^ | ) a.cc:14:28: error: 'i' was not declared in this scope 14 | for(int i-0;i<s.length();i++){ | ^
s999839997
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s ; s.at(6) =" "; s.at(14)=" "; cout << s << endl; }
a.cc: In function 'int main()': a.cc:7:12: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 7 | s.at(6) =" "; | ^~~ | | | const char* a.cc:8:14: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 8 | s.at(14)=" "; | ^~~ | | | const char*
s178715799
p03834
C++
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, from, to) for (int i = from; i < (to); ++i) #define mp(x,y) make_pair(x,y) #define all(x) (x).begin(),(x).end() #define pb push_back using ll = long long; using vin=vector<int>; using vll=vector<ll>; using vst=vector<string>; using P = pair<int, int>; const int inf=1e9+7; const ll INF=1e18; template <typename T> void chmin(T &a, T b) { a = min(a, b); } template <typename T> void chmax(T &a, T b) { a = max(a, b); } template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; } template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; } const int dx[4] = { 1, 0, -1, 0 }; const int dy[4] = { 0, 1, 0, -1 }; int main(){cout<<fixed<<setprecision(10); string s; cin>>s; int n=s.size(); rep(i,0,n){ if(s[i]=='.')s[i]=" "; } cout<<s<<endl; }
a.cc: In function 'int main()': a.cc:28:31: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 28 | if(s[i]=='.')s[i]=" "; | ^~~ | | | const char*
s833085996
p03834
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; for(int i = 0; i<s.size(); i++) { cout<<s[i]; if(s[i]==",") { cout<<" "; } } return 0; }
a.cc: In function 'int main()': a.cc:9:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if(s[i]==",")
s634841019
p03834
C++
#include<bits/stdc++.h> using namespace std; int main(){ stirng s; cin >> s; for(int i=0;i<s.size();i++){ if(s[i]==','){ s[i]=' '; } } cout << s; }
a.cc: In function 'int main()': a.cc:4:3: error: 'stirng' was not declared in this scope 4 | stirng s; | ^~~~~~ a.cc:5:10: error: 's' was not declared in this scope 5 | cin >> s; | ^
s180688847
p03834
C++
#include <stdio.h> int main () { char str [25]; scanf ("%s", str);'' str [5] = ' '; str [13] = ' '; printf("%s\n", str); return 0; }
a.cc:5:27: error: empty character constant 5 | scanf ("%s", str);'' | ^~ a.cc: In function 'int main()': a.cc:5:29: error: expected ';' before 'str' 5 | scanf ("%s", str);'' | ^ | ; 6 | 7 | str [5] = ' '; | ~~~
s285576256
p03834
C++
#include <stdio.h> int main (){ char str [25] scanf ("%s", str) str [5] = ' '; str [13] = ' '; printf("%s\n", str); return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: expected initializer before 'scanf' 5 | scanf ("%s", str) | ^~~~~ a.cc:8:9: error: 'str' was not declared in this scope; did you mean 'std'? 8 | str [13] = ' '; | ^~~ | std
s597832262
p03834
C++
#include <stdio.h> #include <string.h> int main(){ char str[25]; scanf("%s", &str); str[5] = ' ' str[13] = ' '; printf("%s", str); return 0; }
a.cc: In function 'int main()': a.cc:8:21: error: expected ';' before 'str' 8 | str[5] = ' ' | ^ | ; 9 | str[13] = ' '; | ~~~
s223548400
p03834
C++
#include <stdio.h> #include <string.h> int main(){ char str[25]; scanf("%s", &str); str[5] = " "; str[13] = " "; printf("%s", str); return 0; }
a.cc: In function 'int main()': a.cc:8:18: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 8 | str[5] = " "; | ^~~ | | | const char* a.cc:9:19: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 9 | str[13] = " "; | ^~~ | | | const char*
s204888383
p03834
C++
#include<stdio.h> #include<string.h> int main() { char str[20] int i; scanf("%[^\n]" ,str); for(int i = 0; i < 19 ; i++){ if(str[i] == ','){ printf("%c" , str[i]); } } return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: expected initializer before 'int' 6 | int i; | ^~~ a.cc:7:25: error: 'str' was not declared in this scope; did you mean 'std'? 7 | scanf("%[^\n]" ,str); | ^~~ | std
s007533654
p03834
C++
int main() { char str[105] scanf("%s" ,str); for(int i = 0; i < strlen(str); i++){ if(str[i] == ',') { str[i] = " "; } } printf("%s" , str); return 0; }
a.cc: In function 'int main()': a.cc:4:5: error: expected initializer before 'scanf' 4 | scanf("%s" ,str); | ^~~~~ a.cc:6:31: error: 'str' was not declared in this scope; did you mean 'std'? 6 | for(int i = 0; i < strlen(str); i++){ | ^~~ | std a.cc:6:24: error: 'strlen' was not declared in this scope 6 | for(int i = 0; i < strlen(str); i++){ | ^~~~~~ a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | int main() a.cc:11:19: error: 'str' was not declared in this scope; did you mean 'std'? 11 | printf("%s" , str); | ^~~ | std a.cc:11:5: error: 'printf' was not declared in this scope 11 | printf("%s" , str); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int main()
s447258465
p03834
C++
#include<stdio.h> #include<string.h> int main() { char str[105] scanf("%s" ,str); char character = ' '; for(int i = 0; i < strlen(str); i++){ if(str[i] == ',') str[i] = character; } printf("%s" , str); return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: expected initializer before 'scanf' 6 | scanf("%s" ,str); | ^~~~~ a.cc:9:35: error: 'str' was not declared in this scope; did you mean 'std'? 9 | for(int i = 0; i < strlen(str); i++){ | ^~~ | std a.cc:13:23: error: 'str' was not declared in this scope; did you mean 'std'? 13 | printf("%s" , str); | ^~~ | std
s961773232
p03834
C
#include <stdio.h> #include <string.h> int main(){ char string[20]; int i; scanf("%[^\n]", string); for(i = 0; i < 19; i++){ if(str[i] == ','){ printf(" "); }else{ printf("%c", string[i]); } } }
main.c: In function 'main': main.c:13:10: error: 'str' undeclared (first use in this function) 13 | if(str[i] == ','){ | ^~~ main.c:13:10: note: each undeclared identifier is reported only once for each function it appears in
s723582475
p03834
C++
#include <stdio.h> int main () { char arr[25]; scanf("%[^\n]", arr); for(int i = 0; arr[i] != '\0'; i++) { if(arr[i] == ',') { arr[i] = ' '; printf("%s\n", arr) } } return 0; }
a.cc: In function 'int main()': a.cc:11:44: error: expected ';' before '}' token 11 | printf("%s\n", arr) | ^ | ; 12 | } | ~
s606324029
p03834
C
#include <stdio.h> int main(){ char a[101]; scanf("%s",&a); for (int i=0;i<0;i++){ if(a[i]==','){ a[i]==''; } } printf("%s",a); puts(""); return 0; }
main.c: In function 'main': main.c:9:23: error: empty character constant 9 | a[i]==''; | ^~
s156969323
p03834
C++
#include <string.h> #include <stdio.h> int main (){ char input[101]; scanf ("%s",input); for (int i=0; i<strlen(input);i++){ if (input[i]== 'a'){ input[i]= " "; } } printf(input); printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:9:35: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 9 | input[i]= " "; | ^~~ | | | const char*
s946342416
p03834
C++
a = input() for i in a: if (i != ','): print(i, end = "") else: print(end=" ") print("");
a.cc:1:1: error: 'a' does not name a type 1 | a = input() | ^
s416943610
p03834
C++
#include <bits/stdc++.h> using namespace std; int main(){ #include <bits/stdc++.h> typedef long long int ll; using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); string st; cin >> st; string c = ""; for(ll i=0; st[i]; i++){ if(st[i] != ',') c += st[i]; else{ cout << c << " "; c = ""; } } cout << c; return 0; }
a.cc: In function 'int main()': a.cc:9:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 9 | int main(){ | ^~ a.cc:9:9: note: remove parentheses to default-initialize a variable 9 | int main(){ | ^~ | -- a.cc:9:9: note: or replace parentheses with braces to value-initialize a variable a.cc:9:11: error: a function-definition is not allowed here before '{' token 9 | int main(){ | ^ a.cc:26:2: error: expected '}' at end of input 26 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s647477133
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for (int i = 0; i < 19; i++){ if(s.at.(i) == ','){ s.at(i) = ' '; } } cout << s << endl; }
a.cc: In function 'int main()': a.cc:8:10: error: invalid use of member function 'std::__cxx11::basic_string<char>::at' (did you forget the '()' ?) 8 | if(s.at.(i) == ','){ | ~~^~
s057950237
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string = s; cin >> s; for (int i = 0; i < 19; i++){ if(s.at.(i) == ','){ s.at(i) = ' '; } } cout << s << endl; }
a.cc: In function 'int main()': a.cc:5:10: error: expected unqualified-id before '=' token 5 | string = s; | ^ a.cc:6:10: error: 's' was not declared in this scope 6 | cin >> s; | ^ a.cc:8:13: error: expected unqualified-id before '(' token 8 | if(s.at.(i) == ','){ | ^
s380286396
p03834
C++
#include <bits/stdc++.h> using namespace std; int main() { string = s; cin >> s; for (int i = 0; i < 19; i++){ if(s.at.(i) == ','){ s.at(i) = ' '; } } cout << s << endl; }
a.cc: In function 'int main()': a.cc:5:10: error: expected unqualified-id before '=' token 5 | string = s; | ^ a.cc:6:10: error: 's' was not declared in this scope 6 | cin >> s; | ^ a.cc:8:13: error: expected unqualified-id before '(' token 8 | if(s.at.(i) == ','){ | ^
s354725989
p03834
C
#include <stdio.h> int main(void){ char s[20]; scanf("%s", s); for(int i=0; i<=19; i++){ if (s[i] == ','){ printf("%c",' '; }else{ printf(s[i]); } } return 0; }
main.c: In function 'main': main.c:8:22: error: expected ')' before ';' token 8 | printf("%c",' '; | ~ ^ | ) main.c:8:23: error: expected ';' before '}' token 8 | printf("%c",' '; | ^ | ; 9 | }else{ | ~ main.c:10:15: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion] 10 | printf(s[i]); | ~^~~ | | | char In file included from main.c:1: /usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'char' 363 | extern int printf (const char *__restrict __format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
s161842012
p03834
C
#include <stdio.h> int main(void){ char s[20]; scanf("%s", s); for(int i=0; i<=19; i++){ if (s[i] == ','){ printf = ' '; }else{ printf(s[i]); } } return 0; }
main.c: In function 'main': main.c:8:14: error: lvalue required as left operand of assignment 8 | printf = ' '; | ^ main.c:10:15: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion] 10 | printf(s[i]); | ~^~~ | | | char In file included from main.c:1: /usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'char' 363 | extern int printf (const char *__restrict __format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
s889164508
p03834
C
#include <stdio.h> int main(void){ char s[19]; scanf("%s", s); for(int i=0, i<=19, i++){ if (s[i] == ','){ printf = ' '; }else{ printf(s[i]); } } return 0; }
main.c: In function 'main': main.c:6:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token 6 | for(int i=0, i<=19, i++){ | ^~ main.c:13:3: error: expected expression before 'return' 13 | return 0; | ^~~~~~ main.c:14:1: error: expected expression before '}' token 14 | } | ^ main.c:14:1: error: expected expression before '}' token
s298418079
p03834
C++
program prob1 implicit none character(19) :: s, t, u, v read(*,*) s, t, u v = trim(adjustl(s)) // ' ' // trim(adjustl(t)) // ' ' // trim(adjustl(u)) write(*,'(a)') v stop contains end program prob1
a.cc:6:13: warning: multi-character character constant [-Wmultichar] 6 | write(*,'(a)') v | ^~~~~ a.cc:1:1: error: 'program' does not name a type 1 | program prob1 | ^~~~~~~
s516518363
p03834
C++
#include <bits/stdc++.h> #include <vector> #include <algorithm> #include <iostream> using namespace std; int main() { string s; cin >> s; s.at(5)=" "; s.at(12)=" "; cout << s << endl; }
a.cc: In function 'int main()': a.cc:10:11: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 10 | s.at(5)=" "; | ^~~ | | | const char* a.cc:11:12: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 11 | s.at(12)=" "; | ^~~ | | | const char*
s359745999
p03834
C++
#include<stdio.h> int main() { int i; char st[25]; gets(st); st[5]=' '; st[13]=' '; printf("%s\n",st); return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(st); | ^~~~ | getw
s021402372
p03834
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.next(); System.out.println(s.replace(",", " "); } }
Main.java:7: error: ')' or ',' expected System.out.println(s.replace(",", " "); ^ 1 error
s939541798
p03834
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s[] = sc.next().split(","); System.out.println(s.join(" ")); } }
Main.java:7: error: cannot find symbol System.out.println(s.join(" ")); ^ symbol: method join(String) location: variable s of type String[] 1 error
s862060471
p03834
C++
#include <bits/stdc++.h> using namespace std; int main(void){ string S; cin >> S; S[5]= ’ ’,S[13]=’ ’; cout << S << endl; }
a.cc:7:8: error: extended character ’ is not valid in an identifier 7 | S[5]= ’ ’,S[13]=’ ’; | ^ a.cc:7:10: error: extended character ’ is not valid in an identifier 7 | S[5]= ’ ’,S[13]=’ ’; | ^ a.cc:7:18: error: extended character ’ is not valid in an identifier 7 | S[5]= ’ ’,S[13]=’ ’; | ^ a.cc:7:20: error: extended character ’ is not valid in an identifier 7 | S[5]= ’ ’,S[13]=’ ’; | ^ a.cc: In function 'int main()': a.cc:7:8: error: '\U00002019' was not declared in this scope 7 | S[5]= ’ ’,S[13]=’ ’; | ^
s824217662
p03834
C++
#include <bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; S[5] == " "; S[13] == " "; S[19] == " "; cout << S << endl; }
a.cc: In function 'int main()': a.cc:7:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | S[5] == " "; S[13] == " "; S[19] == " "; a.cc:7:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | S[5] == " "; S[13] == " "; S[19] == " "; a.cc:7:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | S[5] == " "; S[13] == " "; S[19] == " ";
s158738314
p03834
C++
#include <bits/stdc++.h> using namespace std; int main(void){ string s; cin >> s; int len = s.size(); for(int i=0;i<s;i++){ if(s[i] == ',') s[i] = ' '; cout << s[i]; } cout <<endl; }
a.cc: In function 'int main()': a.cc:9:16: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 9 | for(int i=0;i<s;i++){ | ~^~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | int In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:9:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:9:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:9:17: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:9:17: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 9 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution fa
s286900444
p03834
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; using P = pair<int, int>; using ll = long long; int main() { string s; cin >> s; rep(i,s.size()){ if(s[i] == ",") cout << " " << endl; else cout << s[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(s[i] == ",") cout << " " << endl;
s943635235
p03834
C++
#include <bits/stdc++.h> #include <math.h> #define _GLIBCXX_DEBUG using namespace std; int main() { string S;cin>>S; S[5]=" "; S[13]=" "; cout<<S<<endl; }
a.cc: In function 'int main()': a.cc:7:8: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 7 | S[5]=" "; | ^~~ | | | const char* a.cc:8:9: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 8 | S[13]=" "; | ^~~ | | | const char*
s208211334
p03834
C++
string s; cout<<"Enter your string"<<endl;; cin>>s; s[5]=' '; s[13]=' '; cout<<s;
a.cc:1:2: error: 'string' does not name a type 1 | string s; | ^~~~~~ a.cc:2:5: error: 'cout' does not name a type 2 | cout<<"Enter your string"<<endl;; | ^~~~ a.cc:3:3: error: 'cin' does not name a type 3 | cin>>s; | ^~~ a.cc:4:3: error: 's' does not name a type 4 | s[5]=' '; | ^ a.cc:5:2: error: 's' does not name a type 5 | s[13]=' '; | ^ a.cc:6:1: error: 'cout' does not name a type 6 | cout<<s; | ^~~~
s427652874
p03834
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; s.at(6)=" "; s.at(14)=" "; cout << s << endl; }
a.cc: In function 'int main()': a.cc:7:11: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 7 | s.at(6)=" "; | ^~~ | | | const char* a.cc:8:12: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 8 | s.at(14)=" "; | ^~~ | | | const char*
s356781229
p03834
C++
#include<iostream> #include<string> using namespace std; int main() { string s; cin>>s; for(i=0;i<s.length();i++) { if(s[i]==',') s[i]=' '; } cout<<s<<endl; }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=0;i<s.length();i++) | ^
s324376308
p03834
C++
// #pragma GCC target("avx2") #pragma GCC optimize("O3", "unroll-loops") // #include <bits/extc++.h> // using namespace __gnu_pbds; #include <bits/stdc++.h> using namespace std; #define int long long #define double long double // template <typename T> // using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; using pii = pair<int, int>; template<typename T> using prior = priority_queue<T, vector<T>, greater<T>>; template<typename T> using Prior = priority_queue<T>; #define X first #define Y second #define ALL(x) (x).begin(), (x).end() #define eb emplace_back #define pb push_back #define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define RANDOM() random_device __rd; \ mt19937 __gen = mt19937(__rd()); \ uniform_int_distribution<int> __dis(1, 1E8); \ auto rnd = bind(__dis, __gen) const int INF = 1E18; const int mod = 1E9 + 7; int32_t main() { fastIO(); string s; cin >> s; cout << regex_replace(s, ",", " ") << "\n"; return 0; }
a.cc: In function 'int32_t main()': a.cc:40:26: error: no matching function for call to 'regex_replace(std::string&, const char [2], const char [2])' 40 | cout << regex_replace(s, ",", " ") << "\n"; | ~~~~~~~~~~~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:7: /usr/include/c++/14/bits/regex.h:2576:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type, class _St, class _Sa> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2576 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2576:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2602:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2602 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2602:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2628:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa, class _Fst, class _Fsa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _Fst, _Fsa>&, regex_constants::match_flag_type)' 2628 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2628:5: note: template argument deduction/substitution failed: a.cc:40:26: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [2]' 40 | cout << regex_replace(s, ",", " ") << "\n"; | ~~~~~~~~~~~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2654 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: template argument deduction/substitution failed: a.cc:40:26: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [2]' 40 | cout << regex_replace(s, ",", " ") << "\n"; | ~~~~~~~~~~~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2680 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: template argument deduction/substitution failed: a.cc:40:26: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 40 | cout << regex_replace(s, ",", " ") << "\n"; | ~~~~~~~~~~~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: candidate: 'template<class _Rx_traits, class _Ch_type> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2706 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: template argument deduction/substitution failed: a.cc:40:26: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 40 | cout << regex_replace(s, ",", " ") << "\n"; | ~~~~~~~~~~~~~^~~~~~~~~~~~~