submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s826286681
p03735
C++
#include <vector> #include <algorithm> #include <set> #include <map> #include <list> #include <queue> #include <deque> #include <string> #include <iostream> #include <climits> using namespace std; #define int long long const int INF = LLONG_MAX/10; typedef pair<int, int> PII; int N; vector<int> x, y; signed main() { PII ma(-INF, 0), mi(INF, 0); cin >> N; x.resize(N); y.resize(N); for (int i = 0; i < N; i++) { cin >> x[i] >> y[i]; if (x[i] > y[i]) swap(x[i], y[i]); ma = max(ma, PII(y[i], i)); mi = min(mi, PII(x[i], i)); } int a = x[ma.second], b = y[mi.second]; int ans = INF; { vector<PII> v; v.reserve(N); for (int i = 0; i < N; i++) { if (ma.second == i || mi.second == i) continue; v.push_back(PII(x[i], y[i])); } int bMin = min(a, b), bMax = max(v[v.size() - 2].first, max(a, b)); ans = min( ans, (ma.first - mi.first)*(bMax - min(v[0].first, bMin)) ); for (int i = 0; i < v.size(); i++) { bMin = min(bMin, v[i].second); bMax = max(bMax, v[i].second); ans = min(ans, (ma.first - mi.first)*(bMax - min(bMin, v[i].first))); } } { int rMin = b, bMax = a; for (int i = 0; i < N; i++) { rMin = min(rMin, y[i]); bMax = max(bMax, x[i]); } ans = min(ans, (ma.first - rMin)*(bMax - mi.first))); } printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:59:68: error: expected ';' before ')' token 59 | ans = min(ans, (ma.first - rMin)*(bMax - mi.first))); | ^ | ;
s457125110
p03735
C++
#include <vector> #include <algorithm> #include <set> #include <map> #include <list> #include <queue> #include <deque> #include <string> #include <iostream> using namespace std; #define int long long const int INF = LLONG_MAX/10; typedef pair<int, int> PII; int N; vector<int> x, y; signed main() { PII maxX = PII(-INF, 0), maxY = PII(-INF, 0), ma, minX = PII(INF, 0), minY = PII(INF, 0), mi; cin >> N; x.resize(N); y.resize(N); for (int i = 0; i < N; i++) { cin >> x[i] >> y[i]; maxX = max(maxX, PII(x[i], i)); maxY = max(maxY, PII(y[i], i)); minX = min(minX, PII(x[i], i)); minY = min(minY, PII(y[i], i)); } if (maxX < maxY) { swap(maxX, maxY); swap(minX, minY); swap(x, y); } mi = min(minX, minY); ma = max(maxX, maxY); int ans = 0; int a = y[maxX.second], b = (minX < minY) ? y[minX.second] : x[minY.second]; { int bMax = max(a, b), bMin = min(a, b); for (int i = 0; i < N; i++) { if (mi.second == i || ma.second == i) continue; bMax = max(bMax, min(x[i], y[i])); bMin = min(bMin, max(x[i], y[i])); } ans = (ma.first - mi.first)*(bMax - bMin); } { int bMax = a, aMin = b; for (int i = 0; i < N; i++) { if (mi.second == i || ma.second == i) continue; bMax = max(bMax, min(x[i], y[i])); aMin = min(aMin, max(x[i], y[i])); } ans = min(ans, (ma.first - aMin)*(bMax - mi.first)); } printf("%lld\n", ans); return 0; }
a.cc:13:17: error: 'LLONG_MAX' was not declared in this scope 13 | const int INF = LLONG_MAX/10; | ^~~~~~~~~ a.cc:10:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 9 | #include <iostream> +++ |+#include <climits> 10 | using namespace std;
s008341167
p03735
C++
#include <bits\stdc++.h> using namespace std; #define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i)) #define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i)) #define REVERSE(i,n) for(int (i) = n-1;(i) >= 0 ; --i) #define ALL(c) (c).begin() , (c).end() #define LL long long #define int LL #define inf (1LL << 60) #define mod 1000000007 #define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0); #define lower lower_bound #define upper upper_bound #define ZERO(c,n) memset(&c[0],0,sizeof(int)*n) #define ZERO2(c,n) memset(&c[0][0],0,sizeof(int)*n #define pl(a) cout << ""#a": " << a << endl; #ifdef _DEBUG #define debug_io fstream cin("input.txt");ofstream cout("output.txt"); #else #define debug_io ; #endif #define debug_input debug_io #define DOWN(T) std::greater<T>() template<class T>void scan(vector<T>& a, int n, istream& cin) { T c; REP(i, n) { cin >> c; a.push_back(c); } } using vs = vector<string>; using vi = vector<int>; using pii = pair<int, int>; using psi = pair<string, int>; using vvi = vector<vi>; using pss = pair<string, string>; using vpii = vector<pii>; template<class T>bool valid(T x, T w) { return 0 <= x&&x < w; } int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 }; //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- bool ed[200001]; signed main() { QUICK_CIN; debug_input; int n; cin >> n; vpii balls; vpii aballs; REP(i, n) { int c, d; cin >> c >> d; balls.push_back({ c,d }); aballs.push_back({ c,i }); aballs.push_back({ d,i }); } vi r, b; REP(i, n) { r.push_back(max(balls[i].first, balls[i].second)); b.push_back(min(balls[i].first, balls[i].second)); } sort(ALL(r)); sort(ALL(b)); int cand1 = (r.back() - r[0])*(b.back() - b[0]); sort(ALL(aballs)); int rc = aballs.back().first - aballs[0].first; set<pii> select; int min_d = inf; REP(i, n) { select.insert({ min(balls[i].first,balls[i].second),i }); } REP(i, n) { min_d = min(min_d, select.rbegin()->first - select.begin()->first); auto it = select.begin()->second; select.erase(select.begin()); select.insert({ max(balls[it].first ,balls[it].second),it }); } cout << min(cand1, rc*min_d) << endl; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s108091133
p03735
C++
#include <bits\stdc++.h> using namespace std; #define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i)) #define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i)) #define REVERSE(i,n) for(int (i) = n-1;(i) >= 0 ; --i) #define ALL(c) (c).begin() , (c).end() #define LL long long #define int LL #define inf (1LL << 60) #define mod 1000000007 #define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0); #define lower lower_bound #define upper upper_bound #define ZERO(c,n) memset(&c[0],0,sizeof(int)*n) #define ZERO2(c,n) memset(&c[0][0],0,sizeof(int)*n #define pl(a) cout << ""#a": " << a << endl; #ifdef _DEBUG #define debug_io fstream cin("input.txt");ofstream cout("output.txt"); #else #define debug_io ; #endif #define debug_input debug_io #define DOWN(T) std::greater<T>() template<class T>void scan(vector<T>& a, int n, istream& cin) { T c; REP(i, n) { cin >> c; a.push_back(c); } } using vs = vector<string>; using vi = vector<int>; using pii = pair<int, int>; using psi = pair<string, int>; using vvi = vector<vi>; using pss = pair<string, string>; using vpii = vector<pii>; template<class T>bool valid(T x, T w) { return 0 <= x&&x < w; } int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 }; //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- bool ed[200001]; signed main() { QUICK_CIN; debug_input; int n; cin >> n; vpii balls; vpii aballs; REP(i, n) { int c, d; cin >> c >> d; balls.push_back({ c,d }); aballs.push_back({ c,i }); aballs.push_back({ d,i }); } vi r, b; REP(i, n) { r.push_back(max(balls[i].first, balls[i].second)); b.push_back(min(balls[i].first, balls[i].second)); } sort(ALL(r)); sort(ALL(b)); int cand1 = (r.back() - r[0])*(b.back() - b[0]); sort(ALL(aballs)); int rc = aballs.back().first - aballs[0].first; set<pii> select; int min_d = inf; REP(i, n) { select.insert({ min(balls[i].first,balls[i].second),i }); } REP(i, n) { min_d = min(min_d, select.rbegin()->first - select.begin()->first); auto it = select.begin()->second; select.erase(select.begin()); select.insert({ max(balls[it].first ,balls[it].second),it }); } cout << min(cand1, rc*min_d) << endl; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s207595430
p03735
C++
#include <bits\stdc++.h> using namespace std; #define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i)) #define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i)) #define REVERSE(i,n) for(int (i) = n-1;(i) >= 0 ; --i) #define ALL(c) (c).begin() , (c).end() #define LL long long #define int LL #define inf (1LL << 60) #define mod 1000000007 #define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0); #define lower lower_bound #define upper upper_bound #define ZERO(c,n) memset(&c[0],0,sizeof(int)*n) #define ZERO2(c,n) memset(&c[0][0],0,sizeof(int)*n #define pl(a) cout << ""#a": " << a << endl; #ifdef _DEBUG #define debug_io fstream cin("input.txt");ofstream cout("output.txt"); #else #define debug_io ; #endif #define debug_input debug_io #define DOWN(T) std::greater<T>() template<class T>void scan(vector<T>& a, int n, istream& cin) { T c; REP(i, n) { cin >> c; a.push_back(c); } } using vs = vector<string>; using vi = vector<int>; using pii = pair<int, int>; using psi = pair<string, int>; using vvi = vector<vi>; using pss = pair<string, string>; using vpii = vector<pii>; template<class T>bool valid(T x, T w) { return 0 <= x&&x < w; } int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 }; //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- signed main() { QUICK_CIN; debug_input; int n; cin >> n; vpii balls; vpii aballs; REP(i, n) { int c, d; cin >> c >> d; balls.push_back({ c,d }); aballs.push_back({ c,i }); aballs.push_back({ d,i }); } vi r, b; REP(i, n) { r.push_back(max(balls[i].first, balls[i].second)); b.push_back(min(balls[i].first, balls[i].second)); } sort(ALL(r)); sort(ALL(b)); int cand1 = (r.back() - r[0])*(b.back() - b[0]); sort(ALL(aballs)); int rc = aballs.back().first - aballs[0].first; int itmin = aballs.back().second; int itmax = aballs[0].second; int bmin_t = min(balls[itmin].first, balls[itmin].second); int bmax_t = max(balls[itmax].first, balls[itmax].second); int bmin = min(bmin_t, bmax_t); int bmax = max(bmin_t, bmax_t); set<int> index; index.insert(itmin); index.insert(itmax); for (auto x : aballs) { if (bmin <= x.first && x.first <= bmax) { index.insert(x.second); } } for (auto x : aballs) { if (index.find(x.second) == index.end()) { bmin = min(bmin, x.first); bmax = max(bmax, x.first); } } cout << min(rc*(bmax - bmin), cand1) << endl; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s029828236
p03735
C++
start
a.cc:1:1: error: 'start' does not name a type 1 | start | ^~~~~
s695515880
p03735
C++
#include <iostream> using namespace std; struct ioi{ int x,y; }p[200010]; int n; long long res,res2; int main(){ //freopen("input.txt","r",stdin); cin >> n; if (n==1) { cout << 0; return 0; } for (int i=1;i<=n;i++){ cin >> p[i].x >> p[i].y; if (p[i].x < p[i].y) swap(p[i].x, p[i].y); } sort(p+1,p+n+1,[](ioi a,ioi b){ return (a.x<b.x); }); res=p[n].x-p[1].x; sort(p+1,p+n+1,[](ioi a,ioi b){ return (a.y<b.y); }); res*=p[n].y-p[1].y; sort(p+1,p+n+1,[](ioi a,ioi b){ return (a.x<b.x); }); sort(p+1,p+n,[](ioi a,ioi b){ return (a.y<b.y); }); res2=p[n].x-p[1].y; long long t1=p[n].y,t2=p[1].x,t3=-1e9,t4=1e9,rr=1e9; if (t1>t2) swap(t1,t2); for (int i=2;i<n;i++) t3=max(t3,1LL*p[i].x),t4=min(t4,1ll*p[i].x); t4=min(t1,t4); t3=max(t2,t3); rr=min(rr,t3-t4); t3=-1e9,t4=1e9; for (int i=2;i<n;i++) t3=max(t3,1ll*p[i].y),t4=min(t4,1ll*p[i].y); t4=min(t1,t4); t3=max(t2,t3); rr=min(rr,t3-t4); res2*=rr; cout << min(res,res2); }
a.cc: In function 'int main()': a.cc:24:9: error: 'sort' was not declared in this scope; did you mean 'short'? 24 | sort(p+1,p+n+1,[](ioi a,ioi b){ | ^~~~ | short
s473406295
p03735
C++
#include <iostream> #include <utility> #include <vector> #include <climits> #include <algorithm> using namespace std; int main(void) { int N; vector<pair<int, int>> list; cin >> N; list.reserve(N); for (int i = 0; i < N; ++i) { int x, y; cin >> x >> y; if (x < y) { list.emplace_back(x, y); } else { list.emplace_back(y, x); } } // case R_max = max, B_min = min: // R <- bigger, B <- smaller int R_max = INT_MIN; int R_min = INT_MAX; int B_max = INT_MIN; int B_min = INT_MAX; for (int i = 0; i < N; ++i) { int bigger = list[i].second; int smaller = list[i].first; R_max = max(R_max, bigger); R_min = min(R_min, bigger); B_max = max(B_max, smaller); B_min = min(B_min, smaller); } long long result = long long(R_max - R_min) * long long(B_max - B_min); int max_of_all = R_max; int min_of_all = B_min; int second_min = R_min; // case B_max = max, B_min = min: // minimize R_max - R_min sort(begin(list), end(list)); R_max = list[list.size() - 1].first; R_min = INT_MAX; int R_range = R_max - list[0].first; for (int i = 0; i < N - 1; ++i) { R_max = max(R_max, list[i].second); if (R_min <= list[i].first) { break; } R_min = min(R_min, list[i].second); int R_min_ = min(R_min, list[i + 1].first); R_range = min(R_range, R_max - R_min_); } result = min(result, long long(R_range) * long long(max_of_all - min_of_all)); cout << result << endl; }
a.cc: In function 'int main()': a.cc:45:28: error: expected primary-expression before 'long' 45 | long long result = long long(R_max - R_min) * long long(B_max - B_min); | ^~~~ a.cc:69:30: error: expected primary-expression before 'long' 69 | result = min(result, long long(R_range) * long long(max_of_all - min_of_all)); | ^~~~
s338490893
p03735
C++
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <algorithm> #include <climits> #include <cstring> #include <string> #include <set> #include <bitset> #include <map> #include <queue> #include <stack> #include <vector> #include <cassert> #include <ctime> #define rep(i,m,n) for(i=m;i<=n;i++) #define mod 1000000009 #define inf 0x3f3f3f3f #define vi vector<int> #define pb push_back #define mp make_pair #define fi first #define se second #define ll long long #define pi acos(-1.0) #define pii pair<int,int> #define sys system("pause") const int maxn=2e5+10; const int N=2e5+10; using namespace std; ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);} ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;} int n,m,k,t,a[maxn],b[maxn],id[maxn],ama,bma,ami=1e9,bmi=1e9,dma,dmi=1e9; bool cmp(int x,int y){return a[x]<a[y];} int main() { int i,j; scanf("%d",&n); rep(i,1,n) { scanf("%d%d",&a[i],&b[i]); if(a[i]>b[i])swap(a[i],b[i]); id[i]=i; ama=max(ama,a[i]); ami=min(ami,a[i]); bma=max(bma,b[i]); bmi=min(bmi,b[i]); } printf("%lld\n",ret); return 0; }
a.cc: In function 'int main()': a.cc:51:21: error: 'ret' was not declared in this scope; did you mean 'rep'? 51 | printf("%lld\n",ret); | ^~~ | rep
s199236428
p03735
C++
#include <iostream> #include <cstdio> #include <set> #include <map> #include <algorithm> #define pb push_back #define fi first #define se second #define mp make_pair using namespace std; map<int, int> H[2]; set<int> S[2]; typedef pair<int, int> PII; typedef long long LL; vector<PII> V; inline void Insert(int x, int v){ H[x][v]++; S[x].insert(v); } inline void Erase(int x, int v){ if(H[x][v] == 1) S[x].erase(v); H[x][v]--; } int N, x, y; int Rmax, Rmin, Bmax, Bmin, tRmax, tRmin, tBmax, tBmin; int main() { cin>>N; for(int i = 0; i < N; i++){ scanf("%d %d", &x, &y); if(x < y) swap(x, y); V.pb(mp(x, y)); } sort(V.begin(), V.end()); reverse(V.begin(), V.end()); LL ans = 2e18; for(auto x : V){ Insert(0, x.fi); Insert(1, x.se); } Rmax = Rmin = V[0].fi; Bmax = Bmin = V[0].se; Erase(0, V[0].fi); Erase(1, V[0].se); for(int i = 1; i < V.size(); i++){ tRmax = Rmax; tRmin = Rmin; tBmax = Bmax; tBmin = Bmin; tRmin = min(tRmin, V[i].se); tBmax = max(tBmax, V[i].fi); tBmin = min(tBmin, V[i].fi); Erase(0, V[i].fi); Erase(1, V[i].se); if(S[0].size() > 0){ tRmin = min(tRmin, *S[1].begin()); tBmin = min(tBmin, *S[0].begin()); } ans = min(ans, (LL)(tRmax - tRmin)*(tBmax - tBmin)); Rmin = min(Rmin, V[i].fi); Bmax = max(Bmax, V[i].se); Bmin = min(Bmin, V[i].se); } ans = min(ans, (LL)(Rmax - Rmin)*(Bmax - Bmin)); cout<<ans<<endl; }
a.cc:15:1: error: 'vector' does not name a type 15 | vector<PII> V; | ^~~~~~ a.cc: In function 'int main()': a.cc:35:9: error: 'V' was not declared in this scope 35 | V.pb(mp(x, y)); | ^ a.cc:37:10: error: 'V' was not declared in this scope 37 | sort(V.begin(), V.end()); | ^
s199996527
p03735
C++
#include <iostream> #include <cstdio> #include <set> #include <map> #include <algorithm> #define pb push_back #define fi first #define se second #define mp make_pair using namespace std; map<int, int> H[2]; set<int> S[2]; typedef pair<int, int> PII; typedef long long LL; vector<PII> V; inline void Insert(int x, int v){ H[x][v]++; S[x].insert(v); } inline void Erase(int x, int v){ if(H[x][v] == 1) S[x].erase(v); H[x][v]--; } int N, x, y; int Rmax, Rmin, Bmax, Bmin, tRmax, tRmin, tBmax, tBmin; int main() { cin>>N; for(int i = 0; i < N; i++){ scanf("%d %d", &x, &y); if(x < y) swap(x, y); V.pb(mp(x, y)); } sort(V.begin(), V.end()); reverse(V.begin(), V.end()); LL ans = 2e18; for(auto x : V){ Insert(0, x.fi); Insert(1, x.se); } Rmax = Rmin = V[0].fi; Bmax = Bmin = V[0].se; Erase(0, V[0].fi); Erase(1, V[0].se); for(int i = 1; i < V.size(); i++){ tRmax = Rmax; tRmin = Rmin; tBmax = Bmax; tBmin = Bmin; tRmin = min(tRmin, V[i].se); tBmax = max(tBmax, V[i].fi); tBmin = min(tBmin, V[i].fi); Erase(0, V[i].fi); Erase(1, V[i].se); if(S[0].size() > 0){ tRmin = min(tRmin, *S[1].begin()); tBmin = min(tBmin, *S[0].begin()); } ans = min(ans, (LL)(tRmax - tRmin)*(tBmax - tBmin)); Rmin = min(Rmin, V[i].fi); Bmax = max(Bmax, V[i].se); Bmin = min(Bmin, V[i].se); } ans = min(ans, (LL)(Rmax - Rmin)*(Bmax - Bmin)); cout<<ans<<endl; }
a.cc:15:1: error: 'vector' does not name a type 15 | vector<PII> V; | ^~~~~~ a.cc: In function 'int main()': a.cc:35:9: error: 'V' was not declared in this scope 35 | V.pb(mp(x, y)); | ^ a.cc:37:10: error: 'V' was not declared in this scope 37 | sort(V.begin(), V.end()); | ^
s798775381
p03735
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for(int i = 0; i < (n); i++) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) typedef long long ll; int n; pair<pair<ll, ll>, int > p[200005]; ll INF = 1000000000000000000; int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> n; ll mama = -1, mimi = INF, mami = INF, mima = -1, mai, mii; FOR(i, n) { ll x, y; cin >> x >> y; if (x > y) swap(x, y); if (x < mimi) { mimi = x; mii = i; } mima = max(mima, x); if (mama < y) { mama = y; mai = i; } mami = min(mami, y); p[i] = make_pair(make_pair(x, y), i); } ll res = (mama-mami) * (mima-mimi); if (mai == mii) { cout << res << endl; return 0; } p[mii].first.first = p[mii].first.second; sort(p, p+n); ll dif = p[n-1].first.first - p[0].first.first; FOR(i, n) { if (p[i].second == mii || p[i].second == mai) continue; p[i].first.first = p[i].first.second; sort(p, p+n); dif = min(ma, p[n-1].first.first - p[0].first.first); } res = min(res, (mama-mimi)*dif); cout << res << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:48:27: error: 'ma' was not declared in this scope; did you mean 'mai'? 48 | dif = min(ma, p[n-1].first.first - p[0].first.first); | ^~ | mai
s310929184
p03735
C++
# coding: utf-8 # 整数の入力 #a = int(raw_input()) # スペース区切りの整数の入力 import numpy as np import itertools N = int(input()) Rmax = 0 Rmin = 1000000001 Bmax = 0 Bmin = 1000000001 for i in range(N): x,y = list(map(int, input().split())) if x > y: if x > Rmax: Rmax = x if y > Bmax: Bmax = y if y < Bmin: Bmin = y if x < Rmin: Rmin = x else: if y > Rmax: Rmax = y if x > Bmax: Bmax = x if x < Bmin: Bmin = x if y < Rmin: Rmin = y if Rmin < Bmax: print((Rmax - Bmin)*(Bmax - Rmin)) else: print((Rmax - Rmin)*(Bmax - Bmin))
a.cc:1:3: error: invalid preprocessing directive #coding 1 | # coding: utf-8 | ^~~~~~ a.cc:2:3: error: invalid preprocessing directive #\U00006574\U00006570\U0000306e\U00005165\U0000529b 2 | # 整数の入力 | ^~~~~~~~~~ a.cc:3:2: error: invalid preprocessing directive #a 3 | #a = int(raw_input()) | ^ a.cc:4:3: error: invalid preprocessing directive #\U000030b9\U000030da\U000030fc\U000030b9\U0000533a\U00005207\U0000308a\U0000306e\U00006574\U00006570\U0000306e\U00005165\U0000529b 4 | # スペース区切りの整数の入力 | ^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:5:1: error: 'import' does not name a type 5 | import numpy as np | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
s444731918
p03735
C++
#include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAX = (1e5)+1; int n;vector<pair<ll, ll> > a;multiset<ll> r, b;long long ans = LLONG_MAX;int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; a.resize(n); for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; if(a[i].first > a[i].second) swap(a[i].first, a[i].second); } sort(a.begin(), a.end()); for(auto p: a) { r.insert(p.first); b.insert(p.second); } ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); for(auto p: a) { r.erase(r.find(p.first)); b.erase(b.find(p.second)); r.insert(p.second); b.insert(p.first); ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); } cout << ans;}
a.cc:1:31: warning: extra tokens at end of #include directive 1 | #include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAX = (1e5)+1; int n;vector<pair<ll, ll> > a;multiset<ll> r, b;long long ans = LLONG_MAX;int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; a.resize(n); for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; if(a[i].first > a[i].second) swap(a[i].first, a[i].second); } sort(a.begin(), a.end()); for(auto p: a) { r.insert(p.first); b.insert(p.second); } ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); for(auto p: a) { r.erase(r.find(p.first)); b.erase(b.find(p.second)); r.insert(p.second); b.insert(p.first); ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); } cout << ans;} | ^~~~~~~~~ a.cc:1:10: fatal error: bits/stdc++.h>usin: No such file or directory 1 | #include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAX = (1e5)+1; int n;vector<pair<ll, ll> > a;multiset<ll> r, b;long long ans = LLONG_MAX;int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; a.resize(n); for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; if(a[i].first > a[i].second) swap(a[i].first, a[i].second); } sort(a.begin(), a.end()); for(auto p: a) { r.insert(p.first); b.insert(p.second); } ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); for(auto p: a) { r.erase(r.find(p.first)); b.erase(b.find(p.second)); r.insert(p.second); b.insert(p.first); ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); } cout << ans;} | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s481658481
p03735
C++
#include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAX = (1e5)+1; int n;vector<pair<ll, ll> > a;multiset<ll> r, b;long long ans = LLONG_MAX;int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; a.resize(n); for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; if(a[i].first > a[i].second) swap(a[i].first, a[i].second); } for(auto p: a) { r.insert(p.first); b.insert(p.second); } ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); for(auto p: a) { r.erase(r.find(p.first)); b.erase(b.find(p.second)); r.insert(p.second); b.insert(p.first); ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); } cout << ans;}
a.cc:1:31: warning: extra tokens at end of #include directive 1 | #include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAX = (1e5)+1; int n;vector<pair<ll, ll> > a;multiset<ll> r, b;long long ans = LLONG_MAX;int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; a.resize(n); for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; if(a[i].first > a[i].second) swap(a[i].first, a[i].second); } for(auto p: a) { r.insert(p.first); b.insert(p.second); } ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); for(auto p: a) { r.erase(r.find(p.first)); b.erase(b.find(p.second)); r.insert(p.second); b.insert(p.first); ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); } cout << ans;} | ^~~~~~~~~ a.cc:1:10: fatal error: bits/stdc++.h>usin: No such file or directory 1 | #include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAX = (1e5)+1; int n;vector<pair<ll, ll> > a;multiset<ll> r, b;long long ans = LLONG_MAX;int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; a.resize(n); for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; if(a[i].first > a[i].second) swap(a[i].first, a[i].second); } for(auto p: a) { r.insert(p.first); b.insert(p.second); } ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); for(auto p: a) { r.erase(r.find(p.first)); b.erase(b.find(p.second)); r.insert(p.second); b.insert(p.first); ans = min((*r.rbegin() - *r.begin()) * (*b.rbegin() - *b.begin()), ans); } cout << ans;} | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s894049679
p03735
C++
#include <algorithm> #include <vector> using namespace std; const int inf=1e9; pair<int,int> v[400010]; vector<int> poz[200010]; int main() { //freopen("file.in", "r", stdin); //freopen("file.out", "w", stdout); int n,max1=0,min1=inf,max2=0,min2=inf,a,b; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d%d",&a,&b); v[2*i-1]={a,i}; v[2*i]={b,i}; if(a<b) swap(a,b); max1=max(max1,a); min1=min(min1,a); max2=max(max2,b); min2=min(min2,b); } long long sol=1LL*(max1-min1)*(max2-min2); sort(v+1,v+1+2*n); for(int i=1;i<=2*n;i++) poz[v[i].second].push_back(i); a=b=2; int nr=0; for(int i=1;i<=2*n;i++) { for(;nr<n && b<2*n;b++) if(poz[v[b].second][0]==b || poz[v[b].second][0]<a) nr++; if(nr<n) break; sol=min(sol,1LL*(v[2*n].first-v[1].first)*(v[b-1].first-v[a].first)); nr--; if(poz[v[a].second][0]==a && poz[v[a].second][1]<b) nr++; a++; } printf("%lld",sol); return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'scanf' was not declared in this scope 15 | scanf("%d",&n); | ^~~~~ a.cc:42:5: error: 'printf' was not declared in this scope 42 | printf("%lld",sol); | ^~~~~~ a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 2 | #include <vector> +++ |+#include <cstdio> 3 |
s985295232
p03735
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <map> #include <vector> #include <algorithm> using namespace std; typedef long long LL; const int MaxN = 400000; int n, a[MaxN + 5], nxt[MaxN + 5]; int x[MaxN + 5], y[MaxN + 5], re[MaxN + 5]; bool flag[MaxN +5]; map <int, int> hash; struct ARR { int w, l, r, ty; }b[MaxN + 5]; vector <int> v[MaxN + 5]; bool cmp(ARR A, ARR B) { return A.w < B.w; } void Init() { int tot = 0; for (int i = 1; i <= n; i++) { scanf("%d%d", &x[i], &y[i]); a[++tot] = x[i]; a[++tot] = y[i]; } sort(a + 1, a + 2 * n + 1); a[0] = -1; int cnt = 0; for (int i = 1; i <= 2 * n; i++) { if (a[i] != a[i - 1]) cnt++; hash[a[i]] = cnt; re[cnt] = a[i]; } tot = 0; for (int i = 1; i <= n; i++) { x[i] = hash[x[i]]; y[i] = hash[y[i]]; if (x[i] > y[i]) swap(x[i], y[i]); b[++tot].w = x[i]; b[tot].ty = 0; b[tot].r = y[i]; b[++tot].w = y[i]; b[tot].ty = 1; b[tot].l = x[i]; } sort(b + 1, b + tot + 1, cmp); /*for (int i = 1; i <= tot; i++) printf("%d %d %d\n", re[b[i].w], b[i].ty, b[i].r);*/ } void Solve() { n = 2 * n; for (int i = 1; i <= n; i++) if (b[i].ty == 1) v[b[i].w].push_back(i); for (int i = 1; i <= n; i++) { if (b[i].ty == 0) { nxt[i] = v[b[i].r][v[b[i].r].size() - 1]; v[b[i].r].pop_back(); } } //for (int i = 1; i <= n; i++) printf("%d ", nxt[i]); printf("\n"); int cnt = 0, Rmin = 1 << 30, Rmax = 0, Bmin = 1 << 30, Bmax = 0; memset(flag, 0, sizeof(flag)); for (int i = 1; i <= n; i++) { if (flag[i]) Rmin = min(Rmin, re[b[i].w]), Rmax = max(Rmax, re[b[i].w]); else { Bmin = min(Bmin, re[b[i].w]), Bmax = max(Bmax, re[b[i].w]); flag[nxt[i]] = true; } //printf("%d %d %d %d\n", Rmin, Rmax, Bmin, Bmax); } LL ans = ((LL)Rmax - Rmin) * (Bmax - Bmin); memset(flag, 0, sizeof(flag)); int pos = n; for (int i = n; i >= 1; i--) if (nxt[i] != 0) {pos = i; break;} LL temp = re[b[n].w] - re[b[1].w]; int MaX = 0; for (int i = 1; i <= n; i++) { if (flag[i - 1]) break; else { flag[nxt[i]] = true; ans = min(ans, (re[b[max(MaX, pos)].w] - re[b[i].w]) * (LL)temp); MaX = max(MaX, nxt[i]); } } printf("%lld\n", ans); } int main() { while (~scanf("%d", &n)) { Init(); Solve(); } return 0; }
a.cc: In function 'void Init()': a.cc:36:17: error: reference to 'hash' is ambiguous 36 | hash[a[i]] = cnt; | ^~~~ In file included from /usr/include/c++/14/bits/stl_bvector.h:65, from /usr/include/c++/14/vector:67, from a.cc:6: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:16: note: 'std::map<int, int> hash' 15 | map <int, int> hash; | ^~~~ a.cc:41:24: error: reference to 'hash' is ambiguous 41 | x[i] = hash[x[i]]; y[i] = hash[y[i]]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:16: note: 'std::map<int, int> hash' 15 | map <int, int> hash; | ^~~~ a.cc:41:43: error: reference to 'hash' is ambiguous 41 | x[i] = hash[x[i]]; y[i] = hash[y[i]]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:16: note: 'std::map<int, int> hash' 15 | map <int, int> hash; | ^~~~
s442975796
p03735
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> using namespace std; #define ll long long #define PI acos(-1.0) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) //方針 ll x[200000], y[200000]; int main(){ int N; cin >> N; FOR(i, 0, N) cin >> x[i] >> y[i]; vector<int> ind(N); FOR(i, 0, N) ind[i] = i; sort(ind.begin(), ind.end(), [](int i, int j){ return x[i] < x[j]; }); ll Rmax, Rmin, Bmax, Bmin; Rmax = Rmin = x[ind[0]]; Bmax = Bmin = y[ind[0]]; FOR(k, 1, N){ int i = ind[k]; ll comp1 = 0, comp2 = 0; //xがRの時 if(x[i] > Rmax) comp1 = x[i] - Rmin; else if(x[i] < Rmin) comp1 = Rmax - x[i]; else comp1 = Rmax - Rmin; if(y[i] > Bmax) comp1 *= y[i] - Bmin; else if(y[i] < Bmin) comp1 *= Bmax - y[i]; else comp1 *= Bmax - Bmin; if(y[i] > Rmax) comp2 = y[i] - Rmin; else if(y[i] < Rmin) comp2 = Rmax - y[i]; else comp2 = Rmax - Rmin; if(x[i] > Bmax) comp2 *= x[i] - Bmin; else if(x[i] < Bmin) comp2 *= Bmax - x[i]; else comp2 *= Bmax - Bmin; if(comp1<=comp2){ Rmax = max(Rmax, x[i]); Rmin = min(Rmin, x[i]); Bmax = max(Bmax, y[i]); Bmin = min(Bmin, y[i]); } else{ Rmax = max(Rmax, y[i]); Rmin = min(Rmin, y[i]); Bmax = max(Bmax, x[i]); Bmin = min(Bmin, x[i]); } } ll ans = (Rmax-Rmin) * (Bmax-Bmin); i = ind[0], j = ind[N-1]; ans = min(ans, llabs(x[j]-x[i])*llabs(y[j]-y[i])); ans = min(ans, llabs(x[j]-y[i])*llabs(y[j]-x[i])); ans = min(ans, llabs(y[j]-x[i])*llabs(x[j]-y[i])); ans = min(ans, llabs(y[j]-y[i])*llabs(x[j]-x[i])); sort(ind.begin(), ind.end(), [](int i, int j){ return y[i] < y[j]; }); Rmax = Rmin = x[ind[0]]; Bmax = Bmin = y[ind[0]]; FOR(k, 1, N){ int i = ind[k]; ll comp1 = 0, comp2 = 0; //xがRの時 if(x[i] > Rmax) comp1 = x[i] - Rmin; else if(x[i] < Rmin) comp1 = Rmax - x[i]; else comp1 = Rmax - Rmin; if(y[i] > Bmax) comp1 *= y[i] - Bmin; else if(y[i] < Bmin) comp1 *= Bmax - y[i]; else comp1 *= Bmax - Bmin; if(y[i] > Rmax) comp2 = y[i] - Rmin; else if(y[i] < Rmin) comp2 = Rmax - y[i]; else comp2 = Rmax - Rmin; if(x[i] > Bmax) comp2 *= x[i] - Bmin; else if(x[i] < Bmin) comp2 *= Bmax - x[i]; else comp2 *= Bmax - Bmin; if(comp1<=comp2){ Rmax = max(Rmax, x[i]); Rmin = min(Rmin, x[i]); Bmax = max(Bmax, y[i]); Bmin = min(Bmin, y[i]); } else{ Rmax = max(Rmax, y[i]); Rmin = min(Rmin, y[i]); Bmax = max(Bmax, x[i]); Bmin = min(Bmin, x[i]); } } i = ind[0], j = ind[N-1]; ans = min(ans, llabs(x[j]-x[i])*llabs(y[j]-y[i])); ans = min(ans, llabs(x[j]-y[i])*llabs(y[j]-x[i])); ans = min(ans, llabs(y[j]-x[i])*llabs(x[j]-y[i])); ans = min(ans, llabs(y[j]-y[i])*llabs(x[j]-x[i])); ans = min(ans, (Rmax-Rmin) * (Bmax-Bmin)); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:68:5: error: 'i' was not declared in this scope 68 | i = ind[0], j = ind[N-1]; | ^ a.cc:68:17: error: 'j' was not declared in this scope 68 | i = ind[0], j = ind[N-1]; | ^
s841582339
p03735
C++
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pii; typedef pair<int,string> pis; double pi=3.1415926535898; #define speed ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL); #define lop(i,n) for(int i=0;i<int(n);i++) #define rep(i,a,b) for(int i=a;i<=int(b);++i) #define rng(i,a,b) for(int i=a;i>=int(b);i--) #define ms(x,a) memset(x,a,sizeof(x)) #define all(x) (x).begin(),(x).end() #define sz(x) int(x.size()) #define pb push_back #define r0 return 0; #define CC continue; #define bb(x) cerr<< x <<endl; #define F first #define S second // __builtin_popcount; //freopen("output.txt","w",stdout),freopen("input.txt","r",stdin); const ll M = 1e9+7 ; const int N = 100100; const int inf = INT_MAX; const double eps = 1e-7; ////////////////////// Hi ^_^ hack me if you can :P pair<ll,ll>p[200200]; ll ans = 1LL<<60; int main() { speed; int n; cin>>n; int aa,bb; lop(i,n){ cin>>aa>>bb; p[i].F=min(aa,bb); p[i].S=max(aa,bb); } sort(p,p+n); ans = min(ans,(p[n-1].F-p[0].F)*(p[n-1].S-p[0].S) ); ans = min(ans,(p[n-1].F-p[0].F)*(p[n-1].S-p[0].S) ); swap(p[n-1]F,p[0].S); ans = min(ans,(p[n-1].F-p[0].F)*(p[n-1].S-p[0].S) ); swap(p[0].F,p[0].S); cout << ans; } /* 15 5 4 2 5 7 10 13 https://ideone.com/goT6Vy//http: codeforces.com/problemset/problem/466/D , vector < pair <int,int > >, greater <pair <int, int> > http://codeforces.com/contest/295/submission/17929453 freopen("output.txt","w",stdout); freopen("input.txt","r",stdin); ll pwmod(ll a, ll n, ll mod) { ll ret = 1; while (n) { if (n & 1) ret = ret * a % mod; a = a * a % mod; n >>= 1; } return ret; } for (int i=0; i<n; i++) Hi ^_^ hack me if you can :P int mx[]= {0,0,1,-1, 1,1,-1,-1}; int my[]= {1,-1,0,0, 1,-1,1,-1}; bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);} typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; void gcd(LL n,LL m,LL &d,LL &xx,LL &yy) { if(!m) { d=n; xx=1; yy=0; } else { gcd(m,n%m,d,yy,xx); yy-=xx*(n/m); } } int getm(int l,int r) { if(l>r) return N; if(l==r) return 0; if(l==r-1) return s[l] != s[r]; if(s[l]==s[r]) return getm(l+1,r-1); else return 1+min(getm(l+1,r),getm(l,r-1)); } int BIT[si], a[si], n; void update(int x, int delta) { for(; x <= N; x += x&-x) BIT[x] += delta; } int query(int x) { int sum = 0; for(; x > 0; x -= x&-x) sum += BIT[x]; return sum; } #define sc(x) scanf("%d",&x) #define scl(x) scanf("%lld",&x) #define pr(x) printf("%d ",x) #define prl(x) printf("%lld ",x) #define prln(x) printf("%d\n",x) #define prlln(x) printf("%lld\n",x) #define scd(x) scanf("%lf",&x) #define prd(x) printf("%.10f\n",x) int n, a[N]; int seg[N<<2]; void build(int nd,int L,int R) { if( L == R ) { seg[nd]=a[L]; return ; } int mid = (L+R) >>1; build(nd<<1,L, mid); build(nd<<1|1,mid+1,R); seg[nd]=max( seg[nd<<1], seg[nd<<1|1] ); } void update(int nd,int L,int R,int idx,int val) { if( L == R ) { seg[nd]=val; return ; } int mid = (L+R) >>1; if( idx<=mid ) update(nd<<1, L,mid,idx,val); else update(nd<<1|1,mid+1, R,idx,val); seg[nd]=max( seg[nd<<1], seg[nd<<1|1] ); } int query(int nd,int L,int R,int from,int to) { if( from<=L && R<=to )return seg[nd]; if( from>R || to<L )return -inf; int mid = (L+R) >>1; int leftAns = query(nd<<1, L,mid,from,to); int rightAns= query(nd<<1|1,mid+1, R,from,to); return max( leftAns,rightAns ); } */
a.cc: In function 'int main()': a.cc:46:20: error: expected ')' before 'first' 46 | swap(p[n-1]F,p[0].S); | ~ ^ | ) a.cc:46:13: error: no matching function for call to 'swap(std::pair<long long int, long long int>&, long long int&)' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77, from a.cc:2: /usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match) 430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); } | ^~~~ /usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed: a.cc:21:20: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any' 21 | #define S second // __builtin_popcount; | ^ a.cc:46:27: note: in expansion of macro 'S' 46 | swap(p[n-1]F,p[0].S); | ^ /usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = long long int&; _VTp = long long int; _Mgr = _Manager_internal<long long int>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]' 191 | any(_Tp&& __value) | ^~~ In file included from /usr/include/c++/14/exception:166, from /usr/include/c++/14/stdexcept:38, from /usr/include/c++/14/system_error:43, from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/future:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176: /usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)' 328 | swap(thread& __x, thread& __y) noexcept | ^~~~ /usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::thread&' 328 | swap(thread& __x, thread& __y) noexcept | ~~~~~~~~^~~ In file included from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)' 1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed: a.cc:46:13: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)' 1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed: a.cc:46:13: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)' 1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed: a.cc:46:13: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)' 1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed: a.cc:46:13: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181: /usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)' 896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed: a.cc:46:13: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)' 2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed: a.cc:46:13: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::match_results<_BiIter, _Alloc>' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61, 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/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)' 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: template argument deduction/substitution failed: a.cc:46:13: note: deduced conflicting types for parameter '_Tp' ('std::pair<long long int, long long int>' and 'long long int') 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed: a.cc:46:13: note: mismatched types '_Tp [_Nm]' and 'std::pair<long long int, long long int>' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' 1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed: a.cc:46:13: note: mismatched types 'std::pair<_T1, _T2>' and 'long long int' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted) 1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed: a.cc:46:13: note: mismatched types 'std::pair<_T1, _T2>' and 'long long int' 46 | swap(p[n-1]F,p[0].S); | ~~~~^~~~~~~~~~~~~~~~ In file included 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/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed: a.cc:46:13: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 46 | swap(p[n-1]F,p[0].
s997111771
p03735
C++
#include <cstdio> #include <algorithm> #include <iostream> #include <string> #include <vector> #include <queue> #define INT long long #define MOD 1000000007 #define oo (1e18)+1 using namespace std; INT n, a[200020], b[200020], ans, ma = oo, mb = oo, Ma, Mb, ans = oo; bool poss(INT x) { } int main() { ios::sync_with_stdio(false); cin>>n; for(int i = 0 ; i < n ; i++ ) { cin>>a[i]>>b[i]; if( a[i] > b[i] ) swap(a[i], b[i]); cout<<a[i]<<" "<<b[i]<<endl; ma = min( ma, a[i] ); mb = min( mb, b[i] ); Ma = max( Ma, a[i] ); Mb = max( Mb, b[i] ); } if( (Ma-ma)*(Mb-mb) > 0 ) ans = min( ans, (Ma-ma)*(Mb-mb)); if( (Ma-mb)*(Mb-ma) > 0 ) ans = min( ans, (Ma-mb)*(Mb-ma)); cout<<ans<<endl; return 0; }
a.cc:12:61: error: redefinition of 'long long int ans' 12 | INT n, a[200020], b[200020], ans, ma = oo, mb = oo, Ma, Mb, ans = oo; | ^~~ a.cc:12:30: note: 'long long int ans' previously declared here 12 | INT n, a[200020], b[200020], ans, ma = oo, mb = oo, Ma, Mb, ans = oo; | ^~~ a.cc: In function 'bool poss(long long int)': a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type] 17 | } | ^
s178038850
p03735
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> using namespace std; #define ll long long #define PI acos(-1.0) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) //方針 ll x[200000], y[200000]; int main(){ int N; cin >> N; FOR(i, 0, N) cin >> x[i] >> y[i]; vector<int> ind(N); FOR(i, 0, N) ind[i] = i; sort(ind.begin(), ind.end(), [](int i, int j){ return x[i] < x[j]; }); ll Rmax, Rmin, Bmax, Bmin; Rmax = Rmin = x[ind[0]]; Bmax = Bmin = y[ind[0]]; FOR(k, 1, N){ int i = ind[k] ll comp1 = 0, comp2 = 0; //xがRの時 if(x[i] > Rmax) comp1 = x[i] - Rmin; else if(x[i] < Rmin) comp1 = Rmax - x[i]; else comp1 = Rmax - Rmin; if(y[i] > Bmax) comp1 *= y[i] - Bmin; else if(y[i] < Bmin) comp1 *= Bmax - y[i]; else comp1 *= Bmax - Bmin; if(y[i] > Rmax) comp2 = y[i] - Rmin; else if(y[i] < Rmin) comp2 = Rmax - y[i]; else comp2 = Rmax - Rmin; if(x[i] > Bmax) comp2 *= x[i] - Bmin; else if(x[i] < Bmin) comp2 *= Bmax - x[i]; else comp2 *= Bmax - Bmin; if(comp1<=comp2){ Rmax = max(Rmax, x[i]); Rmin = min(Rmin, x[i]); Bmax = max(Bmax, y[i]); Bmin = min(Bmin, y[i]); } else{ Rmax = max(Rmax, y[i]); Rmin = min(Rmin, y[i]); Bmax = max(Bmax, x[i]); Bmin = min(Bmin, x[i]); } } ll ans = (Rmax-Rmin) * (Bmax-Bmin); sort(ind.begin(), ind.end(), [](int i, int j){ return y[i] < y[j]; }); Rmax = Rmin = x[ind[0]]; Bmax = Bmin = y[ind[0]]; FOR(k, 1, N){ int i = ind[k]; ll comp1 = 0, comp2 = 0; //xがRの時 if(x[i] > Rmax) comp1 = x[i] - Rmin; else if(x[i] < Rmin) comp1 = Rmax - x[i]; else comp1 = Rmax - Rmin; if(y[i] > Bmax) comp1 *= y[i] - Bmin; else if(y[i] < Bmin) comp1 *= Bmax - y[i]; else comp1 *= Bmax - Bmin; if(y[i] > Rmax) comp2 = y[i] - Rmin; else if(y[i] < Rmin) comp2 = Rmax - y[i]; else comp2 = Rmax - Rmin; if(x[i] > Bmax) comp2 *= x[i] - Bmin; else if(x[i] < Bmin) comp2 *= Bmax - x[i]; else comp2 *= Bmax - Bmin; if(comp1<=comp2){ Rmax = max(Rmax, x[i]); Rmin = min(Rmin, x[i]); Bmax = max(Bmax, y[i]); Bmin = min(Bmin, y[i]); } else{ Rmax = max(Rmax, y[i]); Rmin = min(Rmin, y[i]); Bmax = max(Bmax, x[i]); Bmin = min(Bmin, x[i]); } } ans = min(ans, (Rmax-Rmin) * (Bmax-Bmin)); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:16:20: error: expected ',' or ';' before 'long' 16 | #define ll long long | ^~~~ a.cc:38:9: note: in expansion of macro 'll' 38 | ll comp1 = 0, comp2 = 0; | ^~ a.cc:40:25: error: 'comp1' was not declared in this scope 40 | if(x[i] > Rmax) comp1 = x[i] - Rmin; | ^~~~~ a.cc:41:30: error: 'comp1' was not declared in this scope 41 | else if(x[i] < Rmin) comp1 = Rmax - x[i]; | ^~~~~ a.cc:42:14: error: 'comp1' was not declared in this scope 42 | else comp1 = Rmax - Rmin; | ^~~~~ a.cc:43:25: error: 'comp1' was not declared in this scope 43 | if(y[i] > Bmax) comp1 *= y[i] - Bmin; | ^~~~~ a.cc:44:30: error: 'comp1' was not declared in this scope 44 | else if(y[i] < Bmin) comp1 *= Bmax - y[i]; | ^~~~~ a.cc:45:14: error: 'comp1' was not declared in this scope 45 | else comp1 *= Bmax - Bmin; | ^~~~~ a.cc:47:25: error: 'comp2' was not declared in this scope 47 | if(y[i] > Rmax) comp2 = y[i] - Rmin; | ^~~~~ a.cc:48:30: error: 'comp2' was not declared in this scope 48 | else if(y[i] < Rmin) comp2 = Rmax - y[i]; | ^~~~~ a.cc:49:14: error: 'comp2' was not declared in this scope 49 | else comp2 = Rmax - Rmin; | ^~~~~ a.cc:50:25: error: 'comp2' was not declared in this scope 50 | if(x[i] > Bmax) comp2 *= x[i] - Bmin; | ^~~~~ a.cc:51:30: error: 'comp2' was not declared in this scope 51 | else if(x[i] < Bmin) comp2 *= Bmax - x[i]; | ^~~~~ a.cc:52:14: error: 'comp2' was not declared in this scope 52 | else comp2 *= Bmax - Bmin; | ^~~~~ a.cc:54:12: error: 'comp1' was not declared in this scope 54 | if(comp1<=comp2){ | ^~~~~ a.cc:54:19: error: 'comp2' was not declared in this scope 54 | if(comp1<=comp2){ | ^~~~~
s275123444
p03735
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> using namespace std; #define ll long long #define PI acos(-1.0) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) //方針 ll llabs(ll x){ return x>0?x:-x; } ll x[200000], y[200000]; int main(){ int N; cin >> N; FOR(i, 0, N) cin >> x[i] >> y[i]; vector<int> ind(N); FOR(i, 0, N) ind[i] = i; sort(ind.begin(), ind.end(), [](int i, int j){ return x[i] < x[j]; }); ll Rmax, Rmin, Bmax, Bmin; Rmax = Rmin = x[ind[0]]; Bmax = Bmin = y[ind[0]]; FOR(k, 1, N){ int i = ind[k] ll comp1 = 0, comp2 = 0; //xがRの時 if(x[i] > Rmax) comp1 = x[i] - Rmin; else if(x[i] < Rmin) comp1 = Rmax - x[i]; else comp1 = Rmax - Rmin; if(y[i] > Bmax) comp1 *= y[i] - Bmin; else if(y[i] < Bmin) comp1 *= Bmax - y[i]; else comp1 *= Bmax - Bmin; if(y[i] > Rmax) comp2 = y[i] - Rmin; else if(y[i] < Rmin) comp2 = Rmax - y[i]; else comp2 = Rmax - Rmin; if(x[i] > Bmax) comp2 *= x[i] - Bmin; else if(x[i] < Bmin) comp2 *= Bmax - x[i]; else comp2 *= Bmax - Bmin; if(comp1<=comp2){ Rmax = max(Rmax, x[i]); Rmin = min(Rmin, x[i]); Bmax = max(Bmax, y[i]); Bmin = min(Bmin, y[i]); } else{ Rmax = max(Rmax, y[i]); Rmin = min(Rmin, y[i]); Bmax = max(Bmax, x[i]); Bmin = min(Bmin, x[i]); } } ll ans = (Rmax-Rmin) * (Bmax-Bmin); sort(ind.begin(), ind.end(), [](int i, int j){ return y[i] < y[j]; }); Rmax = Rmin = x[ind[0]]; Bmax = Bmin = y[ind[0]]; FOR(k, 1, N){ int i = ind[k] ll comp1 = 0, comp2 = 0; //xがRの時 if(x[i] > Rmax) comp1 = x[i] - Rmin; else if(x[i] < Rmin) comp1 = Rmax - x[i]; else comp1 = Rmax - Rmin; if(y[i] > Bmax) comp1 *= y[i] - Bmin; else if(y[i] < Bmin) comp1 *= Bmax - y[i]; else comp1 *= Bmax - Bmin; if(y[i] > Rmax) comp2 = y[i] - Rmin; else if(y[i] < Rmin) comp2 = Rmax - y[i]; else comp2 = Rmax - Rmin; if(x[i] > Bmax) comp2 *= x[i] - Bmin; else if(x[i] < Bmin) comp2 *= Bmax - x[i]; else comp2 *= Bmax - Bmin; if(comp1<=comp2){ Rmax = max(Rmax, x[i]); Rmin = min(Rmin, x[i]); Bmax = max(Bmax, y[i]); Bmin = min(Bmin, y[i]); } else{ Rmax = max(Rmax, y[i]); Rmin = min(Rmin, y[i]); Bmax = max(Bmax, x[i]); Bmin = min(Bmin, x[i]); } } ans = min(ans, (Rmax-Rmin) * (Bmax-Bmin)); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:16:20: error: expected ',' or ';' before 'long' 16 | #define ll long long | ^~~~ a.cc:41:9: note: in expansion of macro 'll' 41 | ll comp1 = 0, comp2 = 0; | ^~ a.cc:43:25: error: 'comp1' was not declared in this scope 43 | if(x[i] > Rmax) comp1 = x[i] - Rmin; | ^~~~~ a.cc:44:30: error: 'comp1' was not declared in this scope 44 | else if(x[i] < Rmin) comp1 = Rmax - x[i]; | ^~~~~ a.cc:45:14: error: 'comp1' was not declared in this scope 45 | else comp1 = Rmax - Rmin; | ^~~~~ a.cc:46:25: error: 'comp1' was not declared in this scope 46 | if(y[i] > Bmax) comp1 *= y[i] - Bmin; | ^~~~~ a.cc:47:30: error: 'comp1' was not declared in this scope 47 | else if(y[i] < Bmin) comp1 *= Bmax - y[i]; | ^~~~~ a.cc:48:14: error: 'comp1' was not declared in this scope 48 | else comp1 *= Bmax - Bmin; | ^~~~~ a.cc:50:25: error: 'comp2' was not declared in this scope 50 | if(y[i] > Rmax) comp2 = y[i] - Rmin; | ^~~~~ a.cc:51:30: error: 'comp2' was not declared in this scope 51 | else if(y[i] < Rmin) comp2 = Rmax - y[i]; | ^~~~~ a.cc:52:14: error: 'comp2' was not declared in this scope 52 | else comp2 = Rmax - Rmin; | ^~~~~ a.cc:53:25: error: 'comp2' was not declared in this scope 53 | if(x[i] > Bmax) comp2 *= x[i] - Bmin; | ^~~~~ a.cc:54:30: error: 'comp2' was not declared in this scope 54 | else if(x[i] < Bmin) comp2 *= Bmax - x[i]; | ^~~~~ a.cc:55:14: error: 'comp2' was not declared in this scope 55 | else comp2 *= Bmax - Bmin; | ^~~~~ a.cc:57:12: error: 'comp1' was not declared in this scope 57 | if(comp1<=comp2){ | ^~~~~ a.cc:57:19: error: 'comp2' was not declared in this scope 57 | if(comp1<=comp2){ | ^~~~~ a.cc:16:20: error: expected ',' or ';' before 'long' 16 | #define ll long long | ^~~~ a.cc:78:9: note: in expansion of macro 'll' 78 | ll comp1 = 0, comp2 = 0; | ^~ a.cc:80:25: error: 'comp1' was not declared in this scope 80 | if(x[i] > Rmax) comp1 = x[i] - Rmin; | ^~~~~ a.cc:81:30: error: 'comp1' was not declared in this scope 81 | else if(x[i] < Rmin) comp1 = Rmax - x[i]; | ^~~~~ a.cc:82:14: error: 'comp1' was not declared in this scope 82 | else comp1 = Rmax - Rmin; | ^~~~~ a.cc:83:25: error: 'comp1' was not declared in this scope 83 | if(y[i] > Bmax) comp1 *= y[i] - Bmin; | ^~~~~ a.cc:84:30: error: 'comp1' was not declared in this scope 84 | else if(y[i] < Bmin) comp1 *= Bmax - y[i]; | ^~~~~ a.cc:85:14: error: 'comp1' was not declared in this scope 85 | else comp1 *= Bmax - Bmin; | ^~~~~ a.cc:87:25: error: 'comp2' was not declared in this scope 87 | if(y[i] > Rmax) comp2 = y[i] - Rmin; | ^~~~~ a.cc:88:30: error: 'comp2' was not declared in this scope 88 | else if(y[i] < Rmin) comp2 = Rmax - y[i]; | ^~~~~ a.cc:89:14: error: 'comp2' was not declared in this scope 89 | else comp2 = Rmax - Rmin; | ^~~~~ a.cc:90:25: error: 'comp2' was not declared in this scope 90 | if(x[i] > Bmax) comp2 *= x[i] - Bmin; | ^~~~~ a.cc:91:30: error: 'comp2' was not declared in this scope 91 | else if(x[i] < Bmin) comp2 *= Bmax - x[i]; | ^~~~~ a.cc:92:14: error: 'comp2' was not declared in this scope 92 | else comp2 *= Bmax - Bmin; | ^~~~~ a.cc:94:12: error: 'comp1' was not declared in this scope 94 | if(comp1<=comp2){ | ^~~~~ a.cc:94:19: error: 'comp2' was not declared in this scope 94 | if(comp1<=comp2){ | ^~~~~
s813805325
p03735
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> using namespace std; #define ll long long #define PI acos(-1.0) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) //方針 ll llabs(ll x){ return x>0?x:-x; } ll x[200000], y[200000]; int main(){ int N; cin >> N; FOR(i, 0, N) cin >> x[i] >> y[i]; vector<int> ind(N); FOR(i, 0, N) ind[i] = i; sort(ind.begin(), ind.end(), [](int i, int j){ return x[i] < x[j]; }); ll Rmax, Rmin, Bmax, Bmin; Rmax = Rmin = x[ind[0]]; Bmax = Bmin = y[ind[0]]; FOR(k, 1, N){ int i = ind[k] ll comp1 = 0, comp2 = 0; //xがRの時 if(x[i] > Rmax) comp1 = x[i] - Rmin; else if(x[i] < Rmin) comp1 = Rmax - x[i]; else comp1 = Rmax - Rmin; if(y[i] > Bmax) comp1 *= y[i] - Bmin; else if(y[i] < Bmin) comp1 *= Bmax - y[i]; else comp1 *= Bmax - Bmin; if(y[i] > Rmax) comp2 = y[i] - Rmin; else if(y[i] < Rmin) comp2 = Rmax - y[i]; else comp2 = Rmax - Rmin; if(x[i] > Bmax) comp2 *= x[i] - Bmin; else if(x[i] < Bmin) comp2 *= Bmax - x[i]; else comp2 *= Bmax - Bmin; if(comp1<=comp2){ Rmax = max(Rmax, x[i]); Rmin = min(Rmin, x[i]); Bmax = max(Bmax, y[i]); Bmin = min(Bmin, y[i]); } else{ Rmax = max(Rmax, y[i]); Rmin = min(Rmin, y[i]); Bmax = max(Bmax, x[i]); Bmin = min(Bmin, x[i]); } } cout << (Rmax-Rmin) * (Bmax-Bmin) << endl; }
a.cc: In function 'int main()': a.cc:16:20: error: expected ',' or ';' before 'long' 16 | #define ll long long | ^~~~ a.cc:41:9: note: in expansion of macro 'll' 41 | ll comp1 = 0, comp2 = 0; | ^~ a.cc:43:25: error: 'comp1' was not declared in this scope 43 | if(x[i] > Rmax) comp1 = x[i] - Rmin; | ^~~~~ a.cc:44:30: error: 'comp1' was not declared in this scope 44 | else if(x[i] < Rmin) comp1 = Rmax - x[i]; | ^~~~~ a.cc:45:14: error: 'comp1' was not declared in this scope 45 | else comp1 = Rmax - Rmin; | ^~~~~ a.cc:46:25: error: 'comp1' was not declared in this scope 46 | if(y[i] > Bmax) comp1 *= y[i] - Bmin; | ^~~~~ a.cc:47:30: error: 'comp1' was not declared in this scope 47 | else if(y[i] < Bmin) comp1 *= Bmax - y[i]; | ^~~~~ a.cc:48:14: error: 'comp1' was not declared in this scope 48 | else comp1 *= Bmax - Bmin; | ^~~~~ a.cc:50:25: error: 'comp2' was not declared in this scope 50 | if(y[i] > Rmax) comp2 = y[i] - Rmin; | ^~~~~ a.cc:51:30: error: 'comp2' was not declared in this scope 51 | else if(y[i] < Rmin) comp2 = Rmax - y[i]; | ^~~~~ a.cc:52:14: error: 'comp2' was not declared in this scope 52 | else comp2 = Rmax - Rmin; | ^~~~~ a.cc:53:25: error: 'comp2' was not declared in this scope 53 | if(x[i] > Bmax) comp2 *= x[i] - Bmin; | ^~~~~ a.cc:54:30: error: 'comp2' was not declared in this scope 54 | else if(x[i] < Bmin) comp2 *= Bmax - x[i]; | ^~~~~ a.cc:55:14: error: 'comp2' was not declared in this scope 55 | else comp2 *= Bmax - Bmin; | ^~~~~ a.cc:57:12: error: 'comp1' was not declared in this scope 57 | if(comp1<=comp2){ | ^~~~~ a.cc:57:19: error: 'comp2' was not declared in this scope 57 | if(comp1<=comp2){ | ^~~~~
s295237074
p03735
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> using namespace std; #define ll long long #define PI acos(-1.0) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) //方針 ll llabs(ll x){ return x>0?x:-x; } ll x[200000], y[200000]; int main(){ int N; cin >> N; FOR(i, 0, N) cin >> x[i] >> y[i]; vector<int> ind(N); FOR(i, 0, N) ind[i] = i; sort(ind.begin(), ind.end(), [](int i, int j){ return x[i] < x[j]; }); ll Rmax, Rmin, Bmax, Bmin; Rmax = Rmin = x[idx[0]]; Bmax = Bmin = y[idx[0]]; FOR(k, 1, N){ int i = idx[k] ll comp1 = 0, comp2 = 0; //xがRの時 if(x[i] > Rmax) comp1 = x[i] - Rmin; else if(x[i] < Rmin) comp1 = Rmax - x[i]; else comp1 = Rmax - Rmin; if(y[i] > Bmax) comp1 *= y[i] - Bmin; else if(y[i] < Bmin) comp1 *= Bmax - y[i]; else comp1 *= Bmax - Bmin; if(y[i] > Rmax) comp2 = y[i] - Rmin; else if(y[i] < Rmin) comp2 = Rmax - y[i]; else comp2 = Rmax - Rmin; if(x[i] > Bmax) comp2 *= x[i] - Bmin; else if(x[i] < Bmin) comp2 *= Bmax - x[i]; else comp2 *= Bmax - Bmin; if(comp1<=comp2){ Rmax = max(Rmax, x[i]); Rmin = min(Rmin, x[i]); Bmax = max(Bmax, y[i]); Bmin = min(Bmin, y[i]); } else{ Rmax = max(Rmax, y[i]); Rmin = min(Rmin, y[i]); Bmax = max(Bmax, x[i]); Bmin = min(Bmin, x[i]); } } cout << (Rmax-Rmin) * (Bmax-Bmin) << endl; }
a.cc: In function 'int main()': a.cc:37:21: error: 'idx' was not declared in this scope 37 | Rmax = Rmin = x[idx[0]]; | ^~~ a.cc:43:25: error: 'comp1' was not declared in this scope 43 | if(x[i] > Rmax) comp1 = x[i] - Rmin; | ^~~~~ a.cc:44:30: error: 'comp1' was not declared in this scope 44 | else if(x[i] < Rmin) comp1 = Rmax - x[i]; | ^~~~~ a.cc:45:14: error: 'comp1' was not declared in this scope 45 | else comp1 = Rmax - Rmin; | ^~~~~ a.cc:46:25: error: 'comp1' was not declared in this scope 46 | if(y[i] > Bmax) comp1 *= y[i] - Bmin; | ^~~~~ a.cc:47:30: error: 'comp1' was not declared in this scope 47 | else if(y[i] < Bmin) comp1 *= Bmax - y[i]; | ^~~~~ a.cc:48:14: error: 'comp1' was not declared in this scope 48 | else comp1 *= Bmax - Bmin; | ^~~~~ a.cc:50:25: error: 'comp2' was not declared in this scope 50 | if(y[i] > Rmax) comp2 = y[i] - Rmin; | ^~~~~ a.cc:51:30: error: 'comp2' was not declared in this scope 51 | else if(y[i] < Rmin) comp2 = Rmax - y[i]; | ^~~~~ a.cc:52:14: error: 'comp2' was not declared in this scope 52 | else comp2 = Rmax - Rmin; | ^~~~~ a.cc:53:25: error: 'comp2' was not declared in this scope 53 | if(x[i] > Bmax) comp2 *= x[i] - Bmin; | ^~~~~ a.cc:54:30: error: 'comp2' was not declared in this scope 54 | else if(x[i] < Bmin) comp2 *= Bmax - x[i]; | ^~~~~ a.cc:55:14: error: 'comp2' was not declared in this scope 55 | else comp2 *= Bmax - Bmin; | ^~~~~ a.cc:57:12: error: 'comp1' was not declared in this scope 57 | if(comp1<=comp2){ | ^~~~~ a.cc:57:19: error: 'comp2' was not declared in this scope 57 | if(comp1<=comp2){ | ^~~~~
s941353141
p03735
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> using namespace std; #define ll long long #define PI acos(-1.0) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) //方針 ll llabs(ll x){ return x>0?x:-x; } int main(){ int N; cin >> N; vector<ll> x(N), y(N); FOR(i, 0, N) cin >> x[i] >> y[i]; vector<int> ind[N]; FOR(i, 0, N) ind[i] = i; //xでそーと sort(ind.begin(), ind.end(), [](int i, int j){ return x[i] < x[j]; }); ll ans = 9999999999; int i = ind[0], j = ind[N-1]; ans = min(ans, llabs(x[j]-x[i])*llabs(y[j]-y[i])); ans = min(ans, llabs(x[j]-y[i])*llabs(y[j]-x[i])); ans = min(ans, llabs(y[j]-x[i])*llabs(x[j]-y[i])); ans = min(ans, llabs(y[j]-y[i])*llabs(x[j]-x[i])); //yでそーと sort(ind.begin(), ind.end(), [](int i, int j){ return y[i] < y[j]; }); i = ind[0], j = ind[N-1]; ans = min(ans, llabs(x[j]-x[i])*llabs(y[j]-y[i])); ans = min(ans, llabs(x[j]-y[i])*llabs(y[j]-x[i])); ans = min(ans, llabs(y[j]-x[i])*llabs(x[j]-y[i])); ans = min(ans, llabs(y[j]-y[i])*llabs(x[j]-x[i])); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:32:27: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int') 32 | FOR(i, 0, N) ind[i] = i; | ^ In file included from /usr/include/c++/14/vector:72, from /usr/include/c++/14/queue:63, from a.cc:6: /usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' 211 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66: /usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]' 788 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ a.cc:35:14: error: request for member 'begin' in 'ind', which is of non-class type 'std::vector<int> [N]' 35 | sort(ind.begin(), ind.end(), [](int i, int j){ | ^~~~~ a.cc:35:27: error: request for member 'end' in 'ind', which is of non-class type 'std::vector<int> [N]' 35 | sort(ind.begin(), ind.end(), [](int i, int j){ | ^~~ a.cc: In lambda function: a.cc:36:16: error: 'x' is not captured 36 | return x[i] < x[j]; | ^ a.cc:35:35: note: the lambda has no capture-default 35 | sort(ind.begin(), ind.end(), [](int i, int j){ | ^ a.cc:29:16: note: 'std::vector<long long int> x' declared here 29 | vector<ll> x(N), y(N); | ^ a.cc:36:23: error: 'x' is not captured 36 | return x[i] < x[j]; | ^ a.cc:35:35: note: the lambda has no capture-default 35 | sort(ind.begin(), ind.end(), [](int i, int j){ | ^ a.cc:29:16: note: 'std::vector<long long int> x' declared here 29 | vector<ll> x(N), y(N); | ^ a.cc: In function 'int main()': a.cc:40:18: error: cannot convert 'std::vector<int>' to 'int' in initialization 40 | int i = ind[0], j = ind[N-1]; | ~~~~~^ | | | std::vector<int> a.cc:40:32: error: cannot convert 'std::vector<int>' to 'int' in initialization 40 | int i = ind[0], j = ind[N-1]; | ~~~~~~~^ | | | std::vector<int> a.cc:47:14: error: request for member 'begin' in 'ind', which is of non-class type 'std::vector<int> [N]' 47 | sort(ind.begin(), ind.end(), [](int i, int j){ | ^~~~~ a.cc:47:27: error: request for member 'end' in 'ind', which is of non-class type 'std::vector<int> [N]' 47 | sort(ind.begin(), ind.end(), [](int i, int j){ | ^~~ a.cc: In lambda function: a.cc:48:16: error: 'y' is not captured 48 | return y[i] < y[j]; | ^ a.cc:47:35: note: the lambda has no capture-default 47 | sort(ind.begin(), ind.end(), [](int i, int j){ | ^ a.cc:29:22: note: 'std::vector<long long int> y' declared here 29 | vector<ll> x(N), y(N); | ^ a.cc:48:23: error: 'y' is not captured 48 | return y[i] < y[j]; | ^ a.cc:47:35: note: the lambda has no capture-default 47 | sort(ind.begin(), ind.end(), [](int i, int j){ | ^ a.cc:29:22: note: 'std::vector<long long int> y' declared here 29 | vector<ll> x(N), y(N); | ^ a.cc: In function 'int main()': a.cc:51:14: error: cannot convert 'std::vector<int>' to 'int' in assignment 51 | i = ind[0], j = ind[N-1]; | ~~~~~^ | | | std::vector<int> a.cc:51:28: error: cannot convert 'std::vector<int>' to 'int' in assignment 51 | i = ind[0], j = ind[N-1]; | ~~~~~~~^ | | | std::vector<int>
s890101835
p03735
C++
#include <iostream> #include <vector> #include <string> #include <sstream> #include <utility> #include <set> #include <map> #include <queue> #include <stack> #include <algorithm> #include <istream> #include <ostream> #include <cstdlib> #include <cmath> #include <cstdio> using namespace std; #define fi first #define se second #define mkp make_pair #define all(x) (x).begin(), (x).end() #define pb push_back #define rep(i,n) for(ll i=0; i < (n); ++i) #define rrep(i,n) for(ll i=((n)-1); i >= 0; --i) #define OPLT(T) bool operator<(const T & lop_, const T & rop_) #define OPEQ(T) bool operator==(const T & lop_, const T & rop_) typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; }; ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; }; int main() { int N; cin >> N; vector<pll> v(N); rep(i,N) cin >> v[i].fi >> v[i].se; ll res = 1e18; ll mn[2] = {1e9,1e9}, mx[2] = {0,0}; pll mnp, mxp; rep(i,N) { if(v[i].fi > v[i].se) swap(v[i].fi, v[i].se); mx[0] = max(mx[0], v[i].fi); mn[0] = min(mn[0], v[i].fi); mx[1] = max(mx[1], v[i].se); mn[1] = min(mn[1], v[i].se); if(i == 0) { mnp = mxp = v[i]; } else { if(mnp.fi > v[i].fi) { mnp = v[i]; } if(mxp.se < v[i].se) { mxp = v[i]; } } } res = min(res,(mx[0]-mn[0])*(mx[1]-mn[1])); rep(j,2) { pll r(min(mnp.se,mxp.fi),max(mnp.se,mxp.fi)); rep(i,N) { if(v[i].se < r.fi) r.fi = v[i].se; if(r.se < v[i].fi) r.se = v[i].fi; if(v[i].fi < r.fi && r.se < v[i].se) { if(j) r.fi = v[i].fi; else r.se = v[i].se; } } res = min(res,(mxp.se - mnp.fi)*(r.se - r.fi)); } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:44:21: error: narrowing conversion of '1.0e+9' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing] 44 | ll mn[2] = {1e9,1e9}, mx[2] = {0,0}; | ^~~ a.cc:44:25: error: narrowing conversion of '1.0e+9' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing] 44 | ll mn[2] = {1e9,1e9}, mx[2] = {0,0}; | ^~~
s346091909
p03735
Java
public class Main { public static void main(String[] args) { //System.out.println("d"); Scanner sc = new Scanner( System.in ); int N = sc.nextInt(); int max_x = Integer.MIN_VALUE; int max_y = Integer.MIN_VALUE; int min_x = Integer.MAX_VALUE; int min_y = Integer.MAX_VALUE; int x = 0;//2つのうち小さいほう int y = 0;//2つのうち大きいほう int itizi = 0; for( int i = 0;i < N;i++ ){ x = sc.nextInt(); y = sc.nextInt(); if( x > y ){ itizi = y; y = x; x = itizi; } max_x = Math.max( x, max_x ); min_x = Math.min( x, min_x ); max_y = Math.max( y, max_y ); min_y = Math.min( y, min_y ); } /* System.out.println(max_x); System.out.println(min_x); System.out.println(max_y); System.out.println(min_y); */ long a = (long)Math.abs(max_x- min_x) * (long)Math.abs(max_y- min_y); long b = (long)Math.abs(max_x- min_y) * (long)Math.abs(max_y- min_x); if( a > b ) System.out.println( b ); else System.out.println( a ); } }
Main.java:7: error: cannot find symbol Scanner sc = new Scanner( System.in ); ^ symbol: class Scanner location: class Main Main.java:7: error: cannot find symbol Scanner sc = new Scanner( System.in ); ^ symbol: class Scanner location: class Main 2 errors
s131330629
p03735
C++
#include<iostream> #include<iomanip> #include<cstdlib> #include<math.h> #include<algorithm> #include<string> #include<vector> #include<list> #include<queue> #include<stack> #include<deque> #include<set> #include<map> #define REP(i, N) for(ll i = 0; i < N; ++i) #define FOR(i, a, b) for(ll i = a; i < b; ++i) #define ALL(a) (a).begin(),(a).end() #define pb push_back #define INF 1000000000 #define MOD 1000000007 using namespace std; typedef __int128 ll; typedef pair<ll, ll> P; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1}; int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1}; int main(void) { ll N; cin>>N; ll rmax, rmin, bmax, bmin; ll ans = 0; vector<ll> x(N); vector<ll> y(N); REP(i, N) cin>>x[i]>>y[i]; rmax = rmin = x[0]; bmax = bmin = y[0]; for(ll i = 1; i < N; ++i) { if((max(rmax, x[i]) - min(rmin, x[i])) * (max(bmax, y[i] - min(bmin, y[i]))) < (max(rmax, y[i]) - min(rmin, y[i])) * (max(bmax, x[i] - min(bmin, x[i])))) { rmax = max(rmax, x[i]); rmin = min(rmin, x[i]); bmax = max(bmax, y[i]); bmin = min(bmin, y[i]); } else { rmax = max(rmax, y[i]); rmin = min(rmin, y[i]); bmax = max(bmax, x[i]); bmin = min(bmin, x[i]); } } ans = (rmax - rmin) * (bmax - bmin); rmax = rmin = y[0]; bmax = bmin = x[0]; for(ll i = 1; i < N; ++i) { if((max(rmax, x[i]) - min(rmin, x[i])) * (max(bmax, y[i] - min(bmin, y[i]))) < (max(rmax, y[i]) - min(rmin, y[i])) * (max(bmax, x[i] - min(bmin, x[i])))) { rmax = max(rmax, x[i]); rmin = min(rmin, x[i]); bmax = max(bmax, y[i]); bmin = min(bmin, y[i]); } else { rmax = max(rmax, y[i]); rmin = min(rmin, y[i]); bmax = max(bmax, x[i]); bmin = min(bmin, x[i]); } } ans = min(ans, (rmax - rmin) * (bmax - bmin)); cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:30:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'll' {aka '__int128'}) 30 | cin>>N; | ~~~^~~ | | | | | ll {aka __int128} | std::istream {aka 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:30:14: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'll' {aka '__int128'} 30 | cin>>N; | ^ /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:30:14: error: invalid conversion from 'll' {aka '__int128'} to 'void*' [-fpermissive] 30 | cin>>N; | ^ | | | ll {aka __int128} a.cc:30:14: error: cannot bind rvalue '(void*)((long int)N)' 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:30:14: error: invalid conversion from 'll' {aka '__int128'} to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 30 | cin>>N; | ^ | | | ll {aka __int128} /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:30:14: error: invalid conversion from 'll' {aka '__int128'} to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive] 30 | cin>>N; | ^ | | | ll {aka __int128} /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 133 | operator>>(ios_base& (*__pf)(ios_base&))
s539818160
p03735
C++
#include<iostream> #include <vector> #include <algorithm> #include<queue> #include <boost/multiprecision/cpp_int.hpp> //typedef boost::multiprecision::cpp_int Cint; typedef longlong Cint; using namespace std; int main(){ Cint n,x,y,t; Cint miny=9000000000,maxy=0,minx=9000000000,maxx=0; cin>>n; for(Cint i=0;i<n;i++){ cin>>x>>y; if(x>y){ t=x;x=y;y=t; } if(miny>y)miny=y; if(maxy<y)maxy=y; if(minx>x)minx=x; if(maxx<x)maxx=x; } Cint a=(maxx-minx)*(maxy-miny),b=(maxx-miny)*(maxy-minx); if(b>=0)cout<<((a>b)?b:a)<<endl; else cout<<a<<endl; return 0; }
a.cc:5:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory 5 | #include <boost/multiprecision/cpp_int.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s142761025
p03735
C++
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <fstream> #include <vector> #include <string> #include <set> #include <list> #include <map> #include <queue> #include <iterator> #include <iomanip> #include <stdio.h> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cmath> #include <ctime> #include <utility> #include <functional> #include <stack> #include <deque> #include <sstream> using namespace std; #define ll long long #define ld long double #define pdd pair<double,double> #define pll pair<ll, ll> #define pii pair<int,int> #define mod 1000000007 #define infinity (ll)1e18+1 #define PI 3.14159265358979 #define MP make_pair #define SZ size() #define PB push_back #define vi vector<int> #define vll vector<ll> #define vpll vector<pll> #define vpii vector<pii> #define FOR(i,a,b) for(ll i = (a); i < (b); ++i) #define RFOR(i,b,a) for(ll i = (b) - 1; i >= (a); --i) #define REPEAT(i) FOR(counter1234,0,i) #define ALL(a) a.begin(), a.end() int main() { int n; cin >> n; vll x(n), y(n); FOR(i, 0, n) { scanf("%ld %ld", &x[i], &y[i]); if (x[i] < y[i]) swap(x[i], y[i]); } vector<pll> way(n), ex(n); FOR(i, 0, n) { way[i] = MP(y[i], i); ex[i] = MP(x[i], i); } sort(ALL(way)); sort(ALL(ex)); ll maxR, maxB, minR, minB; minR = way[0].first; //max = R maxR = ex[n - 1].first; minB = x[way[0].second]; maxB = y[ex[n - 1].second]; FOR(i, 0, n) { if (x[i] < minB) minB = x[i]; if (y[i] > maxB) maxB = y[i]; } ll ans = abs((maxR -
a.cc: In function 'int main()': a.cc:93:30: error: expected primary-expression at end of input 93 | ll ans = abs((maxR - | ^ a.cc:93:30: error: expected ')' at end of input 93 | ll ans = abs((maxR - | ~ ^ | ) a.cc:93:30: error: expected '}' at end of input a.cc:50:1: note: to match this '{' 50 | { | ^
s828445602
p03736
C++
#include <bits/stdc++.h> #define err(args...) {} #ifdef DEBUG #include "_debug.cpp" #endif using namespace std; using ll = long long; using ld = long double; template <typename T> using lim = numeric_limits<T>; template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; } const int N = 200'000; template <typename T> struct monoid { const T identity; const function<T(T, T)> combine; }; template <typename T> struct segtree { using Type = T; using DeltaType = T; const int size; vector<T> tree; const monoid<T> m; segtree(int size, const monoid<T>& m) : size(size), tree(2 * (size + 1), m.identity), m(m) {} void update(int i, T x) { for(tree[i += size] = x; i >>= 1; ) tree[i] = m.combine(tree[i << 1], tree[(i << 1) | 1]); } T query(int a, int b, bool inclusive) { assert(a <= b); T ans_l = m.identity, ans_r = m.identity; for(a += size, b += size + inclusive; a < b; a >>= 1, b >>= 1) { if(a & 1) ans_l = m.combine(ans_l, tree[a++]); if(b & 1) ans_r = m.combine(tree[--b], ans_r); } return m.combine(ans_l, ans_r); } T query(int i) { return query(i, i, true); } friend ostream& operator<<(ostream& os, segtree& t) { os << "["; for(int i = 0; i <= t.size; i++) { if(i != 0) os << ", "; os << t.query(i); } return os << "]"; } }; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, q, a, b; cin >> n >> q >> a >> b; vector<ll> x(q), s(q); cin >> x; adjacent_difference(x.begin(), x.end(), s.begin()); for(ll& d : s) { d = abs(d); } partial_sum(s.begin(), s.end(), s.begin()); auto cost0 = [&](int i, int j) { if(j + 1 == q) { return min(abs(a - x[i]), abs(b - x[i])); } else { return min(abs(a - x[i]) + abs(b - x[j + 1]), abs(b - x[i]) + abs(a - x[j + 1])); } }; segtree<ll> gt_st(N + 1, {N * q + 1, [](int x, int y) { return min(x, y); }}); segtree<ll> lt_st(N + 1, {N * q + 1, [](int x, int y) { return max(x, y); }}); vector<ll> opt(q + 1, lim<ll>::max()); opt[q] = 0; for(int i = q - 1; i >= 0; i--) { if(i == 0) { for(int j = i; j < q; j++) { opt[i] = min(opt[i], s[j] - s[i] + cost0(i, j) + opt[j + 1]); } } else { opt[i] = min( gt_st.query(x[i - 1], N, true) - s[i] - x[i - 1], lt_st.query(0, x[i - 1], true) - s[i] + x[i - 1] ); opt[i] = min(opt[i], s[q - 1] - s[i]); gt_st.update(x[i], min(gt_st.query(x[i]), s[i - 1] + x[i] + opt[i])); lt_st.update(x[i], min(lt_st.query(x[i]), s[i - 1] - x[i] + opt[i])); } } cout << opt[0] << endl; return 0; }#include <bits/stdc++.h> #define err(args...) {} #ifdef DEBUG #include "_debug.cpp" #endif using namespace std; using ll = long long; using ld = long double; template <typename T> using lim = numeric_limits<T>; template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; } const int N = 200'000; template <typename T> struct monoid { const T identity; const function<T(T, T)> combine; }; template <typename T> struct segtree { using Type = T; using DeltaType = T; const int size; vector<T> tree; const monoid<T> m; segtree(int size, const monoid<T>& m) : size(size), tree(2 * (size + 1), m.identity), m(m) {} void update(int i, T x) { for(tree[i += size] = x; i >>= 1; ) tree[i] = m.combine(tree[i << 1], tree[(i << 1) | 1]); } T query(int a, int b, bool inclusive) { assert(a <= b); T ans_l = m.identity, ans_r = m.identity; for(a += size, b += size + inclusive; a < b; a >>= 1, b >>= 1) { if(a & 1) ans_l = m.combine(ans_l, tree[a++]); if(b & 1) ans_r = m.combine(tree[--b], ans_r); } return m.combine(ans_l, ans_r); } T query(int i) { return query(i, i, true); } friend ostream& operator<<(ostream& os, segtree& t) { os << "["; for(int i = 0; i <= t.size; i++) { if(i != 0) os << ", "; os << t.query(i); } return os << "]"; } }; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, q, a, b; cin >> n >> q >> a >> b; vector<ll> x(q), s(q); cin >> x; adjacent_difference(x.begin(), x.end(), s.begin()); for(ll& d : s) { d = abs(d); } partial_sum(s.begin(), s.end(), s.begin()); auto cost0 = [&](int i, int j) { if(j + 1 == q) { return min(abs(a - x[i]), abs(b - x[i])); } else { return min(abs(a - x[i]) + abs(b - x[j + 1]), abs(b - x[i]) + abs(a - x[j + 1])); } }; segtree<ll> gt_st(N + 1, {N * q + 1, [](int x, int y) { return min(x, y); }}); segtree<ll> lt_st(N + 1, {N * q + 1, [](int x, int y) { return max(x, y); }}); vector<ll> opt(q + 1, lim<ll>::max()); opt[q] = 0; for(int i = q - 1; i >= 0; i--) { if(i == 0) { for(int j = i; j < q; j++) { opt[i] = min(opt[i], s[j] - s[i] + cost0(i, j) + opt[j + 1]); } } else { opt[i] = min( gt_st.query(x[i - 1], N, true) - s[i] - x[i - 1], lt_st.query(0, x[i - 1], true) - s[i] + x[i - 1] ); opt[i] = min(opt[i], s[q - 1] - s[i]); gt_st.update(x[i], min(gt_st.query(x[i]), s[i - 1] + x[i] + opt[i])); lt_st.update(x[i], min(lt_st.query(x[i]), s[i - 1] - x[i] + opt[i])); } } cout << opt[0] << endl; return 0; }
a.cc:86:2: error: stray '#' in program 86 | }#include <bits/stdc++.h> | ^ a.cc:86:3: error: 'include' does not name a type 86 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:95:32: error: redefinition of 'template<class T> std::istream& operator>>(std::istream&, std::vector<_Tp>&)' 95 | template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; } | ^~~~~~~~ a.cc:10:32: note: 'template<class T> std::istream& operator>>(std::istream&, std::vector<_Tp>&)' previously declared here 10 | template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; } | ^~~~~~~~ a.cc:96:11: error: redefinition of 'const int N' 96 | const int N = 200'000; | ^ a.cc:11:11: note: 'const int N' previously defined here 11 | const int N = 200'000; | ^ a.cc:97:30: error: redefinition of 'struct monoid<T>' 97 | template <typename T> struct monoid { | ^~~~~~ a.cc:12:30: note: previous definition of 'struct monoid<T>' 12 | template <typename T> struct monoid { | ^~~~~~ a.cc:101:30: error: redefinition of 'struct segtree<T>' 101 | template <typename T> struct segtree { | ^~~~~~~ a.cc:16:30: note: previous definition of 'struct segtree<T>' 16 | template <typename T> struct segtree { | ^~~~~~~ a.cc:131:5: error: redefinition of 'int main()' 131 | int main() { | ^~~~ a.cc:46:5: note: 'int main()' previously defined here 46 | int main() { | ^~~~
s731319098
p03736
C++
#include<bits/stdc++.h> using namespace std; #define re register #define ll long long #define get getchar() #define in inline in int read() { int t=0; char ch=get; while(ch<'0' || ch>'9') ch=get; while(ch<='9' && ch>='0') t=t*10+ch-'0', ch=get; return t; } const int _=2e5+5; int n,q,A,B,x[_]; ll lazy[_<<4],min1[_<<4],min2[_<<4]; in void pushdown(int k) { if(lazy[k]==0) return ; int x=lazy[k]; lazy[k]=0; lazy[k<<1]+=x; lazy[k<<1|1]+=x; min1[k<<1]+=x; min1[k<<1|1]+=x; min2[k<<1]+=x; min2[k<<1|1]+=x; } in void update(int k,int l,int r,int x,int y) { if(l==r) { min1[k]=min(min1[k],y-l); min2[k]=min(min2[k],y+l); return; } pushdown(k); int mid=l+r>>1; if(x<=mid) update(k<<1,l,mid,x,y); else update(k<<1|1,mid+1,r,x,y); min1[k]=min(min1[k<<1],min1[k<<1|1]); min2[k]=min(min2[k<<1],min2[k<<1|1]); } in int query1(int k,int l,int r,int x,int y) { if(l>=x && r<=y) return min1[k]; pushdown(k); int mid=l+r>>1,minn=0x3f3f3f3f; if(x<=mid) minn=min(minn,query1(k<<1,l,mid,x,y)); if(y>mid) minn=min(minn,query1(k<<1|1,mid+1,r,x,y)); return minn; } in int query2(int k,int l,int r,int x,int y) { if(l>=x && r<=y) return min2[k]; pushdown(k); int mid=l+r>>1,minn=0x3f3f3f3f; if(x<=mid) minn=min(minn,query2(k<<1,l,mid,x,y)); if(y>mid) minn=min(minn,query2(k<<1|1,mid+1,r,x,y)); return minn; } in int getans(int k,int l,int r) { if(l==r) return min1[k]+l; pushdown(k); int mid=l+r>>1; return min(getans(k<<1,l,mid), getans(k<<1|1,mid+1,r)); } int main() { n=read(),q=read(),A=read(),B=read(); x[0]=A; memset(min1,0x3f,sizeof(min1)); memset(min2,0x3f,sizeof(min2)); update(1,1,n,B,0); for(re int i=1;i<=q;i++) { x[i]=read(); int qwe=min(query1(1,1,n,1,x[i])+x[i],query2(1,1,n,x[i]+1,n)-x[i]); lazy[1]+=abs(x[i]-x[i-1]); min1[1]+=abs(x[i]-x[i-1]); min2[1]+=abs(x[i]-x[i-1]); update(1,1,n,x[i-1],qwe); } cout<<getans(1,1,n); }
a.cc: In function 'void update(int, int, int, int, int)': a.cc:33:28: error: no matching function for call to 'min(long long int&, int)' 33 | min1[k]=min(min1[k],y-l); | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:33:28: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 33 | min1[k]=min(min1[k],y-l); | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:33:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | min1[k]=min(min1[k],y-l); | ~~~^~~~~~~~~~~~~ a.cc:34:28: error: no matching function for call to 'min(long long int&, int)' 34 | min2[k]=min(min2[k],y+l); | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:34:28: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 34 | min2[k]=min(min2[k],y+l); | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:34:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 34 | min2[k]=min(min2[k],y+l); | ~~~^~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:76:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 76 | for(re int i=1;i<=q;i++) | ^
s457845172
p03736
C++
#include "moves.h" #include <bits/stdc++.h> using namespace std; #define LL long long #define DB double #define ULL unsigned long long #define PII pair<int,int> #define mp make_pair #define fi first #define se second #define psb push_back #define ppb pop_back #define endln printf("\n") #define ALL(x) (x).begin(),(x).end() #define SZ(x) (int)(x).size() #define SETMIN(x) memset((x), -1, sizeof (x)) #define SETNUL(x) memset((x), 0, sizeof (x)) #define gc getchar_unlocked #ifndef getchar_unlocked #define getchar_unlocked getchar #endif const int INF = 1e9 + 5; const LL INFLL = 1e18+5; const int MOD = 1e9 + 7; template <typename T> void gi(T &ret) { ret = 0; char inp = gc(); bool isNeg = 0; while (inp < '0' || inp > '9') { if (inp == '-') isNeg = 1; inp = gc(); } while ('0' <= inp && inp <= '9') { ret = (ret << 3) + (ret << 1) + (inp - '0'); inp = gc(); } if (isNeg) ret = -ret; } struct SegVal { LL a, b; LL lazyA, lazyB; SegVal() { a = b = INFLL; lazyA = lazyB = 0; } }; const int MAXA = (1 << 19) + 5; SegVal segVal[MAXA]; void pushVal(int idx) { int lc = (idx << 1) + 1, rc = (idx << 1) + 2; if (segVal[idx].lazyA) { LL &lazyA = segVal[idx].lazyA; segVal[lc].a += lazyA; segVal[rc].a += lazyA; segVal[lc].lazyA += lazyA; segVal[rc].lazyA += lazyA; lazyA = 0; } if (segVal[idx].lazyB) { LL &lazyB = segVal[idx].lazyB; segVal[lc].b += lazyB; segVal[rc].b += lazyB; segVal[lc].lazyB += lazyB; segVal[rc].lazyB += lazyB; lazyB = 0; } } void updateAdd(int idx, int l, int r, int x, int y, LL da, LL db) { if (x <= l && r <= y) { segVal[idx].a += da; segVal[idx].b += db; segVal[idx].lazyA += da; segVal[idx].lazyB += db; return; } if (l > y || r < x) { return; } pushVal(idx); int mid = (l + r) >> 1, lc = (idx << 1) + 1, rc = (idx << 1) + 2; updateAdd(lc, l, mid, x, y, da, db); updateAdd(rc, mid + 1, r, x, y, da, db); segVal[idx].a = min(segVal[lc].a, segVal[rc].a); segVal[idx].b = min(segVal[lc].b, segVal[rc].b); } void updateVal(int idx, int l, int r, int x, LL a, LL b) { if (l == r) { segVal[idx].a = min(segVal[idx].a, a); segVal[idx].b = min(segVal[idx].b, b); return; } pushVal(idx); int mid = (l + r) >> 1, lc = (idx << 1) + 1, rc = (idx << 1) + 2; if (x <= mid) updateVal(lc, l, mid, x, a, b); else updateVal(rc, mid + 1, r, x, a, b); segVal[idx].a = min(segVal[lc].a, segVal[rc].a); segVal[idx].b = min(segVal[lc].b, segVal[rc].b); } LL query(int idx, int l, int r, int x, int y, int k) { if (x <= l && r <= y) { if (k == 0) return segVal[idx].a; else return segVal[idx].b; } if (l > y || r < x) { return INFLL; } pushVal(idx); int mid = (l + r) >> 1, lc = (idx << 1) + 1, rc = (idx << 1) + 2; return min(query(lc, l, mid, x, y, k), query(rc, mid + 1, r, x, y, k)); } const int MAXN = 2e5 + 5; int n, m, va, vb; int val[MAXN]; LL solve() { updateVal(0, 1, n, val[0], 0 - val[0], 0 + val[0]); for (int i = 2; i <= m + 1; ++i) { LL ca = query(0, 1, n, 1, val[i], 0); LL cb = query(0, 1, n, val[i], n, 1); LL hs = min(ca + val[i], cb - val[i]); updateAdd(0, 1, n, 1, n, abs(val[i] - val[i - 1]), abs(val[i] - val[i - 1])); updateVal(0, 1, n, val[i - 1], hs - val[i - 1], hs + val[i - 1]); } LL ans = INFLL; for (int i = 1; i <= n; ++i) { LL cs = query(0, 1, n, i, i, 0); ans = min(ans, cs + i); } return ans; } long long minimum_time(int N, int M, int A, int B, std::vector<int> X) { n = N; m = M; val[0] = A; val[1] = B; for (int i = 2; i <= m + 1; ++i) val[i] = X[i - 2]; return solve(); }
a.cc:1:10: fatal error: moves.h: No such file or directory 1 | #include "moves.h" | ^~~~~~~~~ compilation terminated.
s388150115
p03736
C++
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef vector<int> vi; int N, Q, A, B; LL posL, posR; vi X; int binser(int l, int r, int src){ int ret = l; while(l <= r){ int mid = (l+r)/2; if(X[mid] <= src){ ret = max(ret, mid); l = mid + 1; }else{ r = mid - 1; } } return ret; } LL solve(int l, int r){ LL ret = 1e18; int idx = l; LL tmp1 = abs(posL - X[r]); if(tmp1 < ret){ idx = r; ret = tmp1; } LL tmp2 = abs(posR - X[l]) + abs(X[l] - X[r]); if(tmp2 < ret){ idx = l-1; ret = tmp2; } for(l = l+1;l < r; l++){ LL tmp = abs(posL - X[l]) + abs(posR - X[l+1]) + abs(X[l+1] - X[r]); if(tmp < ret){ ret = tmp; idx = l; } } posL = X[idx]; if(idx < r) posR = X[idx+1]; return ret; } LL minimum_time(int n, int q, int a, int b, vi x) { N = n; Q = q; A = a; B = b; X = x; LL ret = 0; posL = min(A, B); posR = max(A, B); for(int i = 0; i < Q; i++){ if(posL <= X[i] && X[i] <= posR){ int idxLmt = binser(i, Q-1, posR); ret += solve(i, idxLmt); i = idxLmt; }else if(X[i] <= posL){ ret += abs(X[i] - posL); posL = X[i]; }else if(posR <= X[i]){ ret += abs(X[i] - posR); posR = X[i]; } } ret += min(abs(posL - LL(X[Q-1])), abs(posR - LL(X[Q-1]))); return ret; } bool isSorted(){ for (int i = 1; i < Q; ++i) { if (!(X[i - 1] <= X[i])) { return false; } } return true; } int main() { scanf("%d %d %d %d", &N, &Q, &A, &B); X.resize(Q); for (int i = 0; i < Q; ++i) { scanf("%d", &X[i]); } if(!isSorted()) while(true){} printf("%lld\n", minimum_time()); return 0; }
a.cc: In function 'int main()': a.cc:99:32: error: too few arguments to function 'LL minimum_time(int, int, int, int, vi)' 99 | printf("%lld\n", minimum_time()); | ~~~~~~~~~~~~^~ a.cc:56:4: note: declared here 56 | LL minimum_time(int n, int q, int a, int b, vi x) { | ^~~~~~~~~~~~
s128321626
p03736
C++
#include "moves.h" #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef vector<int> vi; int N, Q, A, B; LL posL, posR; vi X; int binser(int l, int r, int src){ int ret = l; while(l <= r){ int mid = (l+r)/2; if(X[mid] <= src){ ret = max(ret, mid); l = mid + 1; }else{ r = mid - 1; } } return ret; } LL solve(int l, int r){ LL ret = 1e18; int idx = l; LL tmp1 = abs(posL - X[r]); if(tmp1 < ret){ idx = r; ret = tmp1; } LL tmp2 = abs(posR - X[l]) + abs(X[l] - X[r]); if(tmp2 < ret){ idx = l-1; ret = tmp2; } for(l = l+1;l < r; l++){ LL tmp = abs(posL - X[l]) + abs(posR - X[l+1]) + abs(X[l+1] - X[r]); if(tmp < ret){ ret = tmp; idx = l; } } posL = X[idx]; if(idx < r) posR = X[idx+1]; return ret; } LL minimum_time(int n, int q, int a, int b, vi x) { N = n; Q = q; A = a; B = b; X = x; LL ret = 0; posL = min(A, B); posR = max(A, B); for(int i = 0; i < Q; i++){ if(posL <= X[i] && X[i] <= posR){ int idxLmt = binser(i, Q-1, posR); ret += solve(i, idxLmt); i = idxLmt; }else if(X[i] <= posL){ ret += abs(X[i] - posL); posL = X[i]; }else if(posR <= X[i]){ ret += abs(X[i] - posR); posR = X[i]; } } ret += min(abs(posL - LL(X[Q-1])), abs(posR - LL(X[Q-1]))); return ret; } bool isSorted(){ for (int i = 1; i < Q; ++i) { if (!(X[i - 1] <= X[i])) { return false; } } return true; } int main() { scanf("%d %d %d %d", &N, &Q, &A, &B); X.resize(Q); for (int i = 0; i < Q; ++i) { scanf("%d", &X[i]); } if(!isSorted()) while(true){} printf("%lld\n", minimum_time()); return 0; }
a.cc:1:10: fatal error: moves.h: No such file or directory 1 | #include "moves.h" | ^~~~~~~~~ compilation terminated.
s989023582
p03736
C++
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef vector<int> vi; #define PB push_back const int MAXQ = 205; const int MAXN = 205; LL N, Q, A, B; vi X; LL memo[MAXQ][MAXN][MAXN]; LL mini(LL a, LL b){ if(a == -1) return b; else if(b == -1) return a; else if(a < b) return a; else return b; } LL dp(int id, int pA, int pB){ if(id == Q){ return memo[id][pA][pB] = 0; } int nxt = X[id]; if(memo[id + 1][nxt][pB] == -1) memo[id+1][nxt][pB] = abs(nxt-pA) + dp(id+1, nxt, pB); if(memo[id + 1][pA][nxt] == -1) memo[id+1][pA][nxt] = abs(nxt-pB) + dp(id+1, pA, nxt); return memo[id][pA][pB] = min(memo[id+1][nxt][pB], memo[id+1][pA][nxt]); } LL minimum_time(int n, int q, int a, int b, vi x) { N = n; Q = q; A = a; B = b; X = x; memset(memo, -1, sizeof(memo)); return dp(0, A, B); } int main() { scanf("%d %d %d %d", &N, &Q, &A, &B); X.resize(Q); for (int i = 0; i < Q; ++i) { scanf("%d", &X[i]); } if(N > 200 || Q > 200) while(true){} printf("%lld\n", minimum_time()); return 0; }
a.cc: In function 'int main()': a.cc:51:32: error: too few arguments to function 'LL minimum_time(int, int, int, int, vi)' 51 | printf("%lld\n", minimum_time()); | ~~~~~~~~~~~~^~ a.cc:38:4: note: declared here 38 | LL minimum_time(int n, int q, int a, int b, vi x) { | ^~~~~~~~~~~~
s662219383
p03736
C++
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef vector<int> vi; #define PB push_back const int MAXQ = 205; const int MAXN = 205; LL N, Q, A, B; vi X; LL memo[MAXQ][MAXN][MAXN]; LL mini(LL a, LL b){ if(a == -1) return b; else if(b == -1) return a; else if(a < b) return a; else return b; } LL dp(int id, int pA, int pB){ if(id == Q){ memo[id][pA][pB] = 0; return memo[id][pA][pB]; } int nxt = X[id]; if(memo[id][nxt][pB] == -1){ memo[id+1][nxt][pB] = dp(id+1, nxt, pB) + abs(nxt-pA); } if(memo[id][pA][nxt] == -1){ memo[id+1][pA][nxt] = dp(id+1, pA, nxt) + abs(nxt-pB); } memo[id][pA][pB] = min(memo[id+1][nxt][pB], memo[id+1][pA][nxt]); return memo[id][pA][pB]; } LL minimum_time() { memset(memo, -1, sizeof(memo)); return dp(0, a, b); } int main() { scanf("%d %d %d %d", &N, &Q, &A, &B); for (int i = 0; i < Q; ++i) { scanf("%d", &X[i]); } printf("%lld\n", minimum_time()); return 0; }
a.cc: In function 'LL minimum_time()': a.cc:44:18: error: 'a' was not declared in this scope 44 | return dp(0, a, b); | ^ a.cc:44:21: error: 'b' was not declared in this scope 44 | return dp(0, a, b); | ^
s885881272
p03736
C++
#include "moves.h" #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef vector<int> vi; #define PB push_back const int MAXQ = 205; const int MAXN = 205; LL N, Q, A, B; vi X; LL memo[MAXQ][MAXN][MAXN]; LL mini(LL a, LL b){ if(a == -1) return b; else if(b == -1) return a; else if(a < b) return a; else return b; } LL dp(int id, int pA, int pB){ if(id == Q){ memo[id][pA][pB] = 0; return memo[id][pA][pB]; } int nxt = X[id]; if(memo[id][nxt][pB] == -1){ memo[id+1][nxt][pB] = dp(id+1, nxt, pB) + abs(nxt-pA); } if(memo[id][pA][nxt] == -1){ memo[id+1][pA][nxt] = dp(id+1, pA, nxt) + abs(nxt-pB); } memo[id][pA][pB] = min(memo[id+1][nxt][pB], memo[id+1][pA][nxt]); return memo[id][pA][pB]; } LL minimum_time() { memset(memo, -1, sizeof(memo)); return dp(0, a, b); } int main() { scanf("%d %d %d %d", &N, &Q, &A, &B); for (int i = 0; i < Q; ++i) { scanf("%d", &X[i]); } printf("%lld\n", minimum_time()); return 0; }
a.cc:1:10: fatal error: moves.h: No such file or directory 1 | #include "moves.h" | ^~~~~~~~~ compilation terminated.
s119411199
p03736
C
#include <stdio.h> #define NMAX 200000 #define INF 1e11 #define abs(a) ((a) > 0 ? (a) : -(a)) #define min(a, b) ((a) < (b) ? (a) : (b)) long long bit[NMAX+1], revbit[NMAX+1], dp[NMAX+1]; void add(int index, int value, int size); int max(int index); int main(void) { int i, n, q, a, b; long long qsum = 0, ans = INF; scanf("%d %d %d %d", &n, &q, &a, &b); for (i = 0; i <= n; i++) bit[i] = revbit[i] = dp[i] = INF; dp[a] = 0; add(a, -a, n); revadd(a, a, n); while (q--) {; long long tmin, rtmin, res; a = b; scanf("%d", &b); qsum += abs(a - b); tmin = minimize(b) + b; rtmin = revminimize(b) - b; res = min(tmin, rtmin) - abs(a - b); if (dp[a] > res) { dp[a] = res; add(a, res - a, n); revadd(a, res + a, n); } } for (i = 0; i <= n; i++) { if (ans > dp[i]) ans = dp[i]; } printf("%lld\n", ans + qsum); } void add(int index, int value, int size) { while (index <= size) { if (bit[index] < value) bit[index] = value; index += index & (-index); } } int max(int index) { int bmax = 0; while (index > 0) { if (bmax < bit[index]) bmax = bit[index]; index -= index & (-index); } return bmax; }
main.c: In function 'main': main.c:18:3: error: implicit declaration of function 'revadd' [-Wimplicit-function-declaration] 18 | revadd(a, a, n); | ^~~~~~ main.c:24:12: error: implicit declaration of function 'minimize' [-Wimplicit-function-declaration] 24 | tmin = minimize(b) + b; | ^~~~~~~~ main.c:25:13: error: implicit declaration of function 'revminimize' [-Wimplicit-function-declaration] 25 | rtmin = revminimize(b) - b; | ^~~~~~~~~~~
s579654402
p03736
C
// Aimi >> Konomi Suzuki >> Yui >> Ikimono Gakari >> Garninelia >> Kalafina... dude? // .... Sempre Amei Você ... // Sempre amei você // Mesmo de longe sem te ter // Você me deu forças para viver // E ser quem eu queria ser // // // Você nunca verá uma menina como ela // Mais linda em sentimentos que romance de novela // Bela, ingênua, tipo como cinderela // Sorte é do homem que estiver ao lado dela // Guerreira, não compare com as demais // Lutou muito para cumprir a exigência de seus pais // Sua força vai além do que cê pensa ser capaz // Essa menina não desiste daquilo que vai atrás, mas // Eu fui tão cego pra não ver // Que apenas ao meu lado ela queria viver // Enquanto que por outra pessoa eu quis correr // Ela não desistiu de mim mesmo eu a fazendo sofrer // Que idiota, como eu não pude perceber? // Que a menina que me amava estava sempre ali pra ver // Eu sei que esse sentimento eu não mereço ter // Mas desta vez eu vou tentar com meus erros aprender // // // Sempre amei você // Mesmo de longe sem te ter // Você me deu forças para viver // E ser quem eu queria ser // // // Ela sempre esteve lá, pra me ajudar // Quando eu caí, me fez levantar // Lutei tanto por meu sonho que sempre quis alcançar // Que acabei ficando cego sem poder enxergar // Eu nem consegui notar // Que bem na minha frente era quem deveria amar // Sempre achei que estava certo e que não podia errar // Mas só mesmo quando perde pra então valorizar // E eu perdi, e finalmente entendi // Que quem eu procurava estava sempre ali // Levou muito tempo pra ficha cair // Como eu fui tapado, eu tenho que admitir // Essa menina conseguiu me surpreender // Seu olhar estava sempre além do que eu podia ver // Eu tive que a perder, só pra perceber // Que ao lado dela é onde eu quero viver // // // Sempre amei você // Mesmo de longe sem te ter // Você me deu forças para viver // E ser quem eu queria ser // // // Eu tive que a perder // Pra que pudesse perceber // Que ao lado dela // É onde eu quero viver // Sim, um dia pode ser o fim // Pode ser tarde demais e tudo acabar assim // Mas pra ela eu vou dizer // Não volto com minha palavra // Com você quero viver // // // Sempre amei você // Mesmo de longe sem te ter // Você me deu forças para viver // E ser quem eu queria ser #pragma GCC optimize ("Ofast,unroll-loops") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #define pb push_back #define ff first #define ss second #define tm1 first #define tm2 second.first #define tm3 second.second #define sz(x) ll(x.size()) #define fill(x, v) memset(x, v, sizeof(x)) #define all(v) (v).begin(), (v).end() #define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i) #define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i ) #define fastio ios_base::sync_with_stdio(0); cin.tie(0) #define N 8800015 #define M 21 #define sqr(x) (x)*(x) #define INF 20000000000000000 #define mod 1000000007 #define bas 31 #define pi acos(-1) using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef pair<ll, ll> ii; typedef pair<ll, ii > tri; typedef vector<ll> vi; typedef vector<ii> vii; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> set_t; #define trace(...) f(#__VA_ARGS__, __VA_ARGS__) template<typename t> void f(const char* x, t&& val1){ cout<<x<< " : "<<val1<<endl; } template<typename t1, typename... t2> void f(const char* x, t1&& val1, t2&&... val2){ const char* xd=strchr(x+1, ','); cout.write(x, xd-x)<<" : "<<val1<<" | "; f(xd+1, val2...); } struct T{ ll mx, sum; T(){} T(ll mx, ll sum) : mx(mx), sum(sum){} inline void clear(){ mx=INF, sum=0; } }; struct ST{ ll n, ar[1<<18]; ii lazy[1<<20]; T tree[1<<20]; inline T Op(T &val1, T &val2){ T ty; if(val1.mx==INF) return val2; if(val2.mx==INF) return val1; ty.mx=min(val1.mx, val2.mx); ty.sum=val1.sum+val2.sum; return ty; } inline void updpro(ii laz, ll id, ll l, ll r){ if(laz.ff==INF){ if(lazy[id].ff==INF){ tree[id].sum+=(r-l)*laz.ss; tree[id].mx+=laz.ss; lazy[id].ss+=laz.ss; } else{ lazy[id].ff+=laz.ss; tree[id].mx=lazy[id].ff; tree[id].sum=lazy[id].ff*(r-l); } } else{ tree[id].mx=laz.ff; tree[id].sum=(r-l)*laz.ff; lazy[id]=laz; } } inline void proh(ll id, ll l, ll r){ ll mid=(l+r)>>1; updpro(lazy[id], id<<1, l, mid); updpro(lazy[id], id<<1|1, mid, r); lazy[id]={INF, 0}; } inline void Upd(ll x, ll y, ii val, ll id, ll l, ll r){ if(x>=r || y<=l) return; if(x<=l && r<=y){ updpro(val, id, l, r); return; } proh(id, l, r); ll mid=(l+r)>>1; Upd(x, y, val, id<<1, l, mid); Upd(x, y, val, id<<1|1, mid, r); tree[id]=Op(tree[id<<1], tree[id<<1|1]); } inline T Que(ll x, ll y, ll id, ll l, ll r){ if(x>=r || y<=l) {T ans; ans.clear(); return ans;}; if(x<=l && r<=y) return tree[id]; proh(id, l, r); ll mid=(l+r)>>1; T left, right; left=Que(x, y, id<<1, l, mid); right=Que(x, y, id<<1|1, mid, r); return Op(left, right); } inline void build1(ll id, ll l, ll r){ if(l+1==r){ tree[id].mx=ar[l]; tree[id].sum=ar[l]; return; } ll mid=(l+r)>>1; build1(id<<1, l, mid), build1(id<<1|1, mid, r); tree[id]=Op(tree[id<<1], tree[id<<1|1]); } inline void upd(ll l, ll r, ii val){ Upd(l, r, val, 1, 0, n); } inline T que(ll l, ll r){ return Que(l, r, 1, 0, n); } inline void build(){ FER(i,0,n<<2) lazy[i]={INF, 0}; build1(1, 0, n); } }st[1<<2]; ll val[1<<18]; int main(){ fastio; ll n, q, a, b, ans=INF; cin>>n>>q>>a>>b; st[0].n=2e5+1; st[1].n=2e5+1; val[0]=a; FER(i,1,q+1) cin>>val[i]; FER(i,0,2e5+1){ if(i==b){ st[0].ar[i]=-i; st[1].ar[i]=i; } else{ st[0].ar[i]=INF; st[1].ar[i]=INF; } } st[0].build(); st[1].build(); FER(i,1,q+1){ ll nxt=val[i], last=val[i-1]; ll l=st[0].que(0, nxt).mx, r=st[1].que(nxt, 2e5+1).mx; l+=nxt, r-=nxt; ll valor=min(l, r), add=abs(nxt-last); st[0].upd(last, last+1, {valor-last, 0}); st[1].upd(last, last+1, {valor+last, 0}); st[0].upd(0, last, {INF, add}); st[0].upd(last+1, 2e5+1, {INF, add}); st[1].upd(last+1, 2e5+1, {INF, add}); st[1].upd(0, last, {INF, add}); } FER(i,0,2e5+1){ ll cur=st[1].que(i, i+1).mx-i; ans=min(ans, cur); } cout<<ans<<endl; return 0; }
main.c:78:10: fatal error: bits/stdc++.h: No such file or directory 78 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s462681740
p03736
C++
#include<vector> #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> #define pb push_back #define gt getchar() #define ll long long #define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout) typedef std::pair<int,int> P; #define mk std::make_pair #define fr first #define sc second inline int in() { int k=0;char ch=gt;bool p=1; while(ch<'-')ch=gt;if(ch=='-')ch=gt,p=0; while(ch>'-')k=k*10+ch-'0',ch=gt; return p?k:-k; } const int N=4e5+5; ll ans=1e18; ll x[N],y[N],n,Mx,Mi,mx,mi,fz[N<<1],tot; std::vector<int>G[N<<1]; inline void upd(int x,int i){if(x>Mx)Mx=x,mx=i;if(x<Mi)Mi=x,mi=i;} inline void work1() { int mmx=-2e9,mmi=2e9; mmx=std::max(mmx,y[mx]); mmi=std::min(mmi,x[mi]); for(int i=1;i<=n;++i) if(i!=mx&&i!=mi) mmx=std::max(mmx,y[i]),mmi=std::min(mmi,x[i]); ans=std::min(ans,1ll*(mmx-Mi)*(Mx-mmi)); } inline void work2() { for(int i=1;i<=n;++i)fz[++tot]=x[i],fz[++tot]=y[i]; std::sort(fz+1,fz+tot+1);tot=std::unique(fz+1,fz+tot+1)-fz-1; int mmi=std::min(y[mx],x[mi]),mmx=y[mx]+x[mi]-mmi; for(int i=1;i<=n;++i)if(i!=mx&&i!=mi)mmi=std::min(mmi,x[i]),mmx=std::max(mmx,y[i]); int l=std::lower_bound(fz+1,fz+tot+1,mmi)-fz; for(int i=1;i<=n;++i)if(i!=mx&&i!=mi)G[std::lower_bound(fz+1,fz+tot+1,y[i])-fz].pb(i); for(int i=2;i<=l;++i) { ans=std::min(ans,1ll*(Mx-Mi)*(mmx-fz[i])); for(int j:G[i])mmx=std::max(mmx,x[j]); } } int main() { n=in();Mx=-2e9,Mi=2e9; for(int i=1;i<=n;++i) { upd(x[i]=in(),i),upd(y[i]=in(),i); if(x[i]<y[i])std::swap(x[i],y[i]); } work1(),work2();printf("%lld\n",ans); return 0; }
a.cc: In function 'void work1()': a.cc:30:21: error: no matching function for call to 'max(int&, long long int&)' 30 | mmx=std::max(mmx,y[mx]); | ~~~~~~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/vector:62, from a.cc:1: /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:30:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 30 | mmx=std::max(mmx,y[mx]); | ~~~~~~~~^~~~~~~~~~~ /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, from a.cc:5: /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:30:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 30 | mmx=std::max(mmx,y[mx]); | ~~~~~~~~^~~~~~~~~~~ a.cc:31:21: error: no matching function for call to 'min(int&, long long int&)' 31 | mmi=std::min(mmi,x[mi]); | ~~~~~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:31:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 31 | mmi=std::min(mmi,x[mi]); | ~~~~~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:31:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 31 | mmi=std::min(mmi,x[mi]); | ~~~~~~~~^~~~~~~~~~~ a.cc:34:37: error: no matching function for call to 'max(int&, long long int&)' 34 | mmx=std::max(mmx,y[i]),mmi=std::min(mmi,x[i]); | ~~~~~~~~^~~~~~~~~~ /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:34:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 34 | mmx=std::max(mmx,y[i]),mmi=std::min(mmi,x[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 /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:34:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 34 | mmx=std::max(mmx,y[i]),mmi=std::min(mmi,x[i]); | ~~~~~~~~^~~~~~~~~~ a.cc:34:60: error: no matching function for call to 'min(int&, long long int&)' 34 | mmx=std::max(mmx,y[i]),mmi=std::min(mmi,x[i]); | ~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:34:60: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 34 | mmx=std::max(mmx,y[i]),mmi=std::min(mmi,x[i]); | ~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:34:60: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 34 | mmx=std::max(mmx,y[i]),mmi=std::min(mmi,x[i]); | ~~~~~~~~^~~~~~~~~~ a.cc: In function 'void work2()': a.cc:42:58: error: no matching function for call to 'min(int&, long long int&)' 42 | for(int i=1;i<=n;++i)if(i!=mx&&i!=mi)mmi=std::min(mmi,x[i]),mmx=std::max(mmx,y[i]); | ~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:42:58: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 42 | for(int i=1;i<=n;++i)if(i!=mx&&i!=mi)mmi=std::min(mmi,x[i]),mmx=std::max(mmx,y[i]); | ~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:42:58: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 42 | for(int i=1;i<=n;++i)if(i!=mx&&i!=mi)mmi=std::min(mmi,x[i]),mmx=std::max(mmx,y[i]); | ~~~~~~~~^~~~~~~~~~ a.cc:42:81: error: no matching function for call to 'max(int&, long long int&)' 42 | for(int i=1;i<=n;++i)if(i!=mx&&i!=mi)mmi=std::min(mmi,x[i]),mmx=std::max(mmx,y[i]); | ~~~~~~~~^~~~~~~~~~ /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_
s187198388
p03736
C++
#include <bits/stdc++.h> using namespace std; const long long INF = 1e17; struct SE { int n, op; vector<long long> v; void Init(int _n, int _op) { n = _n; op = _op; v.resize(n * 4 + 1, INF); } void Set(int t, int l, int r, int x, long long _v) { if (l == r) { v[t] = _v + l * op; return; } int md = (l + r) >> 1; if (x <= md) Set(t << 1, l, md, x, _v); else Set(t << 1 | 1, md + 1, r, x, _v); v[t] = min(v[t << 1], v[t << 1 | 1]); } long long Query(int t, int l, int r, int L, int R) { if (L <= l && r <= R) return v[t]; int md = (l + r) >> 1; long long re = INF; if (L <= md) re = min(re, Query(t << 1, l, md, L, R)); if (R > md) re = min(re, Query(t << 1 | 1, md + 1, r, L, R)); return re; } } lt, rt; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, nq, a, b; long long tag = 0; cin >> n >> nq >> a >> b; vector<int> x(nq); vector<long long> dp(n + 1, INF); cin >> x[0]; lt.Init(n, -1); rt.Init(n, 1); lt.Set(1, 1, n, a, abs(x[0] - b)); lt.Set(1, 1, n, b, abs(x[0] - a)); rt.Set(1, 1, n, a, abs(x[0] - b)); rt.Set(1, 1, n, b, abs(x[0] - a)); dp[a] = min(dp[a], abs(x[0] - b)); dp[b] = min(dp[b], abs(x[0] - a)); for (int i = 1; i < nq; ++i) { cin >> x[i]; long long lck = lt.Query(1, 1, n, 1, x[i]) + x[i] + tag; long long rck = rt.Query(1, 1, n, x[i], n) - x[i] + tag; tag += abs(x[i] - x[i - 1]); if (dp[x[i - 1]] + tag > min(lck, rck)) { dp[x[i - 1]] = min(lck, rck) - tag; lt.Set(1, 1, n, x[i - 1], dp[x[i - 1]]); rt.Set(1, 1, n, x[i - 1], dp[x[i - 1]]); } } long long ans = INF; for (int i = 1; i <= n; ++i) { ans = min(ans, dp[i]); } cout << ans + tag << endl; return 0; }
a.cc: In function 'int main()': a.cc:55:18: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int)' 55 | dp[a] = min(dp[a], abs(x[0] - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:55:18: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 55 | dp[a] = min(dp[a], abs(x[0] - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:55:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 55 | dp[a] = min(dp[a], abs(x[0] - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ a.cc:56:18: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int)' 56 | dp[b] = min(dp[b], abs(x[0] - a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:56:18: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 56 | dp[b] = min(dp[b], abs(x[0] - a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:56:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 56 | dp[b] = min(dp[b], abs(x[0] - a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s711389942
p03736
C++
#include <bits/stdc++.h> using namespace std; const long long INF = 1e17; struct SE { int n, op; vector<long long> v; void Init(int _n, int _op) { n = _n; op = _op; v.resize(n * 4 + 1, INF); } void Set(int t, int l, int r, int x, long long _v) { if (l == r) { v[t] = _v + l * op; return; } int md = (l + r) >> 1; if (x <= md) Set(t << 1, l, md, x, _v); else Set(t << 1 | 1, md + 1, r, x, _v); v[t] = min(v[t << 1], v[t << 1 | 1]); } long long Query(int t, int l, int r, int L, int R) { if (L <= l && r <= R) return v[t]; int md = (l + r) >> 1, re = INF; if (L <= md) re = min(re, Query(t << 1, l, md, L, R)); if (R > md) re = min(re, Query(t << 1 | 1, md + 1, r, L, R)); return re; } } lt, rt; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, nq, a, b; long long tag = 0; cin >> n >> nq >> a >> b; vector<int> x(nq); vector<long long> dp(n + 1, INF); cin >> x[0]; lt.Init(n, -1); rt.Init(n, 1); lt.Set(1, 1, n, a, abs(x[0] - b)); lt.Set(1, 1, n, b, abs(x[0] - a)); rt.Set(1, 1, n, a, abs(x[0] - b)); rt.Set(1, 1, n, b, abs(x[0] - a)); dp[a] = min(dp[a], abs(x[0] - b)); dp[b] = min(dp[b], abs(x[0] - a)); for (int i = 1; i < nq; ++i) { cin >> x[i]; long long lck = lt.Query(1, 1, n, 1, x[i]) + x[i] + tag; long long rck = rt.Query(1, 1, n, x[i], n) - x[i] + tag; tag += abs(x[i] - x[i - 1]); if (dp[x[i - 1]] + tag > min(lck, rck)) { dp[x[i - 1]] = min(lck, rck) - tag; lt.Set(1, 1, n, x[i - 1], dp[x[i - 1]]); rt.Set(1, 1, n, x[i - 1], dp[x[i - 1]]); } } long long ans = INF; for (int i = 1; i <= n; ++i) { ans = min(ans, dp[i]); } cout << ans + tag << endl; return 0; }
a.cc: In member function 'long long int SE::Query(int, int, int, int, int)': a.cc:30:33: warning: overflow in conversion from 'long long int' to 'int' changes value from '100000000000000000' to '1569325056' [-Woverflow] 30 | int md = (l + r) >> 1, re = INF; | ^~~ a.cc:31:26: error: no matching function for call to 'min(int&, long long int)' 31 | if (L <= md) re = min(re, Query(t << 1, l, md, L, R)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:31:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 31 | if (L <= md) re = min(re, Query(t << 1, l, md, L, R)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:31:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 31 | if (L <= md) re = min(re, Query(t << 1, l, md, L, R)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:32:25: error: no matching function for call to 'min(int&, long long int)' 32 | if (R > md) re = min(re, Query(t << 1 | 1, md + 1, r, L, R)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:32:25: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 32 | if (R > md) re = min(re, Query(t << 1 | 1, md + 1, r, L, R)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:32:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 32 | if (R > md) re = min(re, Query(t << 1 | 1, md + 1, r, L, R)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:54:14: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int)' 54 | dp[a] = min(dp[a], abs(x[0] - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:54:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 54 | dp[a] = min(dp[a], abs(x[0] - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:54:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 54 | dp[a] = min(dp[a], abs(x[0] - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ a.cc:55:14: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int)' 55 | dp[b] = min(dp[b], abs(x[0] - a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:55:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 55 | dp[b] = min(dp[b], abs(x[0] - a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:55:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 55 | dp[b] = min(dp[b], abs(x[0] - a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s778381946
p03736
C++
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #define fi first #define se second #define mp make_pair #define pb push_back using namespace std; typedef long long LL; const int maxn = 2e5 + 100; LL Plus[maxn*4], Minus[maxn*4], tag[maxn*4]; inline LL abs(LL x) { return x < 0 ? -x : x; } inline void Puttag(int o, LL v){ Plus[o] += v; Minus[o] += v; tag[o] += v; } inline void Pushdown(int o){ if(!tag[o]) return; Puttag(o*2, tag[o]); Puttag(o*2+1, tag[o]); tag[o] = 0; } inline void Maintain(int o){ Plus[o] = min(Plus[o*2], Plus[o*2+1]); Minus[o] = min(Minus[o*2], Minus[o*2+1]); } inline bool Cut(int x) { return false; } inline bool Check(int x) { return true; } inline void Change(int o, int l, int r, int L, int R, LL v){ if(L > r || R < l || Cut(o)) return; if(L <= l && r <= R && Check(o)){ Puttag(o, v); return; } int mid = (l+r)/2; Pushdown(o); Change(o*2, l, mid, L, R, v); Change(o*2+1, mid+1, r, L, R, v); Maintain(o); } inline long long Query(int o, int l, int r, int L, int R, int ty){ if(L > r || R < l || Cut(o)) return 1e18; if(L <= l && r <= R){ return ty ? Plus[o] : Minus[o]; } int mid = (l+r)/2; Pushdown(o); ans = min(Query(o*2+1, mid+1, r, L, R, ty), Query(o*2, l, mid, L, R, ty)); Maintain(o); return ans; } inline void Insert(int o, int l, int r, int k, LL v, int ty){ if(l == r) { if(ty) Plus[o] = v; else Minus[o] = v; return; } int mid = (l+r)/2; Pushdown(o); if(k <= mid) Insert(o*2, l, mid, k, v, ty); else Insert(o*2+1, mid+1, r, k, v, ty); Maintain(o); } int N, Q, A, B; int x[maxn]; int main(){ scanf("%d %d %d %d", &N, &Q, &A, &B); for(int i = 1; i <= Q; i++) scanf("%d", &x[i]); x[0] = B; // dp[i][x] = dp[i-1][x] + || // dp[i][x[i-1]] = all(dp[i-1][x]+|x-x[i]|) // x <= x[i] -> dp[i-1][x] + x[i] - x // x > x[i] -> dp[i-1][x] + x - x[i] memset(Plus, 1, sizeof(Plus)); memset(Minus, 1, sizeof(Minus)); Insert(1, 1, N, A, A, 1); Insert(1, 1, N, A, -A, 0); for(int i = 1; i <= Q; i++){ LL ans = min(Query(1, 1, N, 1, x[i], 0) + x[i], Query(1, 1, N, x[i]+1, N, 1) - x[i]); Change(1, 1, N, 1, x[i-1]-1, abs(x[i] - x[i-1])); Change(1, 1, N, x[i-1]+1, N, abs(x[i] - x[i-1])); Insert(1, 1, N, x[i-1], ans + x[i-1], 1); Insert(1, 1, N, x[i-1], ans - x[i-1], 0); } LL ans = 1e18; for(int i = 1; i <= N; i++){ ans = min(ans, Query(1, 1, N, i, i, 0) + i); } cout<<ans<<endl; }
a.cc: In function 'long long int Query(int, int, int, int, int, int)': a.cc:47:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 47 | ans = min(Query(o*2+1, mid+1, r, L, R, ty), Query(o*2, l, mid, L, R, ty)); | ^~~ | abs
s533362174
p03736
C++
#include<bits/stdc++.h> using namespace std; const int N=3000000; long long n,m,a1,b1,i,tmp,ans; long long p[N],p1[N],s[N],s1[N],a[N]; void update(int x,int k) { p1[x*2]+=p1[x]; p1[x*2+1]+=p1[x]; p[x*2]+=p1[x]; p[x*2+1]+=p1[x]; p1[x]=0; s1[x*2]+=s1[x]; s1[x*2+1]+=s1[x]; s[x*2]+=s1[x]; s[x*2+1]+=s1[x]; s1[x]=0;} void renew(int x) { p[x]=min(p[x*2],p[x*2+1]); s[x]=min(s[x*2],s[x*2+1]); } void getmin(int q,int l,int r,int pos,int zhi) { update(q,2); if (l==r) { p[q]=1ll*zhi+pos; s[q]=1ll*zhi-pos; return;} int mid=(l+r)/2; if (pos<=mid) getmin(q*2,l,mid,pos,zhi); else getmin(q*2+1,mid+1,r,pos,zhi); renew(q); } long long query(int q,int l,int r,int x,int y,int k) { if (x>y) return 2e10; if ((x<=l)&&(r<=y)) { return (k)? p[q]:s[q];} else { update(q,k); //int mid=(l+r)/2; long long ans1=1e10,ans2=1e10; if (x>=mid+1) return query(q*2+1,mid+1,r,x,y,k); else if (y<=mid) return query(q*2,l,mid,x,y,k); else return(min(query(q*2+1,mid+1,r,mid+1,y,k),query(q*2,l,mid,x,mid,k))); } } int main() { cin>>n>>m>>a1>>b1; for (int i=1;i<=m;i++) scanf("%d",&a[i]); memset(p,0x3f,sizeof(p)); memset(s,0x3f,sizeof(s)); getmin(1,1,n,a1,0); a[0]=b1; for (int i=1;i<=m;i++) { // cout<<a[i]<<' '<<query(1,1,n,1,a[i],0)<<' '<<query(1,1,n,a[i]+1,n,1)<<endl; tmp=min(query(1,1,n,1,a[i],0)+a[i],query(1,1,n,a[i]+1,n,1)-a[i]); //cout<<a[i-1]<<' '<<tmp<<endl; // for (int j=1;j<=n;j++) //{ cout<<i<<' '<<j<<' '<<query(1,1,n,j,j,0)+j<<endl;} p[1]+=abs(a[i]-a[i-1]); s[1]=abs(a[i]-a[i-1]); p1[1]+=abs(a[i]-a[i-1]);s1[1]+=abs(a[i]-a[i-1]); //cout<<p1[1]<<' '<<s1[1]<<endl; getmin(1,1,n,a[i-1],tmp); } ans=2e10; for ( i=1;i<=n;i++) {ans=min(ans,query(1,1,n,i,i,0)+i); } cout<<ans; }
a.cc: In function 'long long int query(int, int, int, int, int, int)': a.cc:36:24: error: 'mid' was not declared in this scope 36 | if (x>=mid+1) return query(q*2+1,mid+1,r,x,y,k); | ^~~
s705202919
p03736
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define repr(i,a,b) for(int i=a;i<b;i++) #define rep(i,n) for(int i=0;i<n;i++) #define reprrev(i,a,b) for(int i=b-1;i>=a;i--) #define reprev(i,n) reprrev(i,0,n) using ll = long long; constexpr long long INFL = LLONG_MAX / 2; class SegTree { public: int n; // 葉の数 vector<ll> dat; // 各ノードの値 ll def = INFL; // デフォルト値(零元) // 区間クエリを決める関数 ll operation(ll a, ll b) { return min(a, b); } // 初期化(n_は必要な要素数) SegTree(int n_) { n = 1; while (n < n_) { n *= 2; } dat = vector<ll>(2 * n - 1, def); } // 場所i(0-indexed)の値をxに更新 void change(int i, ll x) { i += n - 1; dat[i] = x; while (i > 0) { i = (i - 1) / 2; dat[i] = operation(dat[i * 2 + 1], dat[i * 2 + 2]); } } // 場所i(0-indexed)の値を返す ll at(int i) { return dat[i + n - 1]; } // 区間[a,b)の値。ノードk=[l,r)に着目している。 ll _query(int a, int b, int k, int l, int r) { if (b <= a) return def; // 不正な区間の指定 if (r <= a || b <= l)return def; // 交差しない if (a <= l && r <= b)return dat[k]; // a,l,r,bの順で完全に含まれる else { ll c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子 ll c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子 return operation(c1, c2); } } // 内部クエリ_query()を呼び出す ll query(int a, int b) { return _query(a, b, 0, 0, n); } }; int main(void) { int N, Q, A, B; cin >> N >> Q >> A >> B; A--; B--; // 座標を0-indexedに変更する vector<int> x(Q + 1); x[0] = A; // 計算しやすいよう、0番目のクエリの値をAにする rep(i, Q) { cin >> x[i + 1]; x[i + 1]--; // 座標を0-indexedに変更する } // 左側担当と右側担当のセグ木を用意 SegTree dpl(N); // dp[i]-i を格納 SegTree dpr(N); // dp[i]+i を格納 // dp[B] = 0, dp[他] = ∞ dpl.change(B, 0 - B); dpr.change(B, 0 + B); // 全要素に一律に足す値 ll add = 0; repr(q, 1, Q + 1) { // 一律に足す値 int diff = abs(x[q] - x[q - 1]); add += diff; // 更新すべきはdp[x[q-1]]のみ // 新しい値を計算 // dplの区間 [0, x[q]) 、dprの区間 [x[q], N) の最小値をx[q]で補正した値の小さい方) ll newval = min(dpl.query(0, x[q]) + x[q], dpr.query(x[q], N) - x[q]); // diffを足すことを考慮して、[真の値-diff]に更新 dpl.change(x[q - 1], newval - diff - x[q - 1]); dpr.change(x[q - 1], newval - diff + x[q - 1]); } // 最小コストの計算 ll ans = INFL; rep(i, N) { // dp[i]の値は、dpl[i]+i か dpr[i]-i のどちらでも計算できる ans = min(ans, dpl.at(i) + i); } // 全体に足す値を足して答えを出力 cout << ans + add << endl; return 0; }
a.cc:13:28: error: 'LLONG_MAX' was not declared in this scope 13 | constexpr long long INFL = LLONG_MAX / 2; | ^~~~~~~~~ a.cc:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <algorithm> +++ |+#include <climits> 4 | using namespace std;
s274714345
p03736
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; const int N=2e5; typedef long long LL; const LL INF=1e14; LL n,q,ax,bx,a[N+10]; LL sum=0,f[N+10]; struct bit { LL t[N+10]; void clear() { for (int i=1;i<=N;i++) t[i]=INF; return; } int lowbit(int x) { return x&(-x); } void Add(int x,LL va) { while (x<=N) { t[x]=min(t[x],va); x+=lowbit(x); } } LL Query(int x) { LL ans=INF; while (x>0) { ans=min(t[x],ans); x-=lowbit(x); } return ans; } }bit1,bit2; LL abs(LL x) { if (x<0) return -x; return x; } int main() { scanf("%lld%lld%lld%lld",&n,&q,&ax,&bx); for (int i=1;i<=q;i++) scanf("%lld",&a[i]); bit1.clear(); bit2.clear(); bit1.Add(ax,abs(bx-a[1])-ax); bit1.Add(bx,abs(ax-a[1])-bx); bit2.Add(n+1-ax,abs(bx-a[1])+ax); bit2.Add(n+1-bx,abs(ax-a[1])+bx); for (int i=1;i<=N;i++) f[i]=INF; f[ax]=min(f[ax],abs(bx-a[1])); f[bx]=min(f[bx],abs(ax-a[1])); for (int i=2;i<=q;i++) { LL now1=bit1.Query(a[i]),now2=bit2.Query(n+1-a[i]); now1=now1+a[i]; now2=now2-a[i]; now1=min(now1,now2)-abs(a[i]-a[i-1]); bit1.Add(a[i-1],now1-a[i-1]); bit2.Add(n+1-a[i-1],now1+a[i-1]); f[a[i-1]]=min(f[a[i-1]],now1); sum+=abs(a[i]-a[i-1]); } LL ans=INF; for (int i=1;i<=n;i++) ans=min(ans,f[i]+sum); printf("%lld\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:44:24: error: call of overloaded 'abs(LL)' is ambiguous 44 | bit1.Add(ax,abs(bx-a[1])-ax); | ~~~^~~~~~~~~ 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:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:35:4: note: candidate: 'LL abs(LL)' 35 | LL abs(LL x) { | ^~~ In file included from /usr/include/c++/14/cstdlib:81: /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:45:24: error: call of overloaded 'abs(LL)' is ambiguous 45 | bit1.Add(bx,abs(ax-a[1])-bx); | ~~~^~~~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:35:4: note: candidate: 'LL abs(LL)' 35 | LL abs(LL x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:46:28: error: call of overloaded 'abs(LL)' is ambiguous 46 | bit2.Add(n+1-ax,abs(bx-a[1])+ax); | ~~~^~~~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:35:4: note: candidate: 'LL abs(LL)' 35 | LL abs(LL x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:47:28: error: call of overloaded 'abs(LL)' is ambiguous 47 | bit2.Add(n+1-bx,abs(ax-a[1])+bx); | ~~~^~~~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:35:4: note: candidate: 'LL abs(LL)' 35 | LL abs(LL x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:49:28: error: call of overloaded 'abs(LL)' is ambiguous 49 | f[ax]=min(f[ax],abs(bx-a[1])); | ~~~^~~~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:35:4: note: candidate: 'LL abs(LL)' 35 | LL abs(LL x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:50:28: error: call of overloaded 'abs(LL)' is ambiguous 50 | f[bx]=min(f[bx],abs(ax-a[1])); | ~~~^~~~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:35:4: note: candidate: 'LL abs(LL)' 35 | LL abs(LL x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:55:40: error: call of overloaded 'abs(LL)' is ambiguous 55 | now1=min(now1,now2)-abs(a[i]-a[i-1]); | ~~~^~~~~~~~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:35:4: note: candidate: 'LL abs(LL)' 35 | LL abs(LL x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
s880396516
p03736
C++
#include<cstdio> #include<cstring> #define LL long long #define N 1200000 #define INF 0x3f3f3f3f3f3f3f3f LL n,m,x,y,ans,mn1,mn2,a[N],seg[2][N],seg0[2][N],seg1[2][N],tag[2][N]; ll min(ll x,ll y){ return x<y?x:y; } ll max(ll x,ll y){ return x>y?x:y; } ll abs(ll x){ return x>0?x:-x; } void add(LL op,LL k){ seg[op][1]+=k; seg0[op][1]+=k; seg1[op][1]+=k; tag[op][1]+=k; } void pushdown(LL op,LL x){ tag[op][x<<1]+=tag[op][x]; tag[op][x<<1|1]+=tag[op][x]; seg[op][x<<1]=min(INF,seg[op][x<<1]+tag[op][x]); seg0[op][x<<1]=min(INF,seg0[op][x<<1]+tag[op][x]); seg1[op][x<<1]=min(INF,seg1[op][x<<1]+tag[op][x]); seg[op][x<<1|1]=min(INF,seg[op][x<<1|1]+tag[op][x]); seg0[op][x<<1|1]=min(INF,seg0[op][x<<1|1]+tag[op][x]); seg1[op][x<<1|1]=min(INF,seg1[op][x<<1|1]+tag[op][x]); tag[op][x]=0; } void mdf(LL op,LL x,LL l,LL r,LL t,LL k){ if (l==r){ if (seg[op][x]>k){seg[op][x]=k; seg0[op][x]=k-t; seg1[op][x]=k+t;} return; } pushdown(op,x); LL mid=(l+r)>>1; if (t<=mid) mdf(op,x<<1,l,mid,t,k); if (t>mid) mdf(op,x<<1|1,mid+1,r,t,k); seg[op][x]=min(seg[op][x<<1],seg[op][x<<1|1]); seg0[op][x]=min(seg0[op][x<<1],seg0[op][x<<1|1]); seg1[op][x]=min(seg1[op][x<<1],seg1[op][x<<1|1]); } LL qry1(LL op,LL x,LL l,LL r,LL L,LL R){ if (l>=L && r<=R){ return seg0[op][x]; } LL mid=(l+r)>>1,tmp=INF; pushdown(op,x); if (L<=mid) tmp=min(tmp,qry1(op,x<<1,l,mid,L,R)); if (R>mid) tmp=min(tmp,qry1(op,x<<1|1,mid+1,r,L,R)); return tmp; } LL qry2(LL op,LL x,LL l,LL r,LL L,LL R){ if (l>=L && r<=R){ return seg1[op][x]; } LL mid=(l+r)>>1,tmp=INF; pushdown(op,x); if (L<=mid) tmp=min(tmp,qry2(op,x<<1,l,mid,L,R)); if (R>mid) tmp=min(tmp,qry2(op,x<<1|1,mid+1,r,L,R)); return tmp; } int main(){ scanf("%lld%lld%lld%lld",&n,&m,&x,&y); memset(seg,0x3f,sizeof seg); memset(seg0,0x3f,sizeof seg0); memset(seg1,0x3f,sizeof seg1); mdf(0,1,1,n,x,0); mdf(1,1,1,n,y,0); for (LL i=1;i<=m;i++){ scanf("%lld",&a[i]); mn1=mn2=INF; mn1=qry1(0,1,1,n,1,a[i])+a[i]; mn1=min(mn1,qry2(0,1,1,n,a[i],n)-a[i]); mn2=qry1(1,1,1,n,1,a[i])+a[i]; mn2=min(mn2,qry2(1,1,1,n,a[i],n)-a[i]); add(0,abs(a[i]-(i==1?y:a[i-1]))); add(1,abs(a[i]-(i==1?x:a[i-1]))); mdf(0,1,1,n,i==1?x:a[i-1],mn2); mdf(1,1,1,n,i==1?y:a[i-1],mn1); } printf("%lld\n",min(seg[0][1]+tag[0][1],seg[1][1]+tag[1][1])); return 0; }
a.cc:8:1: error: 'll' does not name a type; did you mean 'LL'? 8 | ll min(ll x,ll y){ return x<y?x:y; } | ^~ | LL a.cc:9:1: error: 'll' does not name a type; did you mean 'LL'? 9 | ll max(ll x,ll y){ return x>y?x:y; } | ^~ | LL a.cc:10:1: error: 'll' does not name a type; did you mean 'LL'? 10 | ll abs(ll x){ return x>0?x:-x; } | ^~ | LL a.cc: In function 'void pushdown(long long int, long long int)': a.cc:17:23: error: 'min' was not declared in this scope 17 | seg[op][x<<1]=min(INF,seg[op][x<<1]+tag[op][x]); | ^~~ a.cc: In function 'void mdf(long long int, long long int, long long int, long long int, long long int, long long int)': a.cc:35:20: error: 'min' was not declared in this scope; did you mean 'mid'? 35 | seg[op][x]=min(seg[op][x<<1],seg[op][x<<1|1]); | ^~~ | mid a.cc: In function 'long long int qry1(long long int, long long int, long long int, long long int, long long int, long long int)': a.cc:46:25: error: 'min' was not declared in this scope; did you mean 'mid'? 46 | if (L<=mid) tmp=min(tmp,qry1(op,x<<1,l,mid,L,R)); | ^~~ | mid a.cc:47:24: error: 'min' was not declared in this scope; did you mean 'mid'? 47 | if (R>mid) tmp=min(tmp,qry1(op,x<<1|1,mid+1,r,L,R)); | ^~~ | mid a.cc: In function 'long long int qry2(long long int, long long int, long long int, long long int, long long int, long long int)': a.cc:57:25: error: 'min' was not declared in this scope; did you mean 'mid'? 57 | if (L<=mid) tmp=min(tmp,qry2(op,x<<1,l,mid,L,R)); | ^~~ | mid a.cc:58:24: error: 'min' was not declared in this scope; did you mean 'mid'? 58 | if (R>mid) tmp=min(tmp,qry2(op,x<<1|1,mid+1,r,L,R)); | ^~~ | mid a.cc: In function 'int main()': a.cc:72:21: error: 'min' was not declared in this scope; did you mean 'main'? 72 | mn1=min(mn1,qry2(0,1,1,n,a[i],n)-a[i]); | ^~~ | main a.cc:75:23: error: 'abs' was not declared in this scope; did you mean 'ans'? 75 | add(0,abs(a[i]-(i==1?y:a[i-1]))); | ^~~ | ans a.cc:79:25: error: 'min' was not declared in this scope; did you mean 'main'? 79 | printf("%lld\n",min(seg[0][1]+tag[0][1],seg[1][1]+tag[1][1])); | ^~~ | main
s106085602
p03736
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <vector> #include <map> #include <set> using namespace std; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; long long dp[500][500][500]; int main() { int n, q, A, B; scanf("%d%d%d%d", &n, &q, &A, &B); vector<int> x(q); for (int i = 0; i < q; i ++) scanf("%d", &x[i]); memset(dp, -1, sizeof dp); dp[0][A][B] = 0; for (int i = 0; i < q; i ++) { for (int a = 1; a <= n; a ++) { for (int b = 1; b <= n; b ++) { if (dp[i][a][b] == -1) continue; int X = x[i]; dp[i + 1][X][b] = dp[i][a][b] + abs(X - a); dp[i + 1][a][X] = dp[i][a][b] + abs(X - b); } } } long long ans = INFL; for (int i = 1; i <= n; i ++) { for (int j = 1; j <= n; j ++) { if (~dp[q][i][j]) { ans = min(ans, dp[q][i][j]); } } } printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'memset' was not declared in this scope 19 | memset(dp, -1, sizeof dp); | ^~~~~~ a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 7 | #include <set> +++ |+#include <cstring> 8 | using namespace std;
s812514422
p03736
C++
#include<bits/stdc++.h> typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; typedef double lf; typedef long double llf; typedef std::pair<int,int> pii; #define xx first #define yy second template<typename T> inline T max(T a,T b){return a>b?a:b;} template<typename T> inline T min(T a,T b){return a<b?a:b;} template<typename T> inline T abs(T a){return a>0?a:-a;} template<typename T> inline bool repr(T &a,T b){return a<b?a=b,1:0;} template<typename T> inline bool repl(T &a,T b){return a>b?a=b,1:0;} template<typename T> inline T gcd(T a,T b){T t;if(a<b){while(a){t=a;a=b%a;b=t;}return b;}else{while(b){t=b;b=a%b;a=t;}return a;}} template<typename T> inline T sqr(T x){return x*x;} #define mp(a,b) std::make_pair(a,b) #define pb push_back #define I inline #define mset(a,b) memset(a,b,sizeof(a)) #define mcpy(a,b) memcpy(a,b,sizeof(a)) #define fo0(i,n) for(int i=0,i##end=n;i<i##end;i++) #define fo1(i,n) for(int i=1,i##end=n;i<=i##end;i++) #define fo(i,a,b) for(int i=a,i##end=b;i<=i##end;i++) #define fd0(i,n) for(int i=(n)-1;~i;i--) #define fd1(i,n) for(int i=n;i;i--) #define fd(i,a,b) for(int i=a,i##end=b;i>=i##end;i--) #define foe(i,x)for(__typeof(x.end())i=x.begin();i!=x.end();++i) struct Cg{I char operator()(){return getchar();}}; struct Cp{I void operator()(char x){putchar(x);}}; #define OP operator #define RT return *this; #define RX x=0;char t=P();while((t<'0'||t>'9')&&t!='-')t=P();bool f=0;\ if(t=='-')t=P(),f=1;x=t-'0';for(t=P();t>='0'&&t<='9';t=P())x=x*10+t-'0' #define RL if(t=='.'){lf u=0.1;for(t=P();t>='0'&&t<='9';t=P(),u*=0.1)x+=u*(t-'0');}if(f)x=-x #define RU x=0;char t=P();while(t<'0'||t>'9')t=P();x=t-'0';for(t=P();t>='0'&&t<='9';t=P())x=x*10+t-'0' #define TR *this,x;return x; I bool IS(char x){return x==10||x==13||x==' ';}template<typename T>struct Fr{T P;I Fr&OP,(int&x) {RX;if(f)x=-x;RT}I OP int(){int x;TR}I Fr&OP,(ll &x){RX;if(f)x=-x;RT}I OP ll(){ll x;TR}I Fr&OP,(char&x) {for(x=P();IS(x);x=P());RT}I OP char(){char x;TR}I Fr&OP,(char*x){char t=P();for(;IS(t);t=P());if(~t){for(;!IS (t)&&~t;t=P())*x++=t;}*x++=0;RT}I Fr&OP,(lf&x){RX;RL;RT}I OP lf(){lf x;TR}I Fr&OP,(llf&x){RX;RL;RT}I OP llf() {llf x;TR}I Fr&OP,(uint&x){RU;RT}I OP uint(){uint x;TR}I Fr&OP,(ull&x){RU;RT}I OP ull(){ull x;TR}};Fr<Cg>in; #define WI(S) if(x){if(x<0)P('-'),x=-x;char s[S],c=0;while(x)s[c++]=x%10+'0',x/=10;while(c--)P(s[c]);}else P('0') #define WL if(y){lf t=0.5;for(int i=y;i--;)t*=0.1;if(x>=0)x+=t;else x-=t,P('-');*this,(ll)(abs(x));P('.');if(x<0)\ x=-x;while(y--){x*=10;x-=floor(x*0.1)*10;P(((int)x)%10+'0');}}else if(x>=0)*this,(ll)(x+0.5);else *this,(ll)(x-0.5); #define WU(S) if(x){char s[S],c=0;while(x)s[c++]=x%10+'0',x/=10;while(c--)P(s[c]);}else P('0') template<typename T>struct Fw{T P;I Fw&OP,(int x){WI(10);RT}I Fw&OP()(int x){WI(10);RT}I Fw&OP,(uint x){WU(10);RT} I Fw&OP()(uint x){WU(10);RT}I Fw&OP,(ll x){WI(19);RT}I Fw&OP()(ll x){WI(19);RT}I Fw&OP,(ull x){WU(20);RT}I Fw&OP() (ull x){WU(20);RT}I Fw&OP,(char x){P(x);RT}I Fw&OP()(char x){P(x);RT}I Fw&OP,(const char*x){while(*x)P(*x++);RT} I Fw&OP()(const char*x){while(*x)P(*x++);RT}I Fw&OP()(lf x,int y){WL;RT}I Fw&OP()(llf x,int y){WL;RT}};Fw<Cp>out; const int N=200007; struct node { ll ml,mr; }f[1<<19],qa; inline void merge(node&a,node b) { repl(a.ml,b.ml),repl(a.mr,b.mr); } inline void build(int x,int l,int r) { f[x].ml=f[x].mr=1e18; if(l^r) { int t=(l+r)>>1; build(x<<1,l,t); build(x<<1|1,t+1,r); } } inline void modify(int x,int l,int r,int p,ll v) { if(l==r) { repl(f[x].ml,v-l); repl(f[x].mr,v+l); } else { int t=(l+r)>>1; if(p<=t)modify(x<<1,l,t,p,v); else modify(x<<1|1,t+1,r,p,v); merge(f[x]=f[x<<1],f[x<<1|1]); } } inline void query(int x,int l,int r,int ql,int qr) { if(l>=ql&&r<=qr)return merge(qa,f[x]); int t=(l+r)>>1; if(ql<=t)query(x<<1,l,t,ql,qr); if(qr>t)query(x<<1|1,t+1,r,ql,qr); } int n,m; ll ans=1e18; inline void proc(int x,int l,int r) { if(l==r) { repl(ans,f[x].ml+l); } else { int t=(l+r)>>1; proc(x<<1,l,t); proc(x<<1|1,t+1,r); } } int main() { in,n,m; build(1,1,n); int a,b; ll d=0; in,a,b; modify(1,1,n,a,0); fo1(i,m) { a=b;in,b; qa=(node){1e18,1e18}; query(1,1,n,1,b); ll t=b+qa.ml; qa=(node){1e18,1e18}; query(1,1,n,b,n); repl(t,qa.mr-b); t-=abs(a-b); d+=abs(a-b); modify(1,1,n,a,t); } proc(1,1,n); out,ans+d,'\n'; }
a.cc: In function 'int main()': a.cc:132:27: error: narrowing conversion of '1.0e+18' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing] 132 | qa=(node){1e18,1e18}; | ^~~~ a.cc:135:27: error: narrowing conversion of '1.0e+18' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing] 135 | qa=(node){1e18,1e18}; | ^~~~
s943527406
p03736
C++
#include<cstdio> #include<algorithm> #include<cmath> #define fo(i,a,b) for(i=a;i<=b;i++) using namespace std; typedef long long ll; const int maxn=200000+10; const ll inf=1000000000000000; ll t1[maxn*4],t2[maxn*4],sum[maxn],f[maxn]; int x[maxn],id[maxn],rank[maxn]; int i,j,k,l,t,n,m,a,b; ll ans; bool cmp(int a,int b){ return x[a]<x[b]; } void build(int p,int l,int r){ t1[p]=t2[p]=inf; if (l==r) return; int mid=(l+r)/2; build(p*2,l,mid);build(p*2+1,mid+1,r); } void change(int p,int l,int r,int a,ll b){ if (l==r){ t1[p]=b; return; } int mid=(l+r)/2; if (a<=mid) change(p*2,l,mid,a,b);else change(p*2+1,mid+1,r,a,b); t1[p]=min(t1[p*2],t1[p*2+1]); } void change2(int p,int l,int r,int a,ll b){ if (l==r){ t2[p]=b; return; } int mid=(l+r)/2; if (a<=mid) change2(p*2,l,mid,a,b);else change2(p*2+1,mid+1,r,a,b); t2[p]=min(t2[p*2],t2[p*2+1]); } ll query(int p,int l,int r,int a,int b){ if (l==a&&r==b) return t1[p]; int mid=(l+r)/2; if (b<=mid) return query(p*2,l,mid,a,b); else if (a>mid) return query(p*2+1,mid+1,r,a,b); else return min(query(p*2,l,mid,a,mid),query(p*2+1,mid+1,r,mid+1,b)); } ll query2(int p,int l,int r,int a,int b){ if (l==a&&r==b) return t2[p]; int mid=(l+r)/2; if (b<=mid) return query2(p*2,l,mid,a,b); else if (a>mid) return query2(p*2+1,mid+1,r,a,b); else return min(query2(p*2,l,mid,a,mid),query2(p*2+1,mid+1,r,mid+1,b)); } void work(){ build(1,1,m+1); change(1,1,m+1,rank[0],f[1]-sum[1]-(ll)x[0]); change2(1,1,m+1,rank[0],f[1]-sum[1]+(ll)x[0]); fo(i,2,m){ f[i]=query(1,1,m+1,1,rank[i])+(ll)x[i]+sum[i-1]; f[i]=min(f[i],query2(1,1,m+1,rank[i],m+1)-(ll)x[i]+sum[i-1]); change(1,1,m+1,rank[i-1],f[i]-sum[i]-(ll)x[i-1]); change2(1,1,m+1,rank[i-1],f[i]-sum[i]+(ll)x[i-1]); } fo(i,1,m) ans=min(ans,f[i]+sum[m]-sum[i]); } int main(){ scanf("%d%d%d%d",&n,&m,&a,&b); fo(i,1,m){ scanf("%d",&x[i]); if (i>1) sum[i]=abs(x[i]-x[i-1]); } fo(i,1,m) sum[i]+=sum[i-1]; ans=inf; x[0]=a; f[1]=abs(x[1]-b); fo(i,0,m) id[i]=i; sort(id,id+m+1,cmp); fo(i,0,m) rank[id[i]]=i+1; work(); x[0]=b; f[1]=abs(x[1]-a); fo(i,0,m) id[i]=i; sort(id,id+m+1,cmp); fo(i,0,m) rank[id[i]]=i+1; work(); printf("%lld\n",ans); }
a.cc: In function 'void work()': a.cc:56:24: error: reference to 'rank' is ambiguous 56 | change(1,1,m+1,rank[0],f[1]-sum[1]-(ll)x[0]); | ^~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:10:22: note: 'int rank [200010]' 10 | int x[maxn],id[maxn],rank[maxn]; | ^~~~ a.cc:57:25: error: reference to 'rank' is ambiguous 57 | change2(1,1,m+1,rank[0],f[1]-sum[1]+(ll)x[0]); | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:10:22: note: 'int rank [200010]' 10 | int x[maxn],id[maxn],rank[maxn]; | ^~~~ a.cc:59:38: error: reference to 'rank' is ambiguous 59 | f[i]=query(1,1,m+1,1,rank[i])+(ll)x[i]+sum[i-1]; | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:10:22: note: 'int rank [200010]' 10 | int x[maxn],id[maxn],rank[maxn]; | ^~~~ a.cc:60:46: error: reference to 'rank' is ambiguous 60 | f[i]=min(f[i],query2(1,1,m+1,rank[i],m+1)-(ll)x[i]+sum[i-1]); | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:10:22: note: 'int rank [200010]' 10 | int x[maxn],id[maxn],rank[maxn]; | ^~~~ a.cc:61:32: error: reference to 'rank' is ambiguous 61 | change(1,1,m+1,rank[i-1],f[i]-sum[i]-(ll)x[i-1]); | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:10:22: note: 'int rank [200010]' 10 | int x[maxn],id[maxn],rank[maxn]; | ^~~~ a.cc:62:33: error: reference to 'rank' is ambiguous 62 | change2(1,1,m+1,rank[i-1],f[i]-sum[i]+(ll)x[i-1]); | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:10:22: note: 'int rank [200010]' 10 | int x[maxn],id[maxn],rank[maxn]; | ^~~~ a.cc: In function 'int main()': a.cc:78:19: error: reference to 'rank' is ambiguous 78 | fo(i,0,m) rank[id[i]]=i+1; | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:10:22: note: 'int rank [200010]' 10 | int x[maxn],id[maxn],rank[maxn]; | ^~~~ a.cc:84:19: error: reference to 'rank' is ambiguous 84 | fo(i,0,m) rank[id[i]]=i+1; | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:10:22: note: 'int rank [200010]' 10 | int x[maxn],id[maxn],rank[maxn]; | ^~~~
s358558060
p03736
C++
#include <bits/stdc++.h> #define N 256101 #define Q 3414680 using namespace std; typedef long long ll; const ll INF = 0x7f7f7f7f7f7f7f7fll; struct tuple{ int w, id, pos; tuple (int w0 = 0, int id0 = 0, int pos0 = 0): w(w0), id(id0), pos(pos0) {} }; int n, A, B, i, inf, sup; int x[N], fst[N]; ll f[2][2][N], *F[2], *G[2], ans; tuple que[Q]; template <typename T> inline void up(T &x, const T y){x < y ? x = y : 0;} template <typename T> inline void down(T &x, const T y){x > y ? x = y : 0;} inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} void bfs(){ int h, t = 1, W = -1, i, j, k; ll f0, f1; tuple z, z0, z1; que[0] = tuple(0, 0, B); for(h = 0; h < t; h++){ if(que[h].w > W){ W = que[h].w; fst[W] = h; swap(F[0], G[0]); swap(F[1], G[1]); if(W >= 1) for(i = fst[W - 1]; i < h; i++) f[que[i].w & 1][que[i].id][que[i].pos] = INF; sort(que + h, que + t, cmp); for(j = h, i = h + 1; i < t; i++){ z0 = que[j]; z1 = que[i]; if(z0.id == z1.id) if(f[z0.w & 1][z0.id][z0.pos] + abs(z0.pos - z1.pos) <= f[z1.w & 1][z1.id][z1.pos]){ f[z1.w & 1][z1.id][z1.pos] = INF; continue; } que[++j] = que[i]; } t = ++j; } z = que[h]; if(W == n){down(ans, F[z.id][z.pos]); continue;} if(z.id){ // right z0 = tuple(W + 1, 0, x[W]); // left f0 = F[1][z.pos] + abs(z.pos - x[z0.w]); z1 = tuple(W + 1, 1, z.pos); // right f1 = F[1][z.pos] + abs(x[W] - x[z1.w]); }else{ // left z0 = tuple(W + 1, 0, z.pos); // left f0 = F[0][z.pos] + abs(x[W] - x[z0.w]); z1 = tuple(W + 1, 1, x[W]); // right f1 = F[0][z.pos] + abs(z.pos - x[z1.w]); } if(x[z0.w] <= z0.pos && f0 < G[0][z0.pos]){ if(G[0][z0.pos] >= INF) que[t++] = z0; G[0][z0.pos] = f0; } if(z1.pos <= x[z1.w] && f1 < G[1][z1.pos]){ if(G[1][z1.pos] >= INF) que[t++] = z1; G[1][z1.pos] = f1; } } } int main(){ scanf("%d%d%d%d", &inf, &n, &A, &B); if(A > B) swap(A, B); for(sup = i = 1; i <= n; i++){ scanf("%d", x + i); down(inf, x[i]); up(sup, x[i]); } memset(f, 127, sizeof f); G[0] = f[0][0]; G[1] = f[0][1]; F[0] = f[1][0]; F[1] = f[1][1]; x[0] = A; G[0][B] = 0; ans = LLONG_MAX; bfs(); printf("%lld\n", ans); return 0; }
a.cc:18:1: error: reference to 'tuple' is ambiguous 18 | tuple que[Q]; | ^~~~~ 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, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc:24:23: error: reference to 'tuple' is ambiguous 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc:24:39: error: reference to 'tuple' is ambiguous 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc: In function 'bool cmp(const int&, const int&)': a.cc:24:58: error: request for member 'id' in 'A', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~ a.cc:24:65: error: request for member 'id' in 'B', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~ a.cc:24:73: error: request for member 'id' in 'A', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~ a.cc:24:81: error: request for member 'id' in 'B', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~ a.cc:24:91: error: request for member 'w' in 'A', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^ a.cc:24:100: error: request for member 'id' in 'A', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~ a.cc:24:106: error: request for member 'pos' in 'A', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~~ a.cc:24:117: error: request for member 'w' in 'B', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^ a.cc:24:126: error: request for member 'id' in 'B', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~ a.cc:24:132: error: request for member 'pos' in 'B', which is of non-class type 'const int' 24 | inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];} | ^~~ a.cc: In function 'void bfs()': a.cc:28:9: error: reference to 'tuple' is ambiguous 28 | tuple z, z0, z1; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc:29:9: error: 'que' was not declared in this scope 29 | que[0] = tuple(0, 0, B); | ^~~ a.cc:29:18: error: reference to 'tuple' is ambiguous 29 | que[0] = tuple(0, 0, B); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc:40:33: error: 'z0' was not declared in this scope; did you mean 'f0'? 40 | z0 = que[j]; z1 = que[i]; | ^~ | f0 a.cc:40:46: error: 'z1' was not declared in this scope; did you mean 'f1'? 40 | z0 = que[j]; z1 = que[i]; | ^~ | f1 a.cc:50:17: error: 'z' was not declared in this scope 50 | z = que[h]; | ^ a.cc:53:25: error: 'z0' was not declared in this scope; did you mean 'f0'? 53 | z0 = tuple(W + 1, 0, x[W]); // left | ^~ | f0 a.cc:53:30: error: reference to 'tuple' is ambiguous 53 | z0 = tuple(W + 1, 0, x[W]); // left | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc:55:25: error: 'z1' was not declared in this scope; did you mean 'f1'? 55 | z1 = tuple(W + 1, 1, z.pos); // right | ^~ | f1 a.cc:55:30: error: reference to 'tuple' is ambiguous 55 | z1 = tuple(W + 1, 1, z.pos); // right | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc:58:25: error: 'z0' was not declared in this scope; did you mean 'f0'? 58 | z0 = tuple(W + 1, 0, z.pos); // left | ^~ | f0 a.cc:58:30: error: reference to 'tuple' is ambiguous 58 | z0 = tuple(W + 1, 0, z.pos); // left | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc:60:25: error: 'z1' was not declared in this scope; did you mean 'f1'? 60 | z1 = tuple(W + 1, 1, x[W]); // right | ^~ | f1 a.cc:60:30: error: reference to 'tuple' is ambiguous 60 | z1 = tuple(W + 1, 1, x[W]); // right | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:9:8: note: 'struct tuple' 9 | struct tuple{ | ^~~~~ a.cc:63:22: error: 'z0' was not declared in this scope; did you mean 'f0'? 63 | if(x[z0.w] <= z0.pos && f0 < G[0][z0.pos]){ | ^~ | f0 a.cc:68:20: error: 'z1' was not declared in this scope; did you mean 'f1'? 68 | if(z1.pos <= x[z1.w] && f1 < G[1][z1.pos]){ | ^~ | f1
s065503440
p03736
C++
#include <stdio.h> #include <math.h> #include <algorithm> using namespace std; const int INF = 1e9, SEGMENT_TREE_SIZE = 1 << 19; long long f[200005]; struct info{int L, R;}; info merge(info a, info b) {info x = {f[a.L]-a.L < f[b.L]-b.L ? a.L : b.L, f[a.R]+a.R < f[b.R]+b.R ? a.R : b.R}; return(x);} template <class T> class SegmentTree { T * a; int * L, * R; void divide(int i, int l, int r) { L[i] = l; R[i] = r; if (L[i] == R[i]) return; divide(2*i+1, l, (l+r)/2); divide(2*i+2, (l+r)/2+1, r); } void update(int i, int pos, T x) { if (L[i] > pos || R[i] < pos) return; if (L[i] == pos && R[i] == pos) {a[i] = x; return;} update(2*i+1, pos, x); update(2*i+2, pos, x); a[i] = merge(a[2*i+1], a[2*i+2]); } T search(int i, int l, int r) { if (L[i] >= l && R[i] <= r) return a[i]; if (R[2*i+1] >= r) return search(2*i+1, l, r); if (L[2*i+2] <= l) return search(2*i+2, l, r); return merge(search(2*i+1, l, r), search(2*i+2, l, r)); } public: SegmentTree(int l, int r) { a = new T [SEGMENT_TREE_SIZE]; L = new int [SEGMENT_TREE_SIZE]; R = new int [SEGMENT_TREE_SIZE]; divide(0, l, r); } setval(int pos, T x) {update(0, pos, x);} T getval(int l, int r) {return search(0, l, r);} }; int main() { int N, Q, A, B; scanf("%d%d%d%d", &N, &Q, &A, &B); fill(f + 1, f + N + 1, INF); f[A] = 0; SegmentTree<info> T(1, N); for (int i = 1; i <= N; ++i) {info x = {i, i}; T.setval(i, x);} int cur, prv = B; long long inc = 0, ans = 0; for (int i = 1; i <= Q; ++i) { scanf("%d", &cur); inc += abs(cur - prv); int l = T.getval(0, cur).L, r = T.getval(cur, N).R; ans = min(ans, f[prv] = min(f[l] + cur - l, f[r] - cur + r) - abs(cur - prv)); info x = {prv, prv}; T.setval(prv, x); prv = cur; } printf("%lld", ans + inc); return 0; }
a.cc:40:5: error: ISO C++ forbids declaration of 'setval' with no type [-fpermissive] 40 | setval(int pos, T x) {update(0, pos, x);} | ^~~~~~ a.cc: In member function 'int SegmentTree<T>::setval(int, T)': a.cc:40:45: warning: no return statement in function returning non-void [-Wreturn-type] 40 | setval(int pos, T x) {update(0, pos, x);} | ^
s361484280
p03736
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair const ll INF = 1e18; typedef pair<ll, ll> pll; struct Node { ll valm; ll valp; ll add; Node() {} }; const int N = 3e5 + 10; Node tree[4 * N]; void update_node(int tv, int tl, int tr) { if (tr - tl > 1) { tree[tv].valm = min(tree[2 * tv + 1].valm, tree[2 * tv + 2].valm); tree[tv].valp = min(tree[2 * tv + 1].valp, tree[2 * tv + 2].valp); } } void build(int tv, int tl, int tr) { tree[tv].add = 0; if (tr - tl == 1) { tree[tv].valm = INF - tl; tree[tv].valp = INF + tl; return; } int tm = (tl + tr) / 2; build(2 * tv + 1, tl, tm); build(2 * tv + 2, tm, tr); update_node(tv, tl, tr); } void push(int tv, int tl, int tr) { tree[tv].valm += tree[tv].add; tree[tv].valp += tree[tv].add; if (tr - tl > 1) { tree[2 * tv + 1].add += tree[tv].add; tree[2 * tv + 2].add += tree[tv].add; } tree[tv].add = 0; } void add_num(int tv, int tl, int tr, int l, int r, ll val) { push(tv, tl, tr); if (tr == r && tl == l) { tree[tv].add += val; push(tv, tl, tr); return; } if (l >= tr || r < tl) return; int tm = (tl + tr) / 2; add_num(2 * tv + 1, tl, tm, l, min(r, tm), val); add_num(2 * tv + 2, tm, tr, max(l, tm), r, val); update_node(tv, tl, tr); } pll get_min(int tv, int tl, int tr, int l, int r) { push(tv, tl, tr); if (tr == r && tl == l) { return pll(tree[tv].valm, tree[tv].valp); } if (l >= tr || r < tl) return {INF, INF}; int tm = (tl + tr) / 2; res1 = get_min(2 * tv + 1, tl, tm, l, min(r, tm)); res2 = get_min(2 * tv + 2, tm, tr, max(l, tm), r); return pll(min(res1.first, res2.first), min(res1.second, res2.second)); } void update_pos(int tv, int tl, int tr, int pos, int val) { push(tv, tl, tr); if (pos < tl || pos >= tr) return; if (tr - tl == 1) { tree[tv].valm = val - tl; tree[tv].valp = val + tl; return; } int tm = (tl + tr) / 2; update_pos(2 * tv + 1, tl, tm, pos, val); update_pos(2 * tv + 2, tm, tr, pos, val); update_node(tv, tl, tr); } ll get_pos(int tv, int tl, int tr, int pos) { push(tv, tl, tr); if (tr - tl == 1) return tree[tv].valm + tl; int tm = (tl + tr) / 2; if (pos < tm) return get_pos(2 * tv + 1, tl, tm, pos); else return get_pos(2 * tv + 2, tm, tr, pos); } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(nullptr); int n, q, a, b; cin >> n >> q >> a >> b; a--; b--; build(0, 0, n); ll last = b; update_pos(0, 0, n, a, 0); while (q--) { ll x; cin >> x; x--; auto p1 = get_min(0, 0, n, 0, x); auto p2 = get_min(0, 0, n, x, n); add_num(0, 0, n, 0, n, abs(last - x)); ll cur_val = get_pos(0, 0, n, last); update_pos(0, 0, n, last, min(p1.first + x, p2.second - x)); last = x; } ll res = INF; for (int i = 0; i < n; i++) { res = min(res, get_pos(0, 0, n, i)); } cout << res << endl; return 0; }
a.cc: In function 'pll get_min(int, int, int, int, int)': a.cc:73:9: error: 'res1' was not declared in this scope 73 | res1 = get_min(2 * tv + 1, tl, tm, l, min(r, tm)); | ^~~~ a.cc:74:9: error: 'res2' was not declared in this scope 74 | res2 = get_min(2 * tv + 2, tm, tr, max(l, tm), r); | ^~~~
s895400181
p03736
C++
#include<Cstd
a.cc:1:14: error: missing terminating > character 1 | #include<Cstd | ^ a.cc:1:9: fatal error: Cstd: No such file or directory 1 | #include<Cstd | ^ compilation terminated.
s468661408
p03736
C++
a.cc:1:1: error: '\U00003042' does not name a type 1 | あ | ^~
s801449407
p03736
C++
a.cc:1:1: error: '\U00003042' does not name a type 1 | あ | ^~
s200201599
p03736
C++
a.cc:1:1: error: '\U00003044' does not name a type 1 | い | ^~
s832785046
p03736
C++
a.cc:1:1: error: '\U00003042' does not name a type 1 | あ | ^~
s196094485
p03736
C++
_
a.cc:1:1: error: '_' does not name a type 1 | _ | ^
s544184005
p03736
C++
a.cc:1:1: error: '\U00003042' does not name a type 1 | あ | ^~
s351164775
p03736
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair const ll INF = 1e18; typedef pair<ll, ll> pll; struct Node { ll valm; ll valp; ll add; Node() {} }; const int N = 2e5 + 10; Node tree[4 * N]; void build(int tv, int tl, int tr) { if (tr - tl == 1) { tree[tv].valm = INF - tl; tree[tv].valp = INF + tl; tree[tv].add = 0; return; } int tm = (tl + tr) / 2; build(2 * tv + 1, tl, tm); build(2 * tv + 2, tm, tr); tree[tv].valm = min(tree[2 * tv + 1].valm, tree[2 * tv + 2].valm); tree[tv].valp = min(tree[2 * tv + 1].valp, tree[2 * tv + 2].valp); tree[tv].add = 0; } void push(int tv, int tl, int tr) { tree[tv].valm += tree[tv].add; tree[tv].valp += tree[tv].add; if (tr - tl > 1) { tree[2 * tv + 1].add += tree[tv].add; tree[2 * tv + 2].add += tree[tv].add; } tree[tv].add = 0; } void add_num(int tv, int tl, int tr, int l, int r, ll val) { if (tr == r && tl == l) { tree[tv].add += val; push(tv, tl, tr); return; } push(tv, tl, tr); int tm = (tl + tr) / 2; if (l < tm) add_num(2 * tv + 1, tl, tm, l, min(r, tm), val); if (r > tm) add_num(2 * tv + 2, tm, tr, max(l, tm), r, val); push(2 * tv + 1, tl, tm); push(2 * tv + 2, tm, tr); tree[tv].valm = min(tree[2 * tv + 1].valm, tree[2 * tv + 2].valm); tree[tv].valp = min(tree[2 * tv + 1].valp, tree[2 * tv + 2].valp); } pll get_min(int tv, int tl, int tr, int l, int r) { push(tv, tl, tr); if (tr == r && tl == l) { return pll(tree[tv].valm, tree[tv].valp); } int tm = (tl + tr) / 2; pll res1(INF, INF); pll res2(INF, INF); if (l < tm) { res1 = get_min(2 * tv + 1, tl, tm, l, min(r, tm)); } if (r > tm) { res2 = get_min(2 * tv + 2, tm, tr, max(l, tm), r); } push(2 * tv + 1, tl, tm); push(2 * tv + 2, tm, tr); return pll(min(res1.first, res2.first), min(res1.second, res2.second)); } void update_pos(int tv, int tl, int tr, int pos, int val) { push(tv, tl, tr); if (tr - tl == 1) { tree[tv].valm = val - tl; tree[tv].valp = val + tl; return; } int tm = (tl + tr) / 2; if (pos < tm) update_pos(2 * tv + 1, tl, tm, pos, val); else update_pos(2 * tv + 2, tm, tr, pos, val); push(2 * tv + 1, tl, tm); push(2 * tv + 2, tm, tr); tree[tv].valm = min(tree[2 * tv + 1].valm, tree[2 * tv + 2].valm); tree[tv].valp = min(tree[2 * tv + 1].valp, tree[2 * tv + 2].valp); } ll get_pos(int tv, int tl, int tr, int pos) { push(tv, tl, tr); if (tr - tl == 1) return tree[tv].valm + tl; int tm = (tl + tr) / 2; if (pos < tm) return get_pos(2 * tv + 1, tl, tm, pos); else return get_pos(2 * tv + 2, tm, tr, pos); } int int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(nullptr); int n, q, a, b; cin >> n >> q >> a >> b; a--; b--; build(0, 0, n); ll last = b; update_pos(0, 0, n, a, 0); while (q--) { ll x; cin >> x; x--; auto p1 = get_min(0, 0, n, 0, x); auto p2 = get_min(0, 0, n, x, n); add_num(0, 0, n, 0, n, abs(last - x)); ll cur_val = get_pos(0, 0, n, last); if (min(p1.first + x, p2.second - x) < cur_val) update_pos(0, 0, n, last, min(p1.first + x, p2.second - x)); last = x; } ll res = INF; for (int i = 0; i < n; i++) { res = min(res, get_pos(0, 0, n, i)); } cout << res << endl; return 0; }
a.cc:111:1: error: two or more data types in declaration of 'main' 111 | int | ^~~
s035110093
p03736
C++
E
a.cc:1:1: error: 'E' does not name a type 1 | E | ^
s884536509
p03736
C++
C
a.cc:1:1: error: 'C' does not name a type 1 | C | ^
s282080794
p03736
C++
CE
a.cc:1:1: error: 'CE' does not name a type 1 | CE | ^~
s606310554
p03736
C++
CE
a.cc:1:1: error: 'CE' does not name a type 1 | CE | ^~
s587468503
p03736
C++
try
a.cc:1:1: error: expected unqualified-id before 'try' 1 | try | ^~~
s621675988
p03736
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e13; const int INF = INT_MAX; template <typename T> struct SegmentTree { int n; vector<T> data; //使うときは、この3つを適宜変更する static T INITIAL_VALUE; static T merge(T x, T y); void updateNode(int k, T x); SegmentTree(int size) { n = 1; while (n < size) n *= 2; data.resize(2 * n - 1, INITIAL_VALUE); } T getLeaf(int k) { return data[k + n - 1]; } void update(int k, T x) { k += n - 1; //葉の節点 updateNode(k, x); while (k > 0) { k = (k - 1) / 2; data[k] = merge(data[k * 2 + 1], data[k * 2 + 2]); } } //区間[a, b)に対するクエリに答える //k:節点番号, [l, r):節点に対応する区間 T query(int a, int b, int k, int l, int r) { //[a, b)と[l, r)が交差しない場合 if (r <= a || b <= l) return INITIAL_VALUE; //[a, b)が[l, r)を含む場合、節点の値 if (a <= l && r <= b) return data[k]; else { //二つの子をマージ T vl = query(a, b, k * 2 + 1, l, (l + r) / 2); T vr = query(a, b, k * 2 + 2, (l + r) / 2, r); return merge(vl, vr); } } //外から呼ぶ用 T query(int a, int b) { return query(a, b, 0, 0, n); } }; //使うときは以下3つを変更 template <typename T> T SegmentTree<T>::INITIAL_VALUE = INF; template <typename T> T SegmentTree<T>::merge(T x, T y) { return min(x, y); } template <typename T> void SegmentTree<T>::updateNode(int k, T x) { data[k] = x; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, q; ll a; cin >> n >> q >> a; a--; vector<ll> x(q + 1); cin >> x[0]; x[0]--; for (int i = 1; i <= q; i++) { cin >> x[i]; x[i]--; } SegmentTree<ll> st1(n), st2(n); st1.update(a, -a); st2.update(a, a); ll add = 0; for (int i = 1; i <= q; i++) { ll tmp = INF; tmp = min(tmp, st1.query(0, x[i]) + x[i]); tmp = min(tmp, st2.query(x[i], n) - x[i]); tmp += add; add += abs(x[i] - x[i - 1]); ll tar = st1.getLeaf(x[i - 1]) + x[i - 1] + add; if (tar <= tmp) continue; tmp -= add; st1.update(x[i - 1], tmp - x[i - 1]); st2.update(x[i - 1], tmp + x[i - 1]); } ll ans = INF; for (int i = 0; i < n; i++) { ans = min(ans, st1.getLeaf(i) + i); } ans += add; cout << ans << endl; return 0; }
a.cc:9:11: error: conflicting declaration 'const int INF' 9 | const int INF = INT_MAX; | ^~~ a.cc:7:10: note: previous declaration as 'const ll INF' 7 | const ll INF = 1e13; | ^~~
s401100342
p03736
C++
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> using namespace std; // セグメント木(遅延評価あり) class SegmentTree { private: typedef long long T1; typedef long long T2; // データの初期値、以下の条件を満たすこと // uniteData(v, INIT_DATA) == v static const T1 INIT_DATA = LLONG_MAX; // 遅延の初期値、以下の条件を満たすこと // updateData(prev, size, INIT_DELAY) == prev // updateDelay(x, INIT_DELAY) == x static const T2 INIT_DELAY = 0; // 長さがsizeの区間における前回の計算結果prevに対して、 // 区間の各要素にパラメータxを用いた更新処理を適用した後の計算結果を返す T1 updateData(T1 prev, int size, T2 x){ return prev + x; } // パラメータx1,x2による2つの更新処理を順に適用した場合に対して、 // 同じ結果になるような1つの更新処理のパラメータを返す T2 updateDelay(T2 x1, T2 x2){ return x1 + x2; } // 2つの区間の計算結果v1,v2に対して、 // その2つの区間を統合した区間における計算結果を返す T1 uniteData(T1 v1, T1 v2){ return min(v1, v2); } int n; vector<T1> data; vector<T2> delay; void updateTree(int a, int b, int k, int l, int r, T2 x){ if(a <= l && r <= b){ data[k] = updateData(data[k], r - l + 1, x); delay[k] = updateDelay(delay[k], x); } else if(a <= r && l <= b){ for(int i=0; i<2; ++i){ data[k*2+1+i] = updateData(data[k*2+1+i], (r - l + 1) / 2, delay[k]); delay[k*2+1+i] = updateDelay(delay[k*2+1+i], delay[k]); } delay[k] = INIT_DELAY; updateTree(a, b, k*2+1, l, (l+r)/2, x); updateTree(a, b, k*2+2, (l+r+1)/2, r, x); data[k] = uniteData(data[k*2+1], data[k*2+2]); } } T1 getValue(int a, int b, int k, int l, int r){ if(a <= l && r <= b){ return data[k]; } else if(a <= r && l <= b){ T1 v1 = getValue(a, b, k*2+1, l, (l+r)/2); T1 v2 = getValue(a, b, k*2+2, (l+r+1)/2, r); return uniteData(v1, v2); } else{ return INIT_DATA; } } public: SegmentTree(int n0){ n = 1; while(n < n0) n *= 2; data.assign(2*n-1, INIT_DATA); delay.assign(2*n-1, INIT_DELAY); } SegmentTree(const vector<T1>& v) : SegmentTree((int)v.size()){ for(unsigned i=0; i<v.size(); ++i) data[n-1+i] = v[i]; for(int k=n-2; k>=0; --k) data[k] = uniteData(data[k*2+1], data[k*2+2]); } // 区間[a,b]の要素にパラメータxによる更新処理を適用 void update(int a, int b, T2 x){ updateTree(a, b, 0, 0, n-1, x); } // 区間[a,b]の計算結果を返す T1 get(int a, int b){ updateTree(a, b, 0, 0, n-1, 0); return getValue(a, b, 0, 0, n-1); } }; const long long INF = LLONG_MAX / 4; int main() { int n, q, a, b; cin >> n >> q >> a >> b; -- a; -- b; if(b < a) swap(a, b); vector<int> x(q); for(int i=0; i<q; ++i){ cin >> x[i]; -- x[i]; } vector<long long> tmp1(n, INF); vector<long long> tmp2(n, INF); tmp1[a] = abs(b - x[0]) - a; tmp1[b] = abs(a - x[0]) - b; tmp2[a] = abs(b - x[0]) + a; tmp2[b] = abs(a - x[0]) + b; SegmentTree st1(tmp1); SegmentTree st2(tmp2); for(int i=1; i<q; ++i){ long long cost = st1.get(x[i-1], x[i-1]) + x[i-1] + abs(x[i] - x[i-1]); cost = min(cost, st1.get(0, x[i]) + x[i]); cost = min(cost, st2.get(x[i], n-1) - x[i]); long long add1 = cost - x[i-1] - st1.get(x[i-1], x[i-1]); cerr << st2.get(x[i-1], x[i-1]) << endl; cerr << st2.get(x[i-1], x[i-1]) << endl; long long add2 = cost + x[i-1] - st2.get(x[i-1], x[i-1]); st1.update(x[i-1], x[i-1], add1); st2.update(x[i-1], x[i-1], add2); long long add = abs(x[i] - x[i-1]); st1.update(0, x[i-1]-1, add); st1.update(x[i-1]+1, n-1, add); st2.update(0, x[i-1]-1, add); st2.update(x[i-1]+1, n-1, add); } long long ans = INF; for(int i=0; i<n; ++i) ans = min(ans, st1.get(i, i) + i); cout << ans << endl; return 0; }
/usr/bin/ld: /tmp/ccOOOuUN.o: warning: relocation against `_ZN11SegmentTree9INIT_DATAE' in read-only section `.text._ZN11SegmentTreeC2Ei[_ZN11SegmentTreeC5Ei]' /usr/bin/ld: /tmp/ccOOOuUN.o: in function `SegmentTree::SegmentTree(int)': a.cc:(.text._ZN11SegmentTreeC2Ei[_ZN11SegmentTreeC5Ei]+0x6e): undefined reference to `SegmentTree::INIT_DATA' /usr/bin/ld: a.cc:(.text._ZN11SegmentTreeC2Ei[_ZN11SegmentTreeC5Ei]+0x95): undefined reference to `SegmentTree::INIT_DELAY' /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status
s329036514
p03736
C++
#include <iostream> #include <map> using namespace std; int N; map <pair <int, int>, int> M; pair <int, int> Array[200005]; pair <int, int> PMax, PMin; vector <pair <int, pair <int, int> > > V; int Max = -1, Min = 1000000005; int P[800005]; void Read() { cin >> N; for(int i = 1; i <= N; i++) { cin >> Array[i].first >> Array[i].second; if(Max < Array[i].first) { Max = Array[i].first; PMax = make_pair(i, 1); } if(Min > Array[i].first) { Min = Array[i].first; PMin = make_pair(i, 1); } if(Max < Array[i].second) { Max = Array[i].second; PMax = make_pair(i, 2); } if(Min > Array[i].second) { Min = Array[i].second; PMin = make_pair(i, 2); } } } long long Solve1() { int RMax = -1, BMin = 1000000005; for(int i = 1; i <= N; i++) { int a = Array[i].first, b = Array[i].second; if(a > b) swap(a, b); RMax = max(RMax, a); BMin = min(BMin, b); } return 1LL * (Max - BMin) * (RMax - Min); } int Pair(int pos) { int x = V[pos].second.first; if(V[pos].second.second == 1) return M[make_pair(x, 2)]; return M[make_pair(x, 1)]; } long long Solve2() { M[PMin] = M[PMax] = 4 * N; for(int i = 1; i <= N; i++) { if(PMin != make_pair(i, 1) && PMax != make_pair(i, 1)) V.push_back(make_pair(Array[i].first, make_pair(i, 1))); if(PMin != make_pair(i, 2) && PMax != make_pair(i, 2)) V.push_back(make_pair(Array[i].second, make_pair(i, 2))); } sort(V.begin(), V.end()); for(int i = 0; i < V.size(); i++) M[V.second] = i; int stop = 4 * N; for(int i = 0; i < V.size(); i++) { stop = min(stop, Pair(i)); if(i > 0) P[i] = min(P[i - 1], stop); else P[i] = stop; } int cnt = 0, stop2 = -1, val = -1; long long ans = 0, point = 4 * N; while(cnt <= N) { if(V.size() - 1 - cnt < stop2) break; if(cnt < N) point = min(P[N - cnt - 1], point); point = min(point, Pair(V.size() - 1 - cnt)); point = min(point, N - cnt); val = V[V.size() - 1 - cnt]; ans = max(ans, (val - V[point])); stop2 = max(stop2, Pair(V.size() - 1 - cnt)); ++cnt; } return ans * (Max - Min); } int main() { Read(); long long ans = Solve1(); if(PMin.first != PMin.second) ans = min(ans, Solve2()); cout << ans << '\n'; return 0; }
a.cc:8:1: error: 'vector' does not name a type 8 | vector <pair <int, pair <int, int> > > V; | ^~~~~~ a.cc: In function 'int Pair(int)': a.cc:55:13: error: 'V' was not declared in this scope 55 | int x = V[pos].second.first; | ^ a.cc: In function 'long long int Solve2()': a.cc:67:13: error: 'V' was not declared in this scope 67 | V.push_back(make_pair(Array[i].first, make_pair(i, 1))); | ^ a.cc:69:13: error: 'V' was not declared in this scope 69 | V.push_back(make_pair(Array[i].second, make_pair(i, 2))); | ^ a.cc:71:10: error: 'V' was not declared in this scope 71 | sort(V.begin(), V.end()); | ^ a.cc:71:5: error: 'sort' was not declared in this scope; did you mean 'short'? 71 | sort(V.begin(), V.end()); | ^~~~ | short a.cc:90:24: error: no matching function for call to 'min(int&, long long int&)' 90 | point = min(P[N - cnt - 1], point); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:90:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 90 | point = min(P[N - cnt - 1], point); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided a.cc:92:20: error: no matching function for call to 'min(long long int&, int)' 92 | point = min(point, N - cnt); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:92:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 92 | point = min(point, N - cnt); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
s492184218
p03737
C++
#include<iostream> #include<string> using namespace std; int main(){ string a,b,c; cin>>a>>b>>c; char d=a.at(0),e=b.at(0),f=c.at(0); int d,e,f; char rr=d-32,ee=e-32,ff=f-32; cout<<rr<<ee<<ff; return 0; }
a.cc: In function 'int main()': a.cc:9:7: error: conflicting declaration 'int d' 9 | int d,e,f; | ^ a.cc:8:8: note: previous declaration as 'char d' 8 | char d=a.at(0),e=b.at(0),f=c.at(0); | ^ a.cc:9:9: error: conflicting declaration 'int e' 9 | int d,e,f; | ^ a.cc:8:18: note: previous declaration as 'char e' 8 | char d=a.at(0),e=b.at(0),f=c.at(0); | ^ a.cc:9:11: error: conflicting declaration 'int f' 9 | int d,e,f; | ^ a.cc:8:28: note: previous declaration as 'char f' 8 | char d=a.at(0),e=b.at(0),f=c.at(0); | ^
s012576318
p03737
C++
#include<iostream> #include<string> using namespace std; int main(){ string a,b,c; cin>>a>>b>>c; int d=a.at(0)-32,e=b.at(0)-32,f=c.at(0)-32; char d,e,f; cout<<d<<e<<f; return 0; }
a.cc: In function 'int main()': a.cc:9:8: error: conflicting declaration 'char d' 9 | char d,e,f; | ^ a.cc:8:7: note: previous declaration as 'int d' 8 | int d=a.at(0)-32,e=b.at(0)-32,f=c.at(0)-32; | ^ a.cc:9:10: error: conflicting declaration 'char e' 9 | char d,e,f; | ^ a.cc:8:20: note: previous declaration as 'int e' 8 | int d=a.at(0)-32,e=b.at(0)-32,f=c.at(0)-32; | ^ a.cc:9:12: error: conflicting declaration 'char f' 9 | char d,e,f; | ^ a.cc:8:33: note: previous declaration as 'int f' 8 | int d=a.at(0)-32,e=b.at(0)-32,f=c.at(0)-32; | ^
s329468503
p03737
C++
using namespace std; int main() { // ios_base::sync_with_stdio(false); //cin.tie(NULL); //cout.tie(NULL); string s; for(int i=0;i<3;i++){ string str; cin>>str; toupper(str[0]); s+=str[0]; } cout<<s; return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'string' was not declared in this scope 9 | string s; | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | using namespace std; a.cc:11:13: error: expected ';' before 'str' 11 | string str; | ^~~~ | ; a.cc:12:7: error: 'cin' was not declared in this scope 12 | cin>>str; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:12:12: error: 'str' was not declared in this scope; did you mean 'std'? 12 | cin>>str; | ^~~ | std a.cc:13:7: error: 'toupper' was not declared in this scope 13 | toupper(str[0]); | ^~~~~~~ a.cc:14:7: error: 's' was not declared in this scope 14 | s+=str[0]; | ^ a.cc:16:3: error: 'cout' was not declared in this scope 16 | cout<<s; | ^~~~ a.cc:16:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:16:9: error: 's' was not declared in this scope 16 | cout<<s; | ^
s386856452
p03737
C++
#include <bits/stdc++.h> using namespace std; int main() { // ios_base::sync_with_stdio(false); //cin.tie(NULL); //cout.tie(NULL); string s; for(int i=0;i<3;i++){ string str; cin>>str; to_upper(str[0]); s+=str[0]; } cout<<s; return 0; }
a.cc: In function 'int main()': a.cc:14:7: error: 'to_upper' was not declared in this scope; did you mean 'towupper'? 14 | to_upper(str[0]); | ^~~~~~~~ | towupper
s386073727
p03737
C++
#include <bits/stdc++.h> using namespace std; int main() { // ios_base::sync_with_stdio(false); //cin.tie(NULL); //cout.tie(NULL); string s; for(int i=0;i<3;i++){ string str; cin>>str; s+=to_upper(str[0]); } cout<<s; return 0; }
a.cc: In function 'int main()': a.cc:14:10: error: 'to_upper' was not declared in this scope; did you mean 'towupper'? 14 | s+=to_upper(str[0]); | ^~~~~~~~ | towupper
s229109318
p03737
C++
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; for(int i=0;i<3;i++){ string str; cin>>str; s+=to_upper(str[0]); } cout<<s; return 0; }
a.cc: In function 'int main()': a.cc:14:10: error: 'to_upper' was not declared in this scope; did you mean 'towupper'? 14 | s+=to_upper(str[0]); | ^~~~~~~~ | towupper
s897213805
p03737
C++
#include <iostream> #include <math.h> #include <algorithm> #include <string> #include <map> #include <vector> #include <cmath> using namespace std; void a_three_letter_acronym(void) { string s1, s2, s3; cin >> s1 >> s2 >> s3; transform(s1.begin(), s1.end(), s1.begin(), toupper); transform(s2.begin(), s2.end(), s2.begin(), toupper); transform(s3.begin(), s3.end(), s3.begin(), toupper); cout << s1[0]<<s2[0]<<s3[0] << endl; } int main() { a_three_letter_acronym(); return 0; }
a.cc: In function 'void a_three_letter_acronym()': a.cc:14:18: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 14 | transform(s1.begin(), s1.end(), s1.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:14:18: note: couldn't deduce template parameter '_UnaryOperation' 14 | transform(s1.begin(), s1.end(), s1.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided a.cc:15:18: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 15 | transform(s2.begin(), s2.end(), s2.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:15:18: note: couldn't deduce template parameter '_UnaryOperation' 15 | transform(s2.begin(), s2.end(), s2.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided a.cc:16:18: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 16 | transform(s3.begin(), s3.end(), s3.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:16:18: note: couldn't deduce template parameter '_UnaryOperation' 16 | transform(s3.begin(), s3.end(), s3.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided
s022527363
p03737
C
#include<stdio.h> int main(){ char a,b,c; scanf("%s%s%s",&a,&b,&c); printf("%c%c%c",a[0]-32,b[0]-32,c[0]-32); return 0; }
main.c: In function 'main': main.c:5:20: error: subscripted value is neither array nor pointer nor vector 5 | printf("%c%c%c",a[0]-32,b[0]-32,c[0]-32); | ^ main.c:5:28: error: subscripted value is neither array nor pointer nor vector 5 | printf("%c%c%c",a[0]-32,b[0]-32,c[0]-32); | ^ main.c:5:36: error: subscripted value is neither array nor pointer nor vector 5 | printf("%c%c%c",a[0]-32,b[0]-32,c[0]-32); | ^
s646737428
p03737
C
#include<stdio.h> #include<string.h> int main(){ char a[10],b[10],c[10]; scanf("%d %d %d",&a,&b,&c); int a[0],b[0],c[0]; int g=a[0]-32,h=b[0]-32;y=c[0]-32; char g,h,y; printf("%c%c%c",g,h,y); return 0; }
main.c: In function 'main': main.c:6:7: error: conflicting types for 'a'; have 'int[0]' 6 | int a[0],b[0],c[0]; | ^ main.c:4:8: note: previous declaration of 'a' with type 'char[10]' 4 | char a[10],b[10],c[10]; | ^ main.c:6:12: error: conflicting types for 'b'; have 'int[0]' 6 | int a[0],b[0],c[0]; | ^ main.c:4:14: note: previous declaration of 'b' with type 'char[10]' 4 | char a[10],b[10],c[10]; | ^ main.c:6:17: error: conflicting types for 'c'; have 'int[0]' 6 | int a[0],b[0],c[0]; | ^ main.c:4:20: note: previous declaration of 'c' with type 'char[10]' 4 | char a[10],b[10],c[10]; | ^ main.c:7:27: error: 'y' undeclared (first use in this function) 7 | int g=a[0]-32,h=b[0]-32;y=c[0]-32; | ^ main.c:7:27: note: each undeclared identifier is reported only once for each function it appears in main.c:8:8: error: conflicting types for 'g'; have 'char' 8 | char g,h,y; | ^ main.c:7:7: note: previous definition of 'g' with type 'int' 7 | int g=a[0]-32,h=b[0]-32;y=c[0]-32; | ^ main.c:8:10: error: conflicting types for 'h'; have 'char' 8 | char g,h,y; | ^ main.c:7:17: note: previous definition of 'h' with type 'int' 7 | int g=a[0]-32,h=b[0]-32;y=c[0]-32; | ^
s172476245
p03737
C
#include<stdio.h> #include<string.h> int main(){ char a[],b[],c[]; scanf("%d %d %d",&a,&b,&c); int a[0],b[0],c[0]; int g=a[0]-32,h=b[0]-32;y=c[0]-32; char g,h,y; printf("%c%c%c",g,h,y); return 0; }
main.c: In function 'main': main.c:4:8: error: array size missing in 'a' 4 | char a[],b[],c[]; | ^ main.c:4:12: error: array size missing in 'b' 4 | char a[],b[],c[]; | ^ main.c:4:16: error: array size missing in 'c' 4 | char a[],b[],c[]; | ^ main.c:6:7: error: conflicting types for 'a'; have 'int[0]' 6 | int a[0],b[0],c[0]; | ^ main.c:4:8: note: previous declaration of 'a' with type 'char[1]' 4 | char a[],b[],c[]; | ^ main.c:6:12: error: conflicting types for 'b'; have 'int[0]' 6 | int a[0],b[0],c[0]; | ^ main.c:4:12: note: previous declaration of 'b' with type 'char[1]' 4 | char a[],b[],c[]; | ^ main.c:6:17: error: conflicting types for 'c'; have 'int[0]' 6 | int a[0],b[0],c[0]; | ^ main.c:4:16: note: previous declaration of 'c' with type 'char[1]' 4 | char a[],b[],c[]; | ^ main.c:7:27: error: 'y' undeclared (first use in this function) 7 | int g=a[0]-32,h=b[0]-32;y=c[0]-32; | ^ main.c:7:27: note: each undeclared identifier is reported only once for each function it appears in main.c:8:8: error: conflicting types for 'g'; have 'char' 8 | char g,h,y; | ^ main.c:7:7: note: previous definition of 'g' with type 'int' 7 | int g=a[0]-32,h=b[0]-32;y=c[0]-32; | ^ main.c:8:10: error: conflicting types for 'h'; have 'char' 8 | char g,h,y; | ^ main.c:7:17: note: previous definition of 'h' with type 'int' 7 | int g=a[0]-32,h=b[0]-32;y=c[0]-32; | ^
s921631886
p03737
C
#include<stdio.h> int main(void){ char s[3][10]; for(int i=0;i<3;i++){ for(int j=0;;j++){ Scanf("%c",&s[i][j]); if(s[i][j]=='\0'){ break; } } } printf("%s%s%s",&s[0][0]-32,&s[1][0]-32,&s[2][0]-32); return 0; }
main.c: In function 'main': main.c:6:25: error: implicit declaration of function 'Scanf'; did you mean 'scanf'? [-Wimplicit-function-declaration] 6 | Scanf("%c",&s[i][j]); | ^~~~~ | scanf
s714009430
p03737
C++
using namespace std; int main(){ string a,b,c; cin >> a >> b >> c; a = toupper(a.at(0)); b = toupper(b.at(0)); c = toupper(c.at(0)); cout <<a <<b<<c << endl; }
a.cc: In function 'int main()': a.cc:5:2: error: 'string' was not declared in this scope 5 | string a,b,c; | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | using namespace std; a.cc:6:2: error: 'cin' was not declared in this scope 6 | cin >> a >> b >> c; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:6:9: error: 'a' was not declared in this scope 6 | cin >> a >> b >> c; | ^ a.cc:6:14: error: 'b' was not declared in this scope 6 | cin >> a >> b >> c; | ^ a.cc:6:19: error: 'c' was not declared in this scope 6 | cin >> a >> b >> c; | ^ a.cc:8:6: error: 'toupper' was not declared in this scope 8 | a = toupper(a.at(0)); | ^~~~~~~ a.cc:11:2: error: 'cout' was not declared in this scope 11 | cout <<a <<b<<c << endl; | ^~~~ a.cc:11:2: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:11:22: error: 'endl' was not declared in this scope 11 | cout <<a <<b<<c << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s621278212
p03737
C
#include<stdio.h> #include<string.h> void main() { char c[100]; int l,i,j=0; clrscr(); printf("enter the string\n"); gets(c); l=strlen(c); for(i=0;i<l;i++) { if(c[i]==' '|| i==l-1) { if(( c[j]=='t' && c[j+1]=='h' && c[j+2]=='e' && c[j+3]==' ') || (c[j] == 'o'&& c[j+1]== 'f' && c[j+2]== ' ') || (c[j]=='f' && c[j+1]=='o' && c[j+2]=='r')) { j=i+1; } else { if(c[j]>=97 || c[j]<=122) { c[j]=c[j]-32; } printf("%c",c[j]); j=i+1; } } } getch(); }
main.c: In function 'main': main.c:8:1: error: implicit declaration of function 'clrscr' [-Wimplicit-function-declaration] 8 | clrscr(); | ^~~~~~ main.c:10:1: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 10 | gets(c); | ^~~~ | fgets main.c:35:1: error: implicit declaration of function 'getch'; did you mean 'getc'? [-Wimplicit-function-declaration] 35 | getch(); | ^~~~~ | getc
s426395151
p03737
C
#include<stdio.h> #include<conio.h> #include<string.h> void main() { char c[100]; int l,i,j=0; clrscr(); printf("enter the string\n"); gets(c); l=strlen(c); for(i=0;i<l;i++) { if(c[i]==' '|| i==l-1) { if(( c[j]=='t' && c[j+1]=='h' && c[j+2]=='e' && c[j+3]==' ') || (c[j] == 'o'&& c[j+1]== 'f' && c[j+2]== ' ') || (c[j]=='f' && c[j+1]=='o' && c[j+2]=='r')) { j=i+1; } else { if(c[j]>=97 || c[j]<=122) { c[j]=c[j]-32; } printf("%c",c[j]); j=i+1; } } } getch(); }
main.c:2:9: fatal error: conio.h: No such file or directory 2 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s471601319
p03737
C
#include<stdio.h> #include<conio.h> #include<string.h> int main() { char c[100]; int l,i,j=0; printf("enter the string\n"); gets(c); l=strlen(c); for(i=0;i<l;i++) { if(c[i]==' '|| i==l-1) { if(( c[j]=='t' && c[j+1]=='h' && c[j+2]=='e' && c[j+3]==' ') || (c[j] == 'o'&& c[j+1]== 'f' && c[j+2]== ' ') || (c[j]=='f' && c[j+1]=='o' && c[j+2]=='r')) { j=i+1; } else { if(c[j]>=97 || c[j]<=122) { c[j]=c[j]-32; } printf("%c",c[j]); j=i+1; } } } getch(); }
main.c:2:9: fatal error: conio.h: No such file or directory 2 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s451245307
p03737
C++
#include<stdio.h> #include<conio.h> #include<string.h> int main() { char c[100]; int l,i,j=0; printf("enter the string\n"); gets(c); l=strlen(c); for(i=0;i<l;i++) { if(c[i]==' '|| i==l-1) { if(( c[j]=='t' && c[j+1]=='h' && c[j+2]=='e' && c[j+3]==' ') || (c[j] == 'o'&& c[j+1]== 'f' && c[j+2]== ' ') || (c[j]=='f' && c[j+1]=='o' && c[j+2]=='r')) { j=i+1; } else { if(c[j]>=97 || c[j]<=122) { c[j]=c[j]-32; } printf("%c",c[j]); j=i+1; } } } getch(); }
a.cc:2:9: fatal error: conio.h: No such file or directory 2 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s569861080
p03737
Java
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.next(); String s2 = sc.next(); String s3 = sc.next(); String ans = s1.charAt(0) + s2.charAt(0); ans += s3.charAt(0); System.out.println(ans.toUpperCase()); } }
Main.java:12: error: incompatible types: int cannot be converted to String String ans = s1.charAt(0) + s2.charAt(0); ^ 1 error
s770462210
p03737
Java
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.next(); String s2 = sc.next(); String s3 = sc.next(); String ans = s1.charAt(0) + s2.charAt(0) + s3.charAt(0); System.out.println(ans.toUpperCase()); } }
Main.java:12: error: incompatible types: int cannot be converted to String String ans = s1.charAt(0) + s2.charAt(0) + s3.charAt(0); ^ 1 error
s230478711
p03737
C++
#include <bits/stdc++.h> using namespace std; //type #define ll long long typedef pair<int, int> P; //定数 #define INF 1000000000000 //10^12:∞ #define MOD 1000000007 //10^9+7:合同式の法 #define MAXR 100000 //10^5:配列の最大のrange //略記 #define PB push_back //挿入 #define MP make_pair //pairのコンストラクタ #define F first //pairの一つ目の要素 #define S second //pairの二つ目の要素 #define Z class // OTHER // xの二乗を返す (関数テンプレート版) template <typename T> T square(T x) { return x * x; } #define chmax(x, y) (x = max(x, y)) #define chmin(x, y) (x = min(x, y)) // loop #define rep(i, n) for (int i = 0; i < (n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= ll(b); i++) #define FORD(i, a, b) for (ll i = a; i >= ll(b); i--) #define FORA(i, I) for (const auto &i : I) // vector #define ALL(x) x.begin(), x.end() // output #define YES() printf("YES\n") #define NO() printf("NO\n") #define isYES(x) printf("%s\n", (x) ? "YES" : "NO") #define Yes() printf("Yes\n") #define No() printf("No\n") #define ln cout << '\n' template <Z A> void pr(A a) { cout << a; ln; } template <Z A, Z B> void pr(A a, B b) { cout << a << ' '; } int ans = 0; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * int main() { string a, b, c, n, x, y; cin >> a >> b >> c; // cin >> a >> b >> c; cout << a[i] << b[i] << c[i]; return 0; }
a.cc: In function 'int main()': a.cc:61:13: error: 'i' was not declared in this scope 61 | cout << a[i] << b[i] << c[i]; | ^
s954368531
p03737
C++
#include <bits/stdc++.h> using namespace std; using ll =long long; #define all(v) v.begin(),v.end() int main() { string s,t,u; cin>>s>>t>>u; string S,T; S="abcdefghijklmnopqrstuvwxyz"; T="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for(ll i=0;i<26;i++) { if(S[i]==s[0]) { cout<<T[i]; } for(ll i=0;i<26;i++) { if(S[i]==t[0]) { cout<<T[i]; } for(ll i=0;i<26;i++) { if(S[i]==u[0]) { cout<<T[i]; } cout<<endl; }
a.cc: In function 'int main()': a.cc:26:10: error: expected '}' at end of input 26 | } | ^ a.cc:16:27: note: to match this '{' 16 | for(ll i=0;i<26;i++) { | ^ a.cc:26:10: error: expected '}' at end of input 26 | } | ^ a.cc:12:24: note: to match this '{' 12 | for(ll i=0;i<26;i++) { | ^ a.cc:26:10: error: expected '}' at end of input 26 | } | ^ a.cc:6:12: note: to match this '{' 6 | int main() { | ^
s129009771
p03737
C++
#include <bits/stdc++.h> using namespace std; int main (){ string a, b, c; cin >> a >> b >> c; char dif=’A’ - ’a’; printf("%c%c%c\n", a[0] + dif, b[0] + dif, c[0] + dif); return 0; }
a.cc:7:10: error: extended character ’ is not valid in an identifier 7 | char dif=’A’ - ’a’; | ^ a.cc:7:10: error: extended character ’ is not valid in an identifier a.cc:7:16: error: extended character ’ is not valid in an identifier 7 | char dif=’A’ - ’a’; | ^ a.cc:7:16: error: extended character ’ is not valid in an identifier a.cc: In function 'int main()': a.cc:7:10: error: '\U00002019A\U00002019' was not declared in this scope 7 | char dif=’A’ - ’a’; | ^~~ a.cc:7:16: error: '\U00002019a\U00002019' was not declared in this scope 7 | char dif=’A’ - ’a’; | ^~~
s591811771
p03737
C++
#include <bits/stdc++.h> using namespace std; int main() { string A, B, C, X, atoA; cin >> A >> B >> C; X.at(0) = A.at(0); X.at(1) = B.at(0); X.at(2) = C.at(0); atoA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for(int i = 0; i < 26; i++) { if(X.at(0) == atoA.at(i)) { X.at(0) == atoA.at(i + 26); } } for(int i = 0; i < 26; i++) { if(X.at(1) == atoA.at(i)) { X.at() == atoA.at(i + 26); } } for(int i = 0; i < 26; i++) { if(X.at(2) == atoA.at(i)) { X.at(2) == atoA.at(i + 26); } } cout << X << endl; }
a.cc: In function 'int main()': a.cc:17:11: error: no matching function for call to 'std::__cxx11::basic_string<char>::at()' 17 | X.at() == atoA.at(i + 26); | ~~~~^~ In file included 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, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1287:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]' 1287 | at(size_type __n) const | ^~ /usr/include/c++/14/bits/basic_string.h:1287:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/basic_string.h:1309:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]' 1309 | at(size_type __n) | ^~ /usr/include/c++/14/bits/basic_string.h:1309:7: note: candidate expects 1 argument, 0 provided
s085801646
p03737
C++
#include <bits/stdc++.h> using namespace std; int main() { string A, B, C, X, atoA; cin >> A >> B >> C; X.at(0) = A.at(0); X.at(1) = B.at(0); X.at(2) = C.at(0); atoA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for(int i = 0, i < 26; i++) { if(X.at(0) == atoA.at(i)) { X.at(0) == atoA.at(i + 26); } } for(int i = 0, i < 26; i++) { if(X.at(1) == atoA.at(i)) { X.at() == atoA.at(i + 26); } } for(int i = 0, i < 26; i++) { if(X.at(2) == atoA.at(i)) { X.at(2) == atoA.at(i + 26); } } cout << X << endl; }
a.cc: In function 'int main()': a.cc:10:19: error: expected ';' before '<' token 10 | for(int i = 0, i < 26; i++) { | ^~ | ; a.cc:10:20: error: expected primary-expression before '<' token 10 | for(int i = 0, i < 26; i++) { | ^ a.cc:15:19: error: expected ';' before '<' token 15 | for(int i = 0, i < 26; i++) { | ^~ | ; a.cc:15:20: error: expected primary-expression before '<' token 15 | for(int i = 0, i < 26; i++) { | ^ a.cc:17:11: error: no matching function for call to 'std::__cxx11::basic_string<char>::at()' 17 | X.at() == atoA.at(i + 26); | ~~~~^~ In file included 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, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1287:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]' 1287 | at(size_type __n) const | ^~ /usr/include/c++/14/bits/basic_string.h:1287:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/basic_string.h:1309:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]' 1309 | at(size_type __n) | ^~ /usr/include/c++/14/bits/basic_string.h:1309:7: note: candidate expects 1 argument, 0 provided a.cc:20:19: error: expected ';' before '<' token 20 | for(int i = 0, i < 26; i++) { | ^~ | ; a.cc:20:20: error: expected primary-expression before '<' token 20 | for(int i = 0, i < 26; i++) { | ^
s227275149
p03737
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[3]; rep(i,0,3)cin>>s[i]; rep(i,0,3){ cout<<(s[0]+'A'-'a')<<endl; } }
a.cc: In function 'int main()': a.cc:27:28: error: no match for 'operator-' (operand types are 'std::__cxx11::basic_string<char>' and 'char') 27 | cout<<(s[0]+'A'-'a')<<endl; | ~~~~~~~~^~~~ | | | | | char | std::__cxx11::basic_string<char> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)' 370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::complex<_Tp>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)' 379 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::complex<_Tp>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)' 388 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed: a.cc:27:29: note: mismatched types 'const std::complex<_Tp>' and 'char' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:29: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'char' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:29: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'char' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::valarray<_Tp>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:27:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::valarray<_Tp>' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:27:29: note: mismatched types 'const std::valarray<_Tp>' and 'char' 27 | cout<<(s[0]+'A'-'a')<<endl; | ^~~
s601511573
p03737
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[3]; rep(i,0,3)cin>>s[i]; rep(i,0,3){ cout<<s[0]+'A'-'a'<<endl; } }
a.cc: In function 'int main()': a.cc:27:27: error: no match for 'operator-' (operand types are 'std::__cxx11::basic_string<char>' and 'char') 27 | cout<<s[0]+'A'-'a'<<endl; | ~~~~~~~~^~~~ | | | | | char | std::__cxx11::basic_string<char> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)' 370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::complex<_Tp>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)' 379 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::complex<_Tp>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)' 388 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed: a.cc:27:28: note: mismatched types 'const std::complex<_Tp>' and 'char' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'char' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:27:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'char' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::valarray<_Tp>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:27:28: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::valarray<_Tp>' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:27:28: note: mismatched types 'const std::valarray<_Tp>' and 'char' 27 | cout<<s[0]+'A'-'a'<<endl; | ^~~
s409352310
p03737
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[3]; rep(i,0,3)cin>>s[i]; rep(i,0,3){ cout<<c[0]+'A'-'a'<<endl; } }
a.cc: In function 'int main()': a.cc:27:19: error: 'c' was not declared in this scope 27 | cout<<c[0]+'A'-'a'<<endl; | ^
s169338755
p03737
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define INF 1e12 #define PB push_back #define PF push_front #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vpi vector<pii> #define vll vector<ll> #define vpl vector<pll> #define vvi vector<vector<int>> #define vvl vector<vector<ll>> #define MX(x) *max_element(all(x)) #define MN(x) *min_element(all(x)) #define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define pr_d(x) cout << fixed << setprecision(15) << x << endl #define ud(c, x) distance(c.begin(), upper_bound(all(c), x)) #define ld(c, x) distance(c.begin(), lower_bound(all(c), x)) #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, a, b) for (int i = (a); i < (b); ++i) #define rep3(i, n) for (int i = (n - 1); i >= 0; --i) #define rep4(i, a, b) for (int i = (a); i > (b); --i) #define pb push_back #define out(x) cout << x << "\n" bool odd(int i) { return i % 2; } #define all(v) v.begin(), v.end() #define size(x) int(x.size()) int gcd(int a, int b) { return __gcd(a, b); } int lcm(int a, int b) { return a * (b / gcd(a, b)); } void Yes_No(bool f) { if (f) printf("YES\n"); else printf("NO\n"); } void deb_p(pii p) { printf("pair = %d %d\n", p.fi, p.se); } void deb_i(int i) { printf("i = %d\n", i); } void deb_v(vector<int> v) { printf("v = "); for (auto i : v) printf("%d ", i); printf("\n"); } template <typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; } //-------------------ここから回答する----------------------- void solve(void) { string a,b,c;cin>>a>>b>>c; out(string(a[0]-32)+string(b[0]-32)+string(c[0]-32)); } int main(void) { solve(); }
a.cc: In function 'void solve()': a.cc:72:21: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int)' 72 | out(string(a[0]-32)+string(b[0]-32)+string(c[0]-32)); | ^ a.cc:30:24: note: in definition of macro 'out' 30 | #define out(x) cout << x << "\n" | ^ In file included 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, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:797:30: required from here 797 | template<typename _Tp, typename = _If_sv<_Tp, void>> | ^~~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 788 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 765 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed: a.cc:72:18: note: cannot convert '(((int)a.std::__cxx11::basic_string<char>::operator[](0)) - 32)' (type 'int') to type 'const char*' 72 | out(string(a[0]-32)+string(b[0]-32)+string(c[0]-32)); a.cc:30:24: note: in definition of macro 'out' 30 | #define out(x) cout << x << "\n" | ^ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 721 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 716 | basic_string(const basic_string& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:711:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:711:45: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<char>' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:682:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 682 | basic_string(basic_string&& __str) noexcept | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:682:35: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>&&' 682 | basic_string(basic_string&& __str) noexcept | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 624 | basic_string(const _CharT* __s, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 604 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 586 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 569 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 552 | basic_string(const basic_string& __str) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:552:40: note: no known conversion for argument 1 from 'int' to 'const std::__cxx11::basic_string<char>&' 552 | basic_string(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:540:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h
s766779361
p03737
C++
#include <bits/stdc++.h> using namespace std; using ll=long long; #define rep(i,N) for(int i=0; i<N; i++){ ; int main() { string A,B,C; cin>>A>>B>>C; transform(A.begin(), A.end(), A.begin(), toupper); transform(B.begin(), B.end(), B.begin(), toupper); transform(C.begin(), C.end(), C.begin(), toupper); }
a.cc: In function 'int main()': a.cc:8:15: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 8 | transform(A.begin(), A.end(), A.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:8:15: note: couldn't deduce template parameter '_UnaryOperation' 8 | transform(A.begin(), A.end(), A.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided a.cc:9:19: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 9 | transform(B.begin(), B.end(), B.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:9:19: note: couldn't deduce template parameter '_UnaryOperation' 9 | transform(B.begin(), B.end(), B.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided a.cc:10:15: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 10 | transform(C.begin(), C.end(), C.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:10:15: note: couldn't deduce template parameter '_UnaryOperation' 10 | transform(C.begin(), C.end(), C.begin(), toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided
s881463252
p03737
C++
#include<bits/stdc++.h> using namespace std; int main(){ string a,b,c; cin >> a >> b >> c; transform(a.begin(),a.end(),a.begin(),toupper); transform(b.begin(),b.end(),b.begin(),toupper); transform(c.begin(),c.end(),c.begin(),toupper); cout << a[0] << b[0] << c[0] << endl; }
a.cc: In function 'int main()': a.cc:6:12: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 6 | transform(a.begin(),a.end(),a.begin(),toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:6:12: note: couldn't deduce template parameter '_UnaryOperation' 6 | transform(a.begin(),a.end(),a.begin(),toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided a.cc:7:12: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 7 | transform(b.begin(),b.end(),b.begin(),toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:7:12: note: couldn't deduce template parameter '_UnaryOperation' 7 | transform(b.begin(),b.end(),b.begin(),toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided a.cc:8:12: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 8 | transform(c.begin(),c.end(),c.begin(),toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:8:12: note: couldn't deduce template parameter '_UnaryOperation' 8 | transform(c.begin(),c.end(),c.begin(),toupper); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided
s858499345
p03737
C++
#include<bits/stdc++.h> using namespace std; int main(){ string a,b,c; cin >> a >> b >> c; transform(a.begin(),a.end(),a.bgin(),toupper); transform(b.begin(),b.end(),b.bgin(),toupper); transform(c.begin(),c.end(),c.bgin(),toupper); cout << a[0] << b[0] << c[0] << endl; }
a.cc: In function 'int main()': a.cc:6:33: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bgin'; did you mean 'begin'? 6 | transform(a.begin(),a.end(),a.bgin(),toupper); | ^~~~ | begin a.cc:7:33: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bgin'; did you mean 'begin'? 7 | transform(b.begin(),b.end(),b.bgin(),toupper); | ^~~~ | begin a.cc:8:33: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bgin'; did you mean 'begin'? 8 | transform(c.begin(),c.end(),c.bgin(),toupper); | ^~~~ | begin