submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s659260417
p03685
Java
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { // Complete the minimumNumber function below. static int minimumNumber(int n, String password) { // Return the minimum number of characters to make the password strong return 1; } private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) throws IOException { BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH"))); int n = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); String password = scanner.nextLine(); int answer = minimumNumber(n, password); bufferedWriter.write(String.valueOf(answer)); bufferedWriter.newLine(); bufferedWriter.close(); scanner.close(); } }
Main.java:9: error: class Solution is public, should be declared in a file named Solution.java public class Solution { ^ 1 error
s703130962
p03685
C++
#include <bits/stdc++.h> using namespace std; namespace IO { const int __S=(1<<20)+5;char __buf[__S],*__H,*__T; inline char getc() { if(__H==__T) __T=(__H=__buf)+fread(__buf,1,__S,stdin); if(__H==__T) return -1;return *__H++; } template <class __I>inline void read(__I &__x) { __x=0;int __fg=1;char __c=getc(); while(!isdigit(__c)&&__c!='-') __c=getc(); if(__c=='-') __fg=-1,__c=getc(); while(isdigit(__c)) __x=__x*10+__c-'0',__c=getc(); __x*=__fg; } inline void readd(double &__x) { __x=0;double __fg=1.0;char __c=getc(); while(!isdigit(__c)&&__c!='-') __c=getc(); if(__c=='-') __fg=-1.0,__c=getc(); while(isdigit(__c)) __x=__x*10.0+__c-'0',__c=getc(); if(__c!='.'){__x=__x*__fg;return;}else while(!isdigit(__c)) __c=getc(); double __t=1e-1;while(isdigit(__c)) __x=__x+1.0*(__c-'0')*__t,__t=__t*0.1,__c=getc(); __x=__x*__fg; } inline void reads(char *__s,int __x) { char __c=getc();int __tot=__x-1; while(__c<'!'||__c>'~') __c=getc(); while(__c>='!'&&__c<='~') __s[++__tot]=__c,__c=getc(); __s[++__tot]='\0'; } char __obuf[__S],*__oS=__obuf,*__oT=__oS+__S-1,__c,__qu[55];int __qr; inline void flush(){fwrite(__obuf,1,__oS-__obuf,stdout);__oS=__obuf;} inline void putc(char __x){*__oS++ =__x;if(__oS==__oT) flush();} template <class __I>inline void print(__I __x) { if(!__x) putc('0'); if(__x<0) putc('-'),__x=-__x; while(__x) __qu[++__qr]=__x%10+'0',__x/=10; while(__qr) putc(__qu[__qr--]); } inline void prints(const char *__s,const int __x) { int __len=strlen(__s+__x); for(int __i=__x;__i<__len+__x;__i++) putc(__s[__i]); } inline void printd(double __x,int __d) { long long __t=(long long)floor(__x);print(__t);putc('.');__x-=(double)__t; while(__d--) { double __y=__x*10.0;__x*=10.0; int __c=(int)floor(__y); putc(__c+'0');__x-=floor(__y); } } inline void el(){putc('\n');}inline void sp(){putc(' ');} }using namespace IO; struct nod{int x,y,c,v;}p[400005];char o[5][10]; int n,m,K,tot,A1,A2,B1,B2,x[400005],y[400005],c[400005],vis[400005],a[400005],las[400005],s[400005],v[400005]; inline bool cmp(nod a,nod b) { if(a.c!=b.c) return a.c<b.c; if(a.c==b.c&&a.c==1) return a.y<b.y;if(a.c==b.c&&a.c==2) return a.x<b.x; if(a.c==b.c&&a.c==3) return a.y>b.y;if(a.c==b.c&&a.c==4) return a.x>b.x; } int main() { read(n);read(m);read(K); for(int i=1;i<=K;i++) { read(A1),read(B1),read(A2),read(B2); if(((A1==0||A1==n)||(B1==0||B1==m))&&((A2==0||A2==n)||(B2==0||B2==m))) x[++tot]=A1,y[tot]=B1,z[tot]=1,v[tot]=i,x[++tot]=A2,y[tot]=B2,z[tot]=-1,v[tot]=i; } for(int i=1;i<=tot;i++) { if(x[i]==0&&y[i]>0) c[i]=1;if(x[i]>0&&y[i]==m) c[i]=2; if(x[i]==n&&y[i]<m) c[i]=3;if(x[i]<n&&y[i]==0) c[i]=4; } for(int i=1;i<=tot;i++) p[i]=(nod){x[i],y[i],c[i],v[i]}; sort(p+1,p+tot+1,cmp);for(int i=1;i<=tot;i++) a[i]=p[i].v; for(int i=tot;i;i--) if(!vis[a[i]]) vis[a[i]]=i,las[i]=tot+1;else las[i]=vis[a[i]]; for(int i=1;i<=tot;i++) if(las[i]!=tot+1) s[i]++,s[las[i]]--; for(int i=1;i<=tot;i++) s[i]+=s[i-1]; for(int i=1;i<=tot;i++) if(las[i]!=tot+1&&s[las[i]]-s[i-1]!=0) return puts("NO"),0; puts("YES");gg:; }
a.cc: In function 'int main()': a.cc:78:35: error: 'z' was not declared in this scope 78 | x[++tot]=A1,y[tot]=B1,z[tot]=1,v[tot]=i,x[++tot]=A2,y[tot]=B2,z[tot]=-1,v[tot]=i; | ^ a.cc: In function 'bool cmp(nod, nod)': a.cc:70:1: warning: control reaches end of non-void function [-Wreturn-type] 70 | } | ^
s552687491
p03685
C++
#include <iostream> #include <vector> #include <algorithm> #include <stack> using namespace std; using ii = pair<long, long>; struct P { int x, y; }; int r, c, n; long encode(P p) { int h = max(r, c); if (p.x == 0) { return 1 + p.y; } else if (p.y == c) { return 1 + h + p.x; } else if (p.x == r) { return 1 + 3 * h - p.y; } else { return 1 + 4 * h - p.x; } } int main() { cin >> r >> c >> n; vector<ii> border; auto onBorder = [](int a, int b) { return (a == 0 || a == r) || (b == 0 || b == c); }; for (int i = 0; i < n; i++) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (onBorder(x1, y1) && onBorder(x2, y2)) { long e1 = encode({x1, y1}), e2 = encode({x2, y2}); border.push_back(ii(min(e1, e2), -min(e1, e2))); border.push_back(ii(max(e1, e2), min(e1, e2))); } } if (border.empty()) { cout << "YES" << endl; return 0; } sort(border.begin(), border.end()); stack<long> st; for (ii p: border) { if (p.second < 0) { st.push(p.second); } else { assert(!st.empty()); long t = st.top(); st.pop(); if (p.second + t) { cout << "NO" << endl; return 0; } } } cout << "YES" << endl; }
a.cc: In function 'int main()': a.cc:53:13: error: 'assert' was not declared in this scope 53 | assert(!st.empty()); | ^~~~~~ a.cc:5:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>' 4 | #include <stack> +++ |+#include <cassert> 5 | using namespace std;
s817070466
p03685
C++
#include <cstdio> #include <cstdlib> #include <algorithm> #include <iostream> #include <cstring> #include <queue> #include <cmath> #include <cstring> #include <string> #include <iomanip> #include <fstream> #include <deque> #include <vector> #include <map> #include <stack> #include <set> #define ll long long #define met(a,0) memset(a,0,sizeof(a)) #define inf 0x3f3f3f3f using namespace std; const int mod=1e9+7; const int N=1e5+10; int r, c, n; stack<int>s; struct node { int u, v, f; } st[N*2]; int cmp(node a, node b) { return a.u<b.u; } int check(int x, int y) { if(x==0) return y; else if(y==c) return c+x; else if(x==r) return r+c+c-y; else if(y==0) return r+r+c+c-x; else return -1; } int main() { ios::sync_with_stdio(false); cin.tie(0); int i,j,k,a,b,cc,d; int num=0,ans=0; cin>>r>>c>>n; for(i=1; i<=n; i++) { cin>>a>>b>>cc>>d; int x=check(a, b), y=check(cc, d); if(x==-1||y==-1) continue; if(x>y) swap(x, y); st[num].f=1; st[num].u=x; st[num++].v=y; st[num].f=2; st[num].u=y; st[num++].v=x; } sort(st+1, st+1+num, cmp); for(i=1; i<=num; i++) { if(st[i].f==1) s.push(st[i].v); else if(s.top()==st[i].u) s.pop(); else { cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; return 0; }
a.cc:18:15: error: expected parameter name, found "0" 18 | #define met(a,0) memset(a,0,sizeof(a)) | ^
s949953561
p03685
C++
#include <bits/stdc++.h> #define ll long long #define met(a,0) memset(a,0,sizeof(a)) #define inf 0x3f3f3f3f using namespace std; const int mod=1e9+7; const int N=1e5+10; int r, c, n; stack<int>s; struct node { int u, v, f; } st[N*2]; int cmp(node a, node b) { return a.u<b.u; } int dis(int x, int y) { if(x==0) return y; else if(y==c) return c+x; else if(x==r) return r+c+c-y; else if(y==0) return r+r+c+c-x; else return -1; } int main() { ios::sync_with_stdio(false); cin.tie(0); int i,j,k,a,b,cc,d; int num=0,ans=0; cin>>r>>c>>n; for(i=1; i<=n; i++) { cin>>a>>b>>cc>>d; int x=dis(a, b), y=dis(cc, d); if(x==-1||y==-1) continue; if(x>y) swap(x, y); st[num].f=1; st[num].u=x; st[num++].v=y; st[num].f=2; st[num].u=y; st[num++].v=x; } sort(st+1, st+1+num, cmp); for(i=1; i<=num; i++) { if(st[i].f==1) s.push(st[i].v); else if(s.top()==st[i].u) s.pop(); else { cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; return 0; }
a.cc:3:15: error: expected parameter name, found "0" 3 | #define met(a,0) memset(a,0,sizeof(a)) | ^
s735607418
p03685
C++
#include<bits/stdC++.h> using namespace std; int R,C,N; struct node{ int u; int v; int flag; }no[200005]; bool cmp(node a,node b) { return a.u < b.u; } int Change(int x, int y) { if (x == 0) return y; else if (y == 0) return R + R + R + C + C - x; else if (x == R) return x +R+C- y; else if (y == C) return x+y; else return -1; } int main() { int cnt=0; scanf("%d%d%d",&R,&C,&N); for(int i=0;i<N;i++) { int a,b,C,d; scanf("%d%d%d%d",&a,&b,&C,&d); int flag1=Change(a,b); int flag2=Change(C,d); if(flag1 == -1 || flag2 == -1) continue; if(flag1 > flag2) swap(flag1,flag2); no[cnt].flag=1; no[cnt].u=flag1; no[cnt++].v=flag2; no[cnt].flag=2; no[cnt].u=flag2; no[cnt++].v=flag1; } stack<int>S; sort(no,no+cnt,cmp); for(int i=0;i<cnt;i++) { if(no[i].flag==1) S.push(no[i].v); else if(S.top()==no[i].u) S.pop(); else { printf("No\n"); return 0; } } printf("Yes\n"); return 0; }
a.cc:1:9: fatal error: bits/stdC++.h: No such file or directory 1 | #include<bits/stdC++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s544973455
p03685
C++
#include<cstdio> #include<fstream> #include<iomanip> #include<algorithm> #include<cmath> #include<deque> #include<vector> #include<assert.h> #include<bitset> #include<queue> #include<string> #include<cstring> #include<map> #include<stack> #include<set> #include<functional> #define pii pair<int, int> #define mod 1000000007 #define mp make_pair #define pi acos(-1) #define eps 0.00000001 #define mst(a,i) memset(a,i,sizeof(a)) #define all(n) n.begin(),n.end() #define lson(x) ((x<<1)) #define rson(x) ((x<<1)|1) #define inf 0x3f3f3f3f typedef long long ll; typedef unsigned long long ull; using namespace std; int r, c; class T { public: int mode, v, ope; bool operator<(const T&a) { return v < a.v; } }; int getnum(int x, int y) { if (x == 0) return y; else if (y == 0) return r+r + r + c + c - x; else if (x == r) return x +r+c- y; else if (y == c) return x+y; else return -1; } vector<T>a; stack<int>sve; int main() { ios::sync_with_stdio(false); cin.tie(0); int i, j, k, m, n; int x1, x2, y1, y2; cin >> r >> c >> n; int tempa, tempb; for (int i = 1; i <= n; ++i) { cin >> y1 >> x1 >> y2 >> x2; tempa = getnum(x1, y1); tempb = getnum(x2, y2); if (tempb == -1 || tempa == -1)continue; if (tempb < tempa)swap(tempa, tempb); a.push_back({ 1,tempa,tempb }); a.push_back({ 2,tempb,tempa }); } sort(all(a)); for (int i = 0; i < a.size(); ++i) { if (a[i].mode == 1) sve.push(a[i].ope); else if (sve.top() == a[i].v) sve.pop(); else { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
a.cc: In function 'int main()': a.cc:57:5: error: 'cin' was not declared in this scope 57 | cin.tie(0); | ^~~ a.cc:17:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 16 | #include<functional> +++ |+#include <iostream> 17 | #define pii pair<int, int> a.cc:81:13: error: 'cout' was not declared in this scope 81 | cout << "NO" << endl; | ^~~~ a.cc:81:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:85:5: error: 'cout' was not declared in this scope 85 | cout << "YES" << endl; | ^~~~ a.cc:85:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s664009593
p03685
C++
#include<iostream> #include<string> #include<cmath> #include<cstdlib> #include<vector> #include<map> #include<set> #include<algorithm> #include<queue> using namespace std; int n; int r,c; int pt[5]; pair<int,int> top[5][100005]; int isedge(int x,int y){ if(x == 0) return 1; if(y == 0) return 4; if(x == r) return 3; if(y == c) return 2; return 0; } int main(){ cin>>r>>c; cin>>n; for(int i=0;i<n;i++){ int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2; if((isedge(x1,y1)>0) && (isedge(x2,y2))){ if(isedge(x1,y1) == 1) top[1][pt[1]++] = make_pair(y1,i); if(isedge(x1,y1) == 2) top[2][pt[2]++] = make_pair(x1,i); if(isedge(x1,y1) == 3) top[3][pt[3]++] = make_pair(y1,i); if(isedge(x1,y1) == 4) top[4][pt[4]++] = make_pair(x1,i); if(isedge(x2,y2) == 1) top[1][pt[1]++] = make_pair(y2,i); if(isedge(x2,y2) == 2) top[2][pt[2]++] = make_pair(x2,i); if(isedge(x2,y2) == 3) top[3][pt[3]++] = make_pair(y2,i); if(isedge(x2,y2) == 4) top[4][pt[4]++] = make_pair(x2,i); } } for(int i=0;i<5;i++){ sort(top[i],top[i]+pt[i]); } /*for(int i=0;i<5;i++){ for(int j=0;j<pt[i];j++)cout<<top[i][j].first<<" "<<top[i][j].second<<endl; }*/ bool ans = true; int pp=0; pair<int,int> stack[100005]; for(int i=0;i<pt[1];i++){ if(pp == 0){ stack[pp++] = top[1][i]; } else { if(stack[pp-1].second == top[1][i].second){ pp--; } else { stack[pp++] = top[1][i]; } } } for(int i=0;i<pt[2];i++){ if(pp == 0){ stack[pp++] = top[2][i]; } else { if(stack[pp-1].second == top[2][i].second){ pp--; } else { stack[pp++] = top[2][i]; } } } for(int i=pt[3]-1;i>=0;i--){ if(pp == 0){ stack[pp++] = top[3][i]; } else { if(stack[pp-1].second == top[3][i].second){ pp--; } else { stack[pp++] = top[3][i]; } } } for(int i=pt[4]-1;i>=0;i--){ if(pp == 0){ stack[pp++] = top[4][i]; } else { if(stack[pp-1].second == top[4][i].second){ pp--; } else { stack[pp++] = top[4][i]; } } } if(pp == 0){ cout<<"Yes"<<endl; } else { cout<<"No"<<endgl; } //cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:98:17: error: 'endgl' was not declared in this scope 98 | cout<<"No"<<endgl; | ^~~~~
s932777341
p03685
C++
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair #define int long long typedef pair<int,int> ii; typedef pair<ii,ii> iiii; iiii x[1000005]; vector<ii> vec[10]; int r,c,n,cnt; stack<int> st; //0 là cột bên trái //1 là hàng ở trên //2 là cột bên phải //3 là hàng ở dưới void qualify(int x1,int y1,int x2,int y2,int num){ int count1=0,count2=0; if(y1==0&&count1==0){ vec[0].pb(mp(x1,num)); count1++; } if(y1==c&&count1==0){ count1++; vec[2].pb(mp(x1,num)); } if(y2==0&&count2==0){ count2++; vec[0].pb(mp(x2,num)); } if(y2==c&&count2==0){ count2++; vec[2].pb(mp(x2,num)); } if(x1==0&&count1==0){ count1++; vec[1].pb(mp(y1,num)); } if(x1==r&&count1==0){ count1++; vec[3].pb(mp(y1,num)); } if(x2==0&&count2==0){ count2++; vec[1].pb(mp(y2,num)); } if(x2==r&&count2==0){ count2++; vec[3].pb(mp(y2,num)); } } bool cmp(const ii &a,const ii &b){ return a.fi<b.fi; } bool cmp1(const ii &a,const ii &b){ return a.fi>b.fi; } int main(){ ios::sync_with_stdio(0); cin>>r>>c>>n; for(int i=1;i<=n;i++) cin>>x[i].fi.fi>>x[i].fi.se>>x[i].se.fi>>x[i].se.se; for(int i=1;i<=n;i++){ int count1=0,count2=0; if(x[i].fi.fi==0||x[i].fi.fi==r) count1++; if(x[i].se.fi==0||x[i].se.fi==r) count1++; if(x[i].fi.se==0||x[i].fi.se==c) count2++; if(x[i].se.se==0||x[i].se.se==c) count2++; if(count1>=2||count2>=2) qualify(x[i].fi.fi,x[i].fi.se,x[i].se.fi,x[i].se.se,i); } sort(vec[0].begin(),vec[0].end(),cmp1); sort(vec[1].begin(),vec[1].end(),cmp); sort(vec[2].begin(),vec[2].end(),cmp); sort(vec[3].begin(),vec[3].end(),cmp1); for(int i=0;i<=3;i++){ for(int j=0;j<vec[i].size();j++){ if(!st.empty()){ if(vec[i][j].se==st.top()) st.pop(); else st.push(vec[i][j].se); } else st.push(vec[i][j].se); } } if(!st.empty()) cout<<"NO"; else cout<<"YES"; }
cc1plus: error: '::main' must return 'int'
s294792925
p03685
C++
#include <iostream> #include <algorithm> #include<cmath> #include<cstring> #include<cstdio> #include<cstdlib> #include<vector> #include<iomanip> #include<stack> #define sqr(x) (x)*(x) using namespace std; int n,m,k,i,j,x,y,xx,yy,vis[100005]; struct ii { int x,y,id; }; vector<ii> seq; stack<int> stk; bool cmp(ii x,ii y) { if (x.x==0) { if (y.x==0) { return x.y<y.y; } return 1; } if (y.x==0) return 0; if (x.y==m) { if (y.y==m) { return x.x<y.x; } return 1; } if (y.y==m) return 0; if (x.x==n) { if (y.x==n) { return x.y>y.y; } return 1; } if (y.x==n) return 0; if (x.y==0) { if (y.y==0) { return x.x>y.x; } return 1; } return 0; } int main() { cin>>n>>m>>k; for (i=1;i<=k;i++) { cin>>x>>y>>xx>>yy; if (x==0||x==n||y==0||y==m) if (xx==0||xx==n||yy==0||yy==m) { seq.push_back((ii){x,y,i}); seq.push_back((ii){xx,yy,i}); } } sort(seq.begin(),seq.end(),cmp); for (i=0;i<seq.size();i++) { if (!vis[seq[i].id]) {stk.push(seq[i].id);vis[seq[i].id]=1;} else { if (seq[i].id!=stk.top()) {cout<<"NO";return 0;} stk.pop(); } } cout<<"YES"; return 0; }#include <iostream> #include <algorithm> #include<cmath> #include<cstring> #include<cstdio> #include<cstdlib> #include<vector> #include<iomanip> #include<stack> #define sqr(x) (x)*(x) using namespace std; int n,m,k,i,j,x,y,xx,yy,vis[100005]; struct ii { int x,y,id; }; vector<ii> seq; stack<int> stk; bool cmp(ii x,ii y) { if (x.x==0) { if (y.x==0) { return x.y<y.y; } return 1; } if (y.x==0) return 0; if (x.y==m) { if (y.y==m) { return x.x<y.x; } return 1; } if (y.y==m) return 0; if (x.x==n) { if (y.x==n) { return x.y>y.y; } return 1; } if (y.x==n) return 0; if (x.y==0) { if (y.y==0) { return x.x>y.x; } return 1; } return 0; } int main() { cin>>n>>m>>k; for (i=1;i<=k;i++) { cin>>x>>y>>xx>>yy; if (x==0||x==n||y==0||y==m) if (xx==0||xx==n||yy==0||yy==m) { seq.push_back((ii){x,y,i}); seq.push_back((ii){xx,yy,i}); } } sort(seq.begin(),seq.end(),cmp); for (i=0;i<seq.size();i++) { if (!vis[seq[i].id]) {stk.push(seq[i].id);vis[seq[i].id]=1;} else { if (seq[i].id!=stk.top()) {cout<<"NO";return 0;} stk.pop(); } } cout<<"YES"; return 0; }
a.cc:81:2: error: stray '#' in program 81 | }#include <iostream> | ^ a.cc:81:3: error: 'include' does not name a type 81 | }#include <iostream> | ^~~~~~~ a.cc:92:5: error: redefinition of 'int n' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:12:5: note: 'int n' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:92:7: error: redefinition of 'int m' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:12:7: note: 'int m' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:92:9: error: redefinition of 'int k' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:12:9: note: 'int k' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:92:11: error: redefinition of 'int i' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:12:11: note: 'int i' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:92:13: error: redefinition of 'int j' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:12:13: note: 'int j' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:92:15: error: redefinition of 'int x' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:12:15: note: 'int x' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:92:17: error: redefinition of 'int y' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:12:17: note: 'int y' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^ a.cc:92:19: error: redefinition of 'int xx' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^~ a.cc:12:19: note: 'int xx' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^~ a.cc:92:22: error: redefinition of 'int yy' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^~ a.cc:12:22: note: 'int yy' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^~ a.cc:92:25: error: redefinition of 'int vis [100005]' 92 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^~~ a.cc:12:25: note: 'int vis [100005]' previously declared here 12 | int n,m,k,i,j,x,y,xx,yy,vis[100005]; | ^~~ a.cc:93:8: error: redefinition of 'struct ii' 93 | struct ii | ^~ a.cc:13:8: note: previous definition of 'struct ii' 13 | struct ii | ^~ a.cc:97:12: error: redefinition of 'std::vector<ii> seq' 97 | vector<ii> seq; | ^~~ a.cc:17:12: note: 'std::vector<ii> seq' previously declared here 17 | vector<ii> seq; | ^~~ a.cc:98:12: error: redefinition of 'std::stack<int> stk' 98 | stack<int> stk; | ^~~ a.cc:18:12: note: 'std::stack<int> stk' previously declared here 18 | stack<int> stk; | ^~~ a.cc:99:6: error: redefinition of 'bool cmp(ii, ii)' 99 | bool cmp(ii x,ii y) | ^~~ a.cc:19:6: note: 'bool cmp(ii, ii)' previously defined here 19 | bool cmp(ii x,ii y) | ^~~ a.cc:138:5: error: redefinition of 'int main()' 138 | int main() | ^~~~ a.cc:58:5: note: 'int main()' previously defined here 58 | int main() | ^~~~
s548493622
p03685
C++
// G++ MACRO.CPP -STD=C++17 #include <bits/stdc++.h> typedef long long ll; const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl #define possible(n) cout << ((n) ? "possible" : "impossible" ) << endl #define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]) #define SCOUT(x) cout<<(x)<<" " #define ENDL cout<<endl #define VECCIN(x) for(auto&youso_: (x) )cin>>youso_ #define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i] #define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;} #define ALL(obj) (obj).begin(),(obj).end() #define EXIST(n,x) (find(ALL(n),x)!=n.end()) #define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end()) #define EN(x) if(1){cout<<#x<<endl;return 0;} #define COUT(x) cout<<(x)<<endl void CINT(){} template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){ cin>>head; CINT(move(tail)...); } #define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__) #define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__) #define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__) template <class T = ll> T IN(){T x;cin>>x;return (x);} template <class Head> void VT(Head head){} template <class Head,class Seco,class... Tail> void VT(Head&& head,Seco&& seco,Tail&&... tail){ seco.resize(head); VT(head,move(tail)...); } void VT2(){} template <class Head,class... Tail> void VT2(Head&& head,Tail&&... tail){ VECCIN(head); VT2(move(tail)...); } template <class Head> void VT3(Head&& head){} template <class Head,class Seco,class... Tail> void VT3(Head&& head,Seco&& seco,Tail&&... tail){ seco[head]=IN(); VT3(head,move(tail)...); } #define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc #define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; // cpp_int #define P pair<ll,ll> #define V vector<ll> #define M map<ll,ll> #define S set<ll> #define pb(a) push_back(a) #define mp make_pair int main(){ LCIN(h,w,n);VC2(n,x1,y1,x2,y2); vector<P> v; REP(i,n){ if(((x1[i]==0||x1[i]==h)||(y1[i]==0||y1[i]==w))&&((x2[i]==0||x2[i]==h)||(y2[i]==0||y2[i]==w))){ ll v1,v2; v1 = (!y1[i]?x1[i]:(x1[i]==h?h+y1[i]:(y1[i]==w?h+w+h-x1[i]:w*2+h*2-y1[i]))); v2 = (!y2[i]?x2[i]:(x2[i]==h?h+y2[i]:(y2[i]==w?h+w+h-x2[i]:w*2+h*2-y2[i]))); P vv = mp(v1,v2); if(vv.first>vv.second)swap(vv.first,vv.second); v.pb(vv); } } sort(ALL(v)); /* REP(i,v.size()) cout<<v[i].first <<" : "<<v[i].second<<endl; */ set<P> s; REP(i,v.size()){ s.erase(s.begin(), s.upper_bound(v[i].first)); if(s.upper_bound(v[i].second) != next(s.begin())) EN(NO); s.insert(v[i]); } YES(1); return 0; }
a.cc: In function 'int main()': a.cc:109:37: error: no matching function for call to 'std::set<std::pair<long long int, long long int> >::upper_bound(long long int&)' 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/set:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158, from a.cc:2: /usr/include/c++/14/bits/stl_set.h:871:9: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) [with _Key = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 871 | upper_bound(const _Kt& __x) | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:871:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, long long int> >::iterator)(((std::set<std::pair<long long int, long long int> >*)this)->std::set<std::pair<long long int, long long int> >::_M_t.std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(__x))) std::set<std::pair<long long int, long long int> >::upper_bound(const _Kt&) [with _Kt = long long int]': a.cc:109:37: required from here 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:872:52: error: no matching function for call to 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(const long long int&)' 872 | -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/map:62, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152: /usr/include/c++/14/bits/stl_tree.h:1347:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) [with _Req = _Kt; _Key = std::pair<long long int, long long int>; _Val = std::pair<long long int, long long int>; _KeyOfValue = std::_Identity<std::pair<long long int, long long int> >; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1347 | _M_upper_bound_tr(const _Kt& __k) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1347:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/string:49, 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/stl_function.h: In substitution of 'template<class _Func, class _SfinaeType> using std::__has_is_transparent_t = typename std::__has_is_transparent<_Func, _SfinaeType>::type [with _Func = std::less<std::pair<long long int, long long int> >; _SfinaeType = long long int]': /usr/include/c++/14/bits/stl_tree.h:1345:9: required by substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, long long int> >::iterator)(((std::set<std::pair<long long int, long long int> >*)this)->std::set<std::pair<long long int, long long int> >::_M_t.std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(__x))) std::set<std::pair<long long int, long long int> >::upper_bound(const _Kt&) [with _Kt = long long int]' 1345 | typename _Req = __has_is_transparent_t<_Compare, _Kt>> | ^~~~~~~~ a.cc:109:37: required from here 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_function.h:1427:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::pair<long long int, long long int> >, long long int, void>' 1427 | using __has_is_transparent_t | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, long long int> >::iterator)(((std::set<std::pair<long long int, long long int> >*)this)->std::set<std::pair<long long int, long long int> >::_M_t.std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(__x))) std::set<std::pair<long long int, long long int> >::upper_bound(const _Kt&) [with _Kt = long long int]': a.cc:109:37: required from here 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1356:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) const [with _Req = _Kt; _Key = std::pair<long long int, long long int>; _Val = std::pair<long long int, long long int>; _KeyOfValue = std::_Identity<std::pair<long long int, long long int> >; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1356 | _M_upper_bound_tr(const _Kt& __k) const | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1356:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h:877:9: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) const [with _Key = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 877 | upper_bound(const _Kt& __x) const | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:877:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, long long int> >::iterator)(((const std::set<std::pair<long long int, long long int> >*)this)->std::set<std::pair<long long int, long long int> >::_M_t.std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(__x))) std::set<std::pair<long long int, long long int> >::upper_bound(const _Kt&) const [with _Kt = long long int]': a.cc:109:37: required from here 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:878:52: error: no matching function for call to 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(const long long int&) const' 878 | -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:1347:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) [with _Req = _Kt; _Key = std::pair<long long int, long long int>; _Val = std::pair<long long int, long long int>; _KeyOfValue = std::_Identity<std::pair<long long int, long long int> >; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1347 | _M_upper_bound_tr(const _Kt& __k) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1347:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_tree.h:1356:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) const [with _Req = _Kt; _Key = std::pair<long long int, long long int>; _Val = std::pair<long long int, long long int>; _KeyOfValue = std::_Identity<std::pair<long long int, long long int> >; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1356 | _M_upper_bound_tr(const _Kt& __k) const | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1356:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h:861:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::i
s891452225
p03685
C++
// G++ MACRO.CPP -STD=C++17 #include <bits/stdc++.h> typedef long long ll; const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl #define possible(n) cout << ((n) ? "possible" : "impossible" ) << endl #define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]) #define SCOUT(x) cout<<(x)<<" " #define ENDL cout<<endl #define VECCIN(x) for(auto&youso_: (x) )cin>>youso_ #define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i] #define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;} #define ALL(obj) (obj).begin(),(obj).end() #define EXIST(n,x) (find(ALL(n),x)!=n.end()) #define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end()) #define EN(x) if(1){cout<<#x<<endl;return 0;} #define COUT(x) cout<<(x)<<endl void CINT(){} template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){ cin>>head; CINT(move(tail)...); } #define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__) #define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__) #define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__) template <class T = ll> T IN(){T x;cin>>x;return (x);} template <class Head> void VT(Head head){} template <class Head,class Seco,class... Tail> void VT(Head&& head,Seco&& seco,Tail&&... tail){ seco.resize(head); VT(head,move(tail)...); } void VT2(){} template <class Head,class... Tail> void VT2(Head&& head,Tail&&... tail){ VECCIN(head); VT2(move(tail)...); } template <class Head> void VT3(Head&& head){} template <class Head,class Seco,class... Tail> void VT3(Head&& head,Seco&& seco,Tail&&... tail){ seco[head]=IN(); VT3(head,move(tail)...); } #define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc #define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; // cpp_int #define P pair<ll,ll> #define V vector<ll> #define M map<ll,ll> #define S set<ll> #define pb(a) push_back(a) #define mp make_pair int main(){ LCIN(h,w,n);VC2(n,x1,y1,x2,y2); vector<P> v; REP(i,n){ if(((x1[i]==0||x1[i]==h)||(y1[i]==0||y1[i]==w))&&((x2[i]==0||x2[i]==h)||(y2[i]==0||y2[i]==w))){ ll v1,v2; v1 = (!y1[i]?x1[i]:(x1[i]==h?h+y1[i]:(y1[i]==w?h+w+h-x1[i]:w*2+h*2-y1[i]))); v2 = (!y2[i]?x2[i]:(x2[i]==h?h+y2[i]:(y2[i]==w?h+w+h-x2[i]:w*2+h*2-y2[i]))); P vv = mp(v1,v2); if(vv.first>vv.second)swap(vv.first,vv.second); v.pb(vv); } } sort(ALL(v)); /* REP(i,v.size()) cout<<v[i].first <<" : "<<v[i].second<<endl; */ set<P> s; REP(i,v.size()){ s.erase(s.begin(), s.upper_bound(v[i].first)); if(s.upper_bound(v[i].second) != next(s.begin())) EN(NO); } s.insert(v[i]); } YES(1); return 0; }
a.cc: In function 'int main()': a.cc:109:39: error: no matching function for call to 'std::set<std::pair<long long int, long long int> >::upper_bound(long long int&)' 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/set:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158, from a.cc:2: /usr/include/c++/14/bits/stl_set.h:871:9: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) [with _Key = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 871 | upper_bound(const _Kt& __x) | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:871:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, long long int> >::iterator)(((std::set<std::pair<long long int, long long int> >*)this)->std::set<std::pair<long long int, long long int> >::_M_t.std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(__x))) std::set<std::pair<long long int, long long int> >::upper_bound(const _Kt&) [with _Kt = long long int]': a.cc:109:39: required from here 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:872:52: error: no matching function for call to 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(const long long int&)' 872 | -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/map:62, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152: /usr/include/c++/14/bits/stl_tree.h:1347:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) [with _Req = _Kt; _Key = std::pair<long long int, long long int>; _Val = std::pair<long long int, long long int>; _KeyOfValue = std::_Identity<std::pair<long long int, long long int> >; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1347 | _M_upper_bound_tr(const _Kt& __k) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1347:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/string:49, 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/stl_function.h: In substitution of 'template<class _Func, class _SfinaeType> using std::__has_is_transparent_t = typename std::__has_is_transparent<_Func, _SfinaeType>::type [with _Func = std::less<std::pair<long long int, long long int> >; _SfinaeType = long long int]': /usr/include/c++/14/bits/stl_tree.h:1345:9: required by substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, long long int> >::iterator)(((std::set<std::pair<long long int, long long int> >*)this)->std::set<std::pair<long long int, long long int> >::_M_t.std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(__x))) std::set<std::pair<long long int, long long int> >::upper_bound(const _Kt&) [with _Kt = long long int]' 1345 | typename _Req = __has_is_transparent_t<_Compare, _Kt>> | ^~~~~~~~ a.cc:109:39: required from here 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_function.h:1427:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::pair<long long int, long long int> >, long long int, void>' 1427 | using __has_is_transparent_t | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, long long int> >::iterator)(((std::set<std::pair<long long int, long long int> >*)this)->std::set<std::pair<long long int, long long int> >::_M_t.std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(__x))) std::set<std::pair<long long int, long long int> >::upper_bound(const _Kt&) [with _Kt = long long int]': a.cc:109:39: required from here 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1356:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) const [with _Req = _Kt; _Key = std::pair<long long int, long long int>; _Val = std::pair<long long int, long long int>; _KeyOfValue = std::_Identity<std::pair<long long int, long long int> >; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1356 | _M_upper_bound_tr(const _Kt& __k) const | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1356:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h:877:9: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) const [with _Key = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 877 | upper_bound(const _Kt& __x) const | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:877:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, long long int> >::iterator)(((const std::set<std::pair<long long int, long long int> >*)this)->std::set<std::pair<long long int, long long int> >::_M_t.std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(__x))) std::set<std::pair<long long int, long long int> >::upper_bound(const _Kt&) const [with _Kt = long long int]': a.cc:109:39: required from here 109 | s.erase(s.begin(), s.upper_bound(v[i].first)); | ~~~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:878:52: error: no matching function for call to 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::_M_upper_bound_tr(const long long int&) const' 878 | -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:1347:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) [with _Req = _Kt; _Key = std::pair<long long int, long long int>; _Val = std::pair<long long int, long long int>; _KeyOfValue = std::_Identity<std::pair<long long int, long long int> >; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1347 | _M_upper_bound_tr(const _Kt& __k) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1347:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_tree.h:1356:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) const [with _Req = _Kt; _Key = std::pair<long long int, long long int>; _Val = std::pair<long long int, long long int>; _KeyOfValue = std::_Identity<std::pair<long long int, long long int> >; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1356 | _M_upper_bound_tr(const _Kt& __k) const | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1356:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h:861:7: note: candidate: 'std::set<_Key,
s635242910
p03685
C++
#include <bits/stdc++.h> using namespace std; const int maxn=100005; int r,c,n,x1,y1,x2,y2; inline bool isbound(int x,int y) { return !x||x==r||!y||y==c; } struct point { int x,y,id; point(){} point(int x,int y,int id):x(x),y(y),id(id){} } p[maxn<<1]; inline bool cmp1(point p1,point p2) { return p1.x<p2.x; } inline bool cmp2(point p1,point p2) { return p1.y<p2.y; } inline bool cmp3(point p1,point p2) { return cmp1(p2,p1); } inline bool cmp4(point p1,point p2) { return cmp2(p2,p1); } vector<point> v; stack<int> stk; int main() { scanf("%d%d%d",&r,&c,&n); for (int i=0;i<n;++i) { scanf("%d%d%d%d",&x1,&y1,&x2,&y2); if (isbound(x1,y1)&&isbound(x2,y2)) { v.push_back(point(x1,y1,i)); v.push_back(point(x2,y2,i)); } } sort(v.begin(),v.end(),cmp1); for (int i=0;i<(int)v.size();++i) if (v[i].y==0) { if (!stk.empty()&&stk.top()==v[i].id) { stk.pop(); continue; } stk.push(v[i].id); } sort(v.begin(),v.end(),cmp2); for (int i=0;i<(int)v.size();++i) if (v[i].x==r&&v[i].y!=0&&v[i].y!=c) { if (!stk.empty()&&stk.top()==v[i].id) { stk.pop(); continue; } stk.push(v[i].id); } sort(v.begin(),v.end(),cmp3); for (int i=0;i<(int)v.size();++i) if (v[i].y==c) { if (!stk.empty()&&stk.top()==v[i].id) { stk.pop(); continue; } stk.push(v[i].id); } sort(v.begin(),v.end(),cmp4); for (int i=0;i<(int)v.size();++i) if (v[i].x==0&&v[i].y!=0&&v[i].y!=c) { if (!stk.empty()&&stk.top()==v[i].id) { stk.pop(); continue; } stk.push(v[i].id); } puts(stk.empty()?"YES":"NO"); return 0; }
a.cc:4:14: error: 'int y1' redeclared as different kind of entity 4 | int r,c,n,x1,y1,x2,y2; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:32:24: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 32 | if (isbound(x1,y1)&&isbound(x2,y2)) { | ^~ | | | double (*)(double) noexcept a.cc:5:31: note: initializing argument 2 of 'bool isbound(int, int)' 5 | inline bool isbound(int x,int y) { | ~~~~^ a.cc:33:34: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 33 | v.push_back(point(x1,y1,i)); | ^~ | | | double (*)(double) noexcept a.cc:11:21: note: initializing argument 2 of 'point::point(int, int, int)' 11 | point(int x,int y,int id):x(x),y(y),id(id){} | ~~~~^
s173214220
p03685
C++
#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "string" #include "map" #include "iomanip" #include "random" using namespace std; const long long int MOD = 1000000007; const long double EPS = 0.00000001; const long double PI = 3.1415926535897932384626433; long long int N, M, K, H, W, L, R; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> H >> W >> N; vector<pair<int, int>>box; for (int i = 0; i < N; i++) { int sx, sy, gx, gy; cin >> sy >> sx >> gy >> gx; if (sx != 0 && sx != W&&sy!=0&&sy!=H) { continue; } if (gx != 0 && gx != W&&gy!=0&&gy!=H) { continue; } if (sy == 0) { box.push_back({ sx,i }); } else if (sx == W) { box.push_back({ W + sy,i }); } else if (sy == H) { box.push_back({ 2 * W + H - sx,i }); } else { box.push_back({ 2 * W + 2 * H - sy,i }); } if (gy == 0) { box.push_back({ gx,i }); } else if (gx == W) { box.push_back({ W + gy,i }); } else if (gy == H) { box.push_back({ 2 * W + H - gx,i }); } else { box.push_back({ 2 * W + 2 * H - gy,i }); } } if (box.empty()) { cout << "YES\n"; return 0; } sort(box.begin(), box.end()); M = box.size(); list<pair<int, int>>bag(box.begin(), box.end()); list<pair<int, int>>::iterator l=bag.end; list<pair<int, int>>::iterator r=bag.end; for (auto i = bag.begin(); i != bag.end(); i++) { auto j = i; j++; if (j == bag.end) { j = bag.begin(); } if ((*i).second == (*j).second) { l = i; r = j; break; } } if (l == bag.end) { cout << "NO\n"; return; } while (!bag.empty()) { if ((*l).second == (*r).second) { auto rx = r; auto lx = l; if (lx == bag.begin()) { lx = bag.end; } lx--; rx++; if (rx == bag.end) { rx = bag.begin; } bag.erase(l); bag.erase(r); r = rx; l = lx; continue; } auto rn = r; rn++; if (rn == bag.end) { rn = bag.begin; } auto ln = l; if (ln == bag.begin) { ln = bag.end; } ln--; if ((*l).second == (*ln).second) { auto lx = ln; if (lx == bag.begin) { lx = bag.end; } lx--; bag.erase(l); bag.erase(ln); l = lx; continue; } if ((*r).second == (*rn).second) { auto rx = rn; rx++; if (rx == bag.end) { rx = bag.begin; } bag.erase(r); bag.erase(rn); l = rx; continue; } l = bag.end; r = bag.end; for (auto i = bag.begin(); i != bag.end(); i++) { auto j = i; j++; if (j == bag.end) { j = bag.begin(); } if ((*i).second == (*j).second) { l = i; r = j; break; } } if (l == bag.end) { cout << "NO\n"; return; } } cout << "YES\n"; return 0; }
a.cc: In function 'int main()': a.cc:69:46: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'std::__cxx11::list<std::pair<int, int> >::iterator' requested 69 | list<pair<int, int>>::iterator l=bag.end; | ~~~~^~~ a.cc:70:46: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'std::__cxx11::list<std::pair<int, int> >::iterator' requested 70 | list<pair<int, int>>::iterator r=bag.end; | ~~~~^~~ a.cc:74:23: error: no match for 'operator==' (operand types are 'std::_List_iterator<std::pair<int, int> >' and '<unresolved overloaded function type>') 74 | if (j == bag.end) { | ~ ^~ ~~~~~~~ | | | | | <unresolved overloaded function type> | std::_List_iterator<std::pair<int, int> > In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::fpos<_StateT>' 74 | if (j == bag.end) { | ^~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::allocator<_CharT>' 74 | if (j == bag.end) { | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::reverse_iterator<_Iterator>' 74 | if (j == bag.end) { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::reverse_iterator<_Iterator>' 74 | if (j == bag.end) { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::move_iterator<_IteratorL>' 74 | if (j == bag.end) { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::move_iterator<_IteratorL>' 74 | if (j == bag.end) { | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::pair<_T1, _T2>' 74 | if (j == bag.end) { | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 74 | if (j == bag.end) { | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 74 | if (j == bag.end) { | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:74:30: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'std::__cxx11::list<std::pair<int, int> >::const_iterator (std::__cxx11::list<std::pair<int, int> >::*)() const noexcept' 74 | if (j == bag.end) { | ^~~ a.cc:74:30: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'std::__cxx11::list<std::pair<int, int> >::iterator (std::__cxx11::list<std::pair<int, int> >::*)() noexcept' a.cc:74:30: note: couldn't deduce template parameter '_CharT' /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 74 | if (j == bag.end) { | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:74:30: note: 'std::_List_iterator<std::pair<int, int> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 74 | if (j == bag.end) { | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:74:30: note: mismatched types 'const _CharT*' and 'std::_List_iterator<std::pair<int, int> >' 74 | if (j == bag.end) { | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operato
s170378135
p03685
C++
#include <bits/stdc++.h> using namespace std; #define INF (1LL << 31 - 1) #define MOD int(1e9+7) #define repi(i,j,n) for(int i = (j); i < (n); ++i) #define rep(i,n) repi(i,0,n) #define fi first #define se second #define all(v) (v).begin(), (v).end() inline void init() { cin.tie(0); ios::sync_with_stdio(false); } using ll = long long; ll R, C, n, a, b, c, d; vector<T> xz, yz, xr, yc; vector<T> v; struct T { int x, y, id; T () {} T (ll x, ll y, ll id) : x(x), y(y), id(id) {} bool operator < (const T &t) const { if (x == t.x) return y < t.y; return x < t.x; } }; int main() { init(); cin >> R >> C >> n; rep(i,n) { cin >> a >> b >> c >> d; if (a == 0 and (c == 0 or c == R or d == 0 or d == C) or a == R and (c == 0 or c == R or d == 0 or d == C)) { if (a == 0) xz.push_back({a, b, i}); else if (a == R) xr.push_back({a, b, i}); else if (b == 0) yz.push_back({a, b, i}); else yc.push_back({a, b, i}); if (c == 0) xz.push_back({c, d, i}); else if (c == R) xr.push_back({c, d, i}); else if (d == 0) yz.push_back({c, d, i}); else yc.push_back({c, d, i}); } } int sxz, syz, sxr, syc; sxz = xz.size(); syz = yz.size(); sxr = xr.size(); syc = yc.size(); sort(all(xz)); sort(all(yz)); sort(all(xr)); sort(all(yc)); rep(i,sxz) v.push_back({xz[i].fi, xz[i].se, xz[i].id}); rep(i,syc) v.push_back({yc[i].fi, yc[i].se, yc[i].id}); for (int i = sxr - 1; i >= 0; i--) v.push_back({xr[i].fi, xr[i].se, xr[i].id}); for (int i = syz - 1; i >= 0; i--) v.push_back({yz[i].fi, yz[i].se, yz[i].id}); stack<T> st; map<T, bool> mp; rep(i,si) { //cout << v[i].x << " " << v[i].y << " " << v[i].id << endl; if (!mp[v[i]]) { st.push(v[i]); mp[v[i]] = true; } else { T t = st.top(); st.pop(); if (t.id != v[i].id) { cout << "NO" << endl; return 0; } else { mp[v[i]] = false; } } } cout << "YES" << endl; return 0; }
a.cc:20:8: error: 'T' was not declared in this scope 20 | vector<T> xz, yz, xr, yc; | ^ a.cc:20:9: error: template argument 1 is invalid 20 | vector<T> xz, yz, xr, yc; | ^ a.cc:20:9: error: template argument 2 is invalid a.cc:21:8: error: 'T' was not declared in this scope 21 | vector<T> v; | ^ a.cc:21:9: error: template argument 1 is invalid 21 | vector<T> v; | ^ a.cc:21:9: error: template argument 2 is invalid a.cc: In function 'int main()': a.cc:40:22: error: request for member 'push_back' in 'xz', which is of non-class type 'int' 40 | if (a == 0) xz.push_back({a, b, i}); | ^~~~~~~~~ a.cc:41:27: error: request for member 'push_back' in 'xr', which is of non-class type 'int' 41 | else if (a == R) xr.push_back({a, b, i}); | ^~~~~~~~~ a.cc:42:27: error: request for member 'push_back' in 'yz', which is of non-class type 'int' 42 | else if (b == 0) yz.push_back({a, b, i}); | ^~~~~~~~~ a.cc:43:15: error: request for member 'push_back' in 'yc', which is of non-class type 'int' 43 | else yc.push_back({a, b, i}); | ^~~~~~~~~ a.cc:44:22: error: request for member 'push_back' in 'xz', which is of non-class type 'int' 44 | if (c == 0) xz.push_back({c, d, i}); | ^~~~~~~~~ a.cc:45:27: error: request for member 'push_back' in 'xr', which is of non-class type 'int' 45 | else if (c == R) xr.push_back({c, d, i}); | ^~~~~~~~~ a.cc:46:27: error: request for member 'push_back' in 'yz', which is of non-class type 'int' 46 | else if (d == 0) yz.push_back({c, d, i}); | ^~~~~~~~~ a.cc:47:15: error: request for member 'push_back' in 'yc', which is of non-class type 'int' 47 | else yc.push_back({c, d, i}); | ^~~~~~~~~ a.cc:52:12: error: request for member 'size' in 'xz', which is of non-class type 'int' 52 | sxz = xz.size(); | ^~~~ a.cc:53:12: error: request for member 'size' in 'yz', which is of non-class type 'int' 53 | syz = yz.size(); | ^~~~ a.cc:54:12: error: request for member 'size' in 'xr', which is of non-class type 'int' 54 | sxr = xr.size(); | ^~~~ a.cc:55:12: error: request for member 'size' in 'yc', which is of non-class type 'int' 55 | syc = yc.size(); | ^~~~ a.cc:10:20: error: request for member 'begin' in 'xz', which is of non-class type 'int' 10 | #define all(v) (v).begin(), (v).end() | ^~~~~ a.cc:57:8: note: in expansion of macro 'all' 57 | sort(all(xz)); | ^~~ a.cc:10:33: error: request for member 'end' in 'xz', which is of non-class type 'int' 10 | #define all(v) (v).begin(), (v).end() | ^~~ a.cc:57:8: note: in expansion of macro 'all' 57 | sort(all(xz)); | ^~~ a.cc:10:20: error: request for member 'begin' in 'yz', which is of non-class type 'int' 10 | #define all(v) (v).begin(), (v).end() | ^~~~~ a.cc:58:8: note: in expansion of macro 'all' 58 | sort(all(yz)); | ^~~ a.cc:10:33: error: request for member 'end' in 'yz', which is of non-class type 'int' 10 | #define all(v) (v).begin(), (v).end() | ^~~ a.cc:58:8: note: in expansion of macro 'all' 58 | sort(all(yz)); | ^~~ a.cc:10:20: error: request for member 'begin' in 'xr', which is of non-class type 'int' 10 | #define all(v) (v).begin(), (v).end() | ^~~~~ a.cc:59:8: note: in expansion of macro 'all' 59 | sort(all(xr)); | ^~~ a.cc:10:33: error: request for member 'end' in 'xr', which is of non-class type 'int' 10 | #define all(v) (v).begin(), (v).end() | ^~~ a.cc:59:8: note: in expansion of macro 'all' 59 | sort(all(xr)); | ^~~ a.cc:10:20: error: request for member 'begin' in 'yc', which is of non-class type 'int' 10 | #define all(v) (v).begin(), (v).end() | ^~~~~ a.cc:60:8: note: in expansion of macro 'all' 60 | sort(all(yc)); | ^~~ a.cc:10:33: error: request for member 'end' in 'yc', which is of non-class type 'int' 10 | #define all(v) (v).begin(), (v).end() | ^~~ a.cc:60:8: note: in expansion of macro 'all' 60 | sort(all(yc)); | ^~~ a.cc:62:16: error: request for member 'push_back' in 'v', which is of non-class type 'int' 62 | rep(i,sxz) v.push_back({xz[i].fi, xz[i].se, xz[i].id}); | ^~~~~~~~~ a.cc:62:29: error: invalid types 'int[int]' for array subscript 62 | rep(i,sxz) v.push_back({xz[i].fi, xz[i].se, xz[i].id}); | ^ a.cc:62:39: error: invalid types 'int[int]' for array subscript 62 | rep(i,sxz) v.push_back({xz[i].fi, xz[i].se, xz[i].id}); | ^ a.cc:62:49: error: invalid types 'int[int]' for array subscript 62 | rep(i,sxz) v.push_back({xz[i].fi, xz[i].se, xz[i].id}); | ^ a.cc:63:16: error: request for member 'push_back' in 'v', which is of non-class type 'int' 63 | rep(i,syc) v.push_back({yc[i].fi, yc[i].se, yc[i].id}); | ^~~~~~~~~ a.cc:63:29: error: invalid types 'int[int]' for array subscript 63 | rep(i,syc) v.push_back({yc[i].fi, yc[i].se, yc[i].id}); | ^ a.cc:63:39: error: invalid types 'int[int]' for array subscript 63 | rep(i,syc) v.push_back({yc[i].fi, yc[i].se, yc[i].id}); | ^ a.cc:63:49: error: invalid types 'int[int]' for array subscript 63 | rep(i,syc) v.push_back({yc[i].fi, yc[i].se, yc[i].id}); | ^ a.cc:64:40: error: request for member 'push_back' in 'v', which is of non-class type 'int' 64 | for (int i = sxr - 1; i >= 0; i--) v.push_back({xr[i].fi, xr[i].se, xr[i].id}); | ^~~~~~~~~ a.cc:64:53: error: invalid types 'int[int]' for array subscript 64 | for (int i = sxr - 1; i >= 0; i--) v.push_back({xr[i].fi, xr[i].se, xr[i].id}); | ^ a.cc:64:63: error: invalid types 'int[int]' for array subscript 64 | for (int i = sxr - 1; i >= 0; i--) v.push_back({xr[i].fi, xr[i].se, xr[i].id}); | ^ a.cc:64:73: error: invalid types 'int[int]' for array subscript 64 | for (int i = sxr - 1; i >= 0; i--) v.push_back({xr[i].fi, xr[i].se, xr[i].id}); | ^ a.cc:65:40: error: request for member 'push_back' in 'v', which is of non-class type 'int' 65 | for (int i = syz - 1; i >= 0; i--) v.push_back({yz[i].fi, yz[i].se, yz[i].id}); | ^~~~~~~~~ a.cc:65:53: error: invalid types 'int[int]' for array subscript 65 | for (int i = syz - 1; i >= 0; i--) v.push_back({yz[i].fi, yz[i].se, yz[i].id}); | ^ a.cc:65:63: error: invalid types 'int[int]' for array subscript 65 | for (int i = syz - 1; i >= 0; i--) v.push_back({yz[i].fi, yz[i].se, yz[i].id}); | ^ a.cc:65:73: error: invalid types 'int[int]' for array subscript 65 | for (int i = syz - 1; i >= 0; i--) v.push_back({yz[i].fi, yz[i].se, yz[i].id}); | ^ a.cc:71:9: error: 'si' was not declared in this scope; did you mean 'i'? 71 | rep(i,si) { | ^~ a.cc:6:43: note: in definition of macro 'repi' 6 | #define repi(i,j,n) for(int i = (j); i < (n); ++i) | ^ a.cc:71:3: note: in expansion of macro 'rep' 71 | rep(i,si) { | ^~~ a.cc:73:14: error: invalid types 'int[int]' for array subscript 73 | if (!mp[v[i]]) { | ^ a.cc:74:16: error: invalid types 'int[int]' for array subscript 74 | st.push(v[i]); | ^ a.cc:75:11: error: invalid types 'int[int]' for array subscript 75 | mp[v[i]] = true; | ^ a.cc:80:20: error: invalid types 'int[int]' for array subscript 80 | if (t.id != v[i].id) { | ^ a.cc:85:13: error: invalid types 'int[int]' for array subscript 85 | mp[v[i]] = false; | ^
s329916880
p03685
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; typedef pair<int, int> P; int r, c, n; bool onLine(int x, int y) { if (x == 0 || y == 0 || x == r || y == c) return true; return false; } int which(int x, int y) { if (x == 0 && y == c) return 1; if (x == 0 && y == 0) return 2; if (x == r && y == 0) return 3; if (x == r && y == c) return 4; if (y == c) return 5; if (x == 0) return 6; if (y == 0) return 7; if (x == r) return 8; return 0; } int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> r >> c >> n; vector<pair<P, P> > v; bool yoko = false, tate = false, lna = false, rna = false; FOR(i, n) { int x, y, u, v; cin >> x >> y >> u >> v; if (onLine(x, y) && onLine(u, v)) { int xy = which(x, y), uv = which(u, v); if (xy == 1) { if (uv == 2 || uv == 7) yoko = true; if (uv == 3) lna = true; if (uv == 4 || uv == 8) tate = true; } else if (xy == 2) { if (uv == 1 || uv == 5) yoko = true; if (uv == 4) rna = true; if (uv == 3 || uv == 8) tate = true; } else if (xy == 3) { if (uv == 4 || uv == 5) yoko = true; if (uv == 1) lna = true; if (uv == 2 || uv == 6) tate = true; } else if (xy == 4) { if (uv == 3 || uv == 7) yoko = true; if (uv == 2) rna = true; if (uv == 1 || uv == 6) tate = true; } else if (xy == 5) { if (uv == 2 || uv == 3 || uv == 7) yoko = true; } else if (xy == 6) { if (uv == 3 || uv == 4 || uv == 8) tate = true; } else if (xy == 7) { if (uv == 1 || uv == 4 || uv == 5) yoko = true; } else if (xy == 8) { if (uv == 1 || uv == 2 || uv == 6) tate = true; } v.push_back({{x, y}, {u, v}}); } } if ((yoko && tate) || (lna && (yoko || tate)) || (rna && (yoko || tate))) cout << "NO" << endl; else cout << "YES" << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:71:27: error: request for member 'push_back' in 'v', which is of non-class type 'int' 71 | v.push_back({{x, y}, {u, v}}); | ^~~~~~~~~
s054466554
p03685
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(); int C = sc.nextInt(); int N = sc.nextInt(); ArrayList<Vertice> alist = new ArrayList<Vertice>(); ArrayList<Vertice> blist = new ArrayList<Vertice>(); ArrayList<Vertice> clist = new ArrayList<Vertice>(); ArrayList<Vertice> dlist = new ArrayList<Vertice>(); for(int i = 0; i < N; i++) { int x1 = sc.nextInt(); int y1 = sc.nextInt(); int x2 = sc.nextInt(); int y2 = sc.nextInt(); if(((x1 == 0) || (x1 == R) || (y1 == 0) || (y1 == C)) && ((x2 == 0) || (x2 == R) || (y2 == 0) || (y2 == C))) { Vertice v1 = new Vertice(i, x1, y1); Vertice v2 = new Vertice(i, x2, y2); if((x1 == 0) && (y1 < C)) alist.add(v1); if((x1 < R) && (y1 == C)) blist.add(v1); if((x1 == R) && (y1 > 0)) clist.add(v1); if((x1 > 0) && (y1 == 0)) dlist.add(v1); if((x2 == 0) && (y2 < C)) alist.add(v2); if((x2 < R) && (y2 == C)) blist.add(v2); if((x2 == R) && (y2 > 0)) clist.add(v2); if((x2 > 0) && (y2 == 0)) dlist.add(v2); } } Collections.sort(alist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice1.y - vertice2.y; } }); Collections.sort(blist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice2.x - vertice1.x; } }); Collections.sort(clist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice2.y - vertice1.y; } }); Collections.sort(dlist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice1.x - vertice2.x; } }); String ans = "YES"; Stack st = new Stack<Integer>(); int[] count = new int[N]; for(int i = 0; i < alist.size(); i++) { Vertice v = alist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < blist.size(); i++) { Vertice v = blist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < clist.size(); i++) { Vertice v = clist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < dlist.size(); i++) { Vertice v = dlist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } System.out.println(ans); } static class Vertice { int id; int x; int y; public Vertice(int id, int x, int y) { this.id = id; this.x = x; this.y = y; } } }
Main.java:61: error: incompatible types: Object cannot be converted to int int p = st.pop(); ^ Main.java:75: error: incompatible types: Object cannot be converted to int int p = st.pop(); ^ Main.java:89: error: incompatible types: Object cannot be converted to int int p = st.pop(); ^ Main.java:103: error: incompatible types: Object cannot be converted to int int p = st.pop(); ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 4 errors
s104429227
p03685
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(); int C = sc.nextInt(); int N = sc.nextInt(); ArrayList<Vertice> alist = new ArrayList<Vertice>(); ArrayList<Vertice> blist = new ArrayList<Vertice>(); ArrayList<Vertice> clist = new ArrayList<Vertice>(); ArrayList<Vertice> dlist = new ArrayList<Vertice>(); for(int i = 0; i < N; i++) { int x1 = sc.nextInt(); int y1 = sc.nextInt(); int x2 = sc.nextInt(); int y2 = sc.nextInt(); if(((x1 == 0) || (x1 == R) || (y1 == 0) || (y1 == C)) && ((x2 == 0) || (x2 == R) || (y2 == 0) || (y2 == C))) { Vertice v1 = new Vertice(i, x1, y1); Vertice v2 = new Vertice(i, x2, y2); if((x1 == 0) && (y1 < C)) alist.add(v1); if((x1 < R) && (y1 == C)) blist.add(v1); if((x1 == R) && (y1 > 0)) clist.add(v1); if((x1 > 0) && (y1 == 0)) dlist.add(v1); if((x2 == 0) && (y2 < C)) alist.add(v2); if((x2 < R) && (y2 == C)) blist.add(v2); if((x2 == R) && (y2 > 0)) clist.add(v2); if((x2 > 0) && (y2 == 0)) dlist.add(v2); } } Collections.sort(alist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice1.y - vertice2.y; } }); Collections.sort(blist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice2.x - vertice1.x; } }); Collections.sort(clist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice2.y - vertice1.y; } }); Collections.sort(dlist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice1.x - vertice2.x; } }); String ans = "YES"; Stack st = new Stack<Integer>(); int[] count = new int[N]; for(int i = 0; i < alist.size(); i++) { Vertice v = alist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < blist.size(); i++) { Vertice v = blist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < clist.size(); i++) { Vertice v = clist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < dlist.size(); i++) { Vertice v = dlist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } System.out.println(ans); } static class Vertice { int id; int x; int y; public Vertice(int id. int x, int y) { this.id = id; this.x = x; this.y = y; } } }
Main.java:119: error: <identifier> expected public Vertice(int id. int x, int y) { ^ Main.java:119: error: wrong receiver parameter name public Vertice(int id. int x, int y) { ^ Main.java:119: error: <identifier> expected public Vertice(int id. int x, int y) { ^ Main.java:119: error: ';' expected public Vertice(int id. int x, int y) { ^ 4 errors
s979455514
p03685
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(); int C = sc.nextInt(); int N = sc.nextInt(); ArrayList<Vertice> alist = new ArrayList<Vertice>(); ArrayList<Vertice> blist = new ArrayList<Vertice>(); ArrayList<Vertice> clist = new ArrayList<Vertice>(); ArrayList<Vertice> dlist = new ArrayList<Vertice>(); for(int i = 0; i < N; i++) { int x1 = sc.nextInt(); int y1 = sc.nextInt(); int x2 = sc.nextInt(); int y2 = sc.nextInt(); if(((x1 == 0) || (x1 == R) || (y1 == 0) || (y1 == C)) && ((x2 == 0) || (x2 == R) || (y2 == 0) || (y2 == C))) { Vertice v1 = new Vertice(i, x1, y1); Vertice v2 = new Vertice(i, x2, y2); if((x1 == 0) && (y1 < C)) alist.add(v1); if((x1 < R) && (y1 == C)) blist.add(v1); if((x1 == R) && (y1 > 0)) clist.add(v1); if((x1 > 0) && (y1 == 0)) dlist.add(v1); if((x2 == 0) && (y2 < C)) alist.add(v2); if((x2 < R) && (y2 == C)) blist.add(v2); if((x2 == R) && (y2 > 0)) clist.add(v2); if((x2 > 0) && (y2 == 0)) dlist.add(v2); } } Collections.sort(alist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice1.y - vertice2.y; } }); Collections.sort(blist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice2.x - vertice1.x; } }); Collections.sort(clist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice2.y - vertice1.y; } }); Collections.sort(dlist, new Comparator<Vertice>() { public int compare(Vertice vertice1, Vertice vertice2) { return vertice1.x - vertice2.x; } }); String ans = "YES"; Stack st = new Stack<Integer>(); int[] count = new int[N]; for(int i = 0; i < alist.size(); i++) { Vertice v = alist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < blist.size(); i++) { Vertice v = blist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < clist.size(); i++) { Vertice v = clist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } for(int i = 0; i < dlist.size(); i++) { Vertice v = dlist.get(i); if(count[v.id] == 0) { st.push(v.id); count[v.id]++; } else { int p = st.pop(); if(v.id != p) { ans = "NO"; break; } } } System.out.println(ans); } } static class Vertice { int id; int x; int y; public Vertice(int id. int x, int y) { this.id = id; this.x = x; this.y = y; } }
Main.java:120: error: <identifier> expected public Vertice(int id. int x, int y) { ^ Main.java:120: error: wrong receiver parameter name public Vertice(int id. int x, int y) { ^ Main.java:120: error: <identifier> expected public Vertice(int id. int x, int y) { ^ Main.java:120: error: ';' expected public Vertice(int id. int x, int y) { ^ 4 errors
s299417004
p03685
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; int R, C, N; struct Point { int x, y, id; }; vector<Point> P; Point st; ll cross(pii a, pii b) { return 1LL*a.first*b.second - 1LL*a.second*b.first; } ll ccw(Point a, Point b, Point c) { pii p = pii(b.x - a.x, b.y - a.y); pii q = pii(c.x - a.x, c.y - a.y); return cross(p, q); } bool cmp(Point a, Point b) { if(ccw(st, a, b)) return ccw(st, a, b) > 0; else return abs(a.x - st.x) + abs(a.y - st.y) < abs(b.x - st.x) + abs(b.y - st.y); } int main() { scanf("%d %d %d", &R, &C, &N); st = {2e9, 2e9, 2e9}; for(int i = 0; i < N; i++) { int x1, y1, x2, y2; scanf("%d %d %d %d", &x1, &y1, &x2, &y2); if((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) { P.push_back({x1, y1, i}); P.push_back({x2, y2, i}); } } if(P.size() == 0) { printf("YES"); return 0; } for(int i = 0; i < P.size(); i++) { if(st.y > P[i].y || (st.y == P[i].y && st.x > P[i].x)) { st = P[i]; } } sort(P.begin(), P.end(), cmp); stack<int> stk; for(int i = 0; i < P.size(); i++) { if(!stk.empty() && stk.top() == P[i].id) stk.pop(); else stk.push(P[i].id); } if(stk.empty()) printf("YES"); else printf("NO"); }
a.cc: In function 'int main()': a.cc:28:11: error: narrowing conversion of '2.0e+9' from 'double' to 'int' [-Wnarrowing] 28 | st = {2e9, 2e9, 2e9}; | ^~~
s454192946
p03685
C++
#include <bits/stdc++.h> #define fr(a, b, c) for(int a = b, __ = c; a < __; a++) #define dbg(x) cerr << ">>>>> " << x << endl; #define _ << " , " << #define X first #define Y second using namespace std; typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef long long ll; const ll inf = ll(1e9) + 7; const int ms = 1111111; struct Point{ ll x, y; int id; Point(ll x, ll y, int id):x(x), y(y), id(id){} ll operator%(Point &p) const { return x*p.y - y*p.x; } ll operator!(){ return x*x + y*y; } }; bool operator<(Point p1, Point p2){ ll pv = p1 % p2; ll pv = p1 % p2; if(pv == 0){ if(p1.y == 0) return !(p1) < !(p2); else return !(p1) > !(p2) } else{ return pv > 0; } } int mk[ms]; int main(){ ios::sync_with_stdio(0); int r, c, n; cin >> r >> c >> n; vector<Point> v; fr(i, 0, n){ int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2; bool b1 = x1 == 0 || x1 == r || y1 == 0 || y1 == c, b2 = x2 == 0 || x2 == r || y2 == 0 || y2 == c; if(b1 && b2){ v.push_back(Point(x1, y1, i)); v.push_back(Point(x2, y1, i)); } } sort(v.begin(), v.end()); bool ok = 1; stack<int> pilha; for(Point p : v){ if(mk[p.id]){ if(pilha.top() != p.id){ ok = 0; break; } pilha.pop(); } else{ mk[p.id] = 1; pilha.push(p.id); } } puts(ok ? "YES" : "NO"); return 0; }
a.cc: In function 'bool operator<(Point, Point)': a.cc:32:12: error: redeclaration of 'll pv' 32 | ll pv = p1 % p2; | ^~ a.cc:31:12: note: 'll pv' previously declared here 31 | ll pv = p1 % p2; | ^~ a.cc:37:37: error: expected ';' before '}' token 37 | return !(p1) > !(p2) | ^ | ; 38 | } | ~
s912590137
p03685
C++
#include <bits/stdc++.h> #define fr(a, b, c) for(int a = b, __ = c; a < __; a++) #define dbg(x) cerr << ">>>>> " << x << endl; #define _ << " , " << #define X first #define Y second using namespace std; typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef long long ll; const ll inf = ll(1e9) + 7; const int ms = 1111111; struct Point{ ll x, y; int id; Point(ll x, ll y, int id):x(x), y(y), id(id){} ll operator%(Point &p) const { return x*p.y - y*p.x; } ll operator!(){ return x*x + y*y; } }; bool operator<(Point p1, Point p2){ ll pv = p1 % p2; if(pv == 0){ return !(p1) < !(p2); } else{ return pv > 0; } } int mk int main(){ ios::sync_with_stdio(0); int r, c, n; cin >> r >> c >> n; vector<Point> v; fr(i, 0, n){ int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2; bool b1 = x1 == 0 || x1 == r || y1 == 0 || y1 == c, b2 = x2 == 0 || x2 == r || y2 == 0 || y2 == c; if(b1 && b2){ v.push_back(Point(x1, y1, i)); v.push_back(Point(x2, y1, i)); } } sort(v.begin(), v.end()); bool ok = 1; stack<int> pilha; for(Point p : v){ if(mk[p.id]){ if(pilha.top() != p.id){ ok = 0; break; } pilha.pop(); } else{ mk[p.id] = 1; pilha.push(p.id); } } puts(ok ? "YES" : "NO"); return 0; }
a.cc:42:1: error: expected initializer before 'int' 42 | int main(){ | ^~~
s844698575
p03685
C++
#include <iostream> #include <string> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include <set> #include <sstream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cctype> #include <climits> #include <list> #include <unordered_map> #include <utility> #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(),(x).end() using namespace std; int R,C,N; int length(int x,int y){ if(y==0){ return x; } if(x==0){ return 2*(R+C)-y; } if(x==R){ return R+y; } return 2*R+C-x; } bool comp(pair<int,int>& p1,pair<int,int>& p2){ return p1.first - p2.first; } int main() { cin>>R>>C>>N; pair<int,int> ; vector<pair<int,int>> border; REP(i,N){ int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; if ((x1%R==0||y1%C==0)&&(x2%R==0||y2%C==0)){ border.push_back(pair<int,int>(length(x1,y1),i+1));// [length(x1,y1)]=i+1; border.push_back(pair<int,int>(length(x2,y2),i+1)); } } sort(border.begin(),border.end(),comp); stack<int> pos; pos.push(-1); REP(i,border.size()) { if(pos.top()!=border[i].second){ pos.push(border[i].second); }else{ pos.pop(); } } if(pos.size()==1){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:44:5: error: declaration does not declare anything [-fpermissive] 44 | pair<int,int> ; | ^~~~~~~~~~~~~
s483754718
p03685
C++
#include <iostream> #include <string> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include <set> #include <sstream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cctype> #include <climits> #include <list> #include <unordered_map> #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(),(x).end() using namespace std; int R,C,N; int length(int x,int y){ if(y==0){ return x; } if(x==0){ return 2*(R+C)-y; } if(x==R){ return R+y; } return 2*R+C-x; } bool comp(pair<int,int>& p1,pair<int,int>& p2){ return p1.first - p2.first; } int main() { cin>>R>>C>>N; pair<int,int> ; vector<pair<int,int>> border; REP(i,N){ int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; if ((x1%R==0||y1%C==0)&&(x2%R==0||y2%C==0)){ border.push_back(pair<int,int>(length(x1,y1),i+1));// [length(x1,y1)]=i+1; border.push_back(pair<int,int>(length(x2,y2),i+1)); } } sort(border.begin(),border.end(),comp); stack<int> pos; pos.push(-1); REP(i,border.size()) { if(pos.top()!=border[i].second){ pos.push(border[i].second); }else{ pos.pop(); } } if(pos.size()==1){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:43:5: error: declaration does not declare anything [-fpermissive] 43 | pair<int,int> ; | ^~~~~~~~~~~~~
s944345718
p03685
Java
import java.io.*; import java.util.*; public class Main { private static Scanner sc; private static Printer pr; private static void solve() { int r = sc.nextInt(); int c = sc.nextInt(); int n = sc.nextInt(); int[] x1 = new int[n]; int[] y1 = new int[n]; int[] x2 = new int[n]; int[] y2 = new int[n]; List<Pair> xy = new ArrayList<>(); for (int i = 0; i < n; i++) { x1[i] = sc.nextInt(); y1[i] = sc.nextInt(); x2[i] = sc.nextInt(); y2[i] = sc.nextInt(); if ((x1[i] == 0 || x1[i] == r || y1[i] == 0 || y1[i] == c) && (x2[i] == 0 || x2[i] == r || y2[i] == 0 || y2[i] == c)) { int tmp1 = conv(x1[i], y1[i], r, c); int tmp2 = conv(x2[i], y2[i], r, c); if (tmp1 < tmp2) { xy.add(new Pair(tmp1, tmp2)); } else { xy.add(new Pair(tmp2, tmp1)); } } } Collections.sort(xy); Deque<Pair> st = new ArrayDeque<>(); for (Pair e : xy) { while (!st.isEmpty() && st.peek().b < e.a) { st.pop(); } if (!st.isEmpty() && st.peek().b < e.b) { pr.println("NO"); return; } st.push(e); } pr.println("YES"); } private static int conv(int x, int y, int r, int c) { if (y == 0) { return x; } else if (y == c) { return r + c + r - x; } else if (x == r) { return r + y; } else { return 2 * r + 2 * c - y; } } private static class Pair implements Comparable<Pair> { int a; int b; Pair(int a, int b) { this.a = a; this.b = b; } @Override public int compareTo(Pair o) { if (a == o.a) { return Integer.compare(b, o.b); } return Integer.compare(a, o.a); } @Override public int hashCode() { return Integer.hashCode(a); } @Override public String toString() { // [xxx, xxxx] StringBuilder stmp = new StringBuilder(32); stmp.append('['); stmp.append(a); stmp.append(','); stmp.append(' '); stmp.append(b); stmp.append(']'); return stmp.toString(); } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } private boolean isPrintable(int ch) { return ch >= '!' && ch <= '~'; } private boolean isCRLF(int ch) { return ch == '\n' || ch == '\r' || ch == -1; } private int nextPrintable() { try { int ch; while (!isPrintable(ch = br.read())) { if (ch == -1) { throw new NoSuchElementException(); } } return ch; } catch (IOException e) { throw new NoSuchElementException(); } } String next() { try { int ch = nextPrintable(); StringBuilder sb = new StringBuilder(); do { sb.appendCodePoint(ch); } while (isPrintable(ch = br.read())); return sb.toString(); } catch (IOException e) { throw new NoSuchElementException(); } } int nextInt() { try { // parseInt from Integer.parseInt() boolean negative = false; int res = 0; int limit = -Integer.MAX_VALUE; int radix = 10; int fc = nextPrintable(); if (fc < '0') { if (fc == '-') { negative = true; limit = Integer.MIN_VALUE; } else if (fc != '+') { throw new NumberFormatException(); } fc = br.read(); } int multmin = limit / radix; int ch = fc; do { int digit = ch - '0'; if (digit < 0 || digit >= radix) { throw new NumberFormatException(); } if (res < multmin) { throw new NumberFormatException(); } res *= radix; if (res < limit + digit) { throw new NumberFormatException(); } res -= digit; } while (isPrintable(ch = br.read())); return negative ? res : -res; } catch (IOException e) { throw new NoSuchElementException(); } } long nextLong() { try { // parseLong from Long.parseLong() boolean negative = false; long res = 0; long limit = -Long.MAX_VALUE; int radix = 10; int fc = nextPrintable(); if (fc < '0') { if (fc == '-') { negative = true; limit = Long.MIN_VALUE; } else if (fc != '+') { throw new NumberFormatException(); } fc = br.read(); } long multmin = limit / radix; int ch = fc; do { int digit = ch - '0'; if (digit < 0 || digit >= radix) { throw new NumberFormatException(); } if (res < multmin) { throw new NumberFormatException(); } res *= radix; if (res < limit + digit) { throw new NumberFormatException(); } res -= digit; } while (isPrintable(ch = br.read())); return negative ? res : -res; } catch (IOException e) { throw new NoSuchElementException(); } } float nextFloat() { return Float.parseFloat(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { try { int ch; while (isCRLF(ch = br.read())) { if (ch == -1) { throw new NoSuchElementException(); } } StringBuilder sb = new StringBuilder(); do { sb.appendCodePoint(ch); } while (!isCRLF(ch = br.read())); return sb.toString(); } catch (IOException e) { throw new NoSuchElementException(); } } void close() { try { br.close(); } catch (IOException e) { // throw new NoSuchElementException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } } q
Main.java:288: error: reached end of file while parsing q ^ 1 error
s080510484
p03685
C++
#include <iostream> #include <string> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <complex> #include <utility> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <bitset> #include <ctime> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <cassert> #include <cstddef> #include <iomanip> #include <numeric> #include <tuple> #include <sstream> #include <fstream> using namespace std; #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--) #define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--) #define DEBUG(C) cerr << #C << " = " << C << endl; using LL = long long; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<LL>; using VVL = vector<VL>; using VD = vector<double>; using VVD = vector<VD>; using PII = pair<int, int>; using PDD = pair<double, double>; using PLL = pair<LL, LL>; using VPII = vector<PII>; template<typename T> using VT = vector<T>; #define ALL(a) begin((a)), end((a)) #define RALL(a) rbegin((a)), rend((a)) #define SORT(a) sort(ALL((a))) #define RSORT(a) sort(RALL((a))) #define REVERSE(a) reverse(ALL((a))) #define MP make_pair #define FORE(a, b) for (auto &&a : (b)) #define FIND(s, e) ((s).find(e) != (s).end()) #define EB emplace_back template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;} template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;} const int INF = 1e9; const int MOD = INF + 7; const LL LLINF = 1e18; /** * Binary_Indexed_Tree(BIT) * Fenwick Tree * 1-indexed!!! */ template<typename T = int> class BIT { private: std::vector<T> bit; const int N; public: BIT() : N(-1) {} BIT(int n) : N(n), bit(n + 1, 0) {} //bit[point]にnum追加 void add(int point, T num) { assert(N != -1 && 0 <= point && point <= N); while (point <= N) { bit[point] += num; point += point & -point; } } //pointまでの値の和を返す T sum(int point) { assert(N != -1 && 0 <= point && point <= N); T res = 0; while (point > 0) { res += bit[point]; point -= point & -point; } return res; } //left から right の区間和 T sum(int left, int right) { return this->sum(right) - this->sum(left - 1); } }; const int MAX = 1e5 + 10; int R, C, N; LL x1[MAX], y1[MAX], x2[MAX], y2[MAX]; PLL xy1[MAX], xy2[MAX]; VT<int> xseg, yseg; map<int, int> xcomp, ycomp; BIT<int> bit(MAX); int main(void) { scanf("%d%d%d", &R, &C, &N); REP(i, N) { scanf("%lld%lld%lld%lld", x1 + i, y1 + i, x2 + i, y2 + i); xy1[i] = MP(x1[i], y1[i]); xy2[i] = MP(x2[i], y2[i]); if ((x1[i] == 0 && x2[i] == R) ||(x2[i] == 0 && x1[i] == R)) { xseg.EB(i); } if ((y1[i] == 0 && y2[i] == C) ||(y2[i] == 0 && y1[i] == C)) { yseg.EB(i); } } set<int> xse, yse; REP(i, N) { xse.insert(x1[i]); xse.insert(x2[i]); yse.insert(y1[i]); yse.insert(y2[i]); } int cnt = 0; FORE(e, xse) { xcomp[e] = ++cnt; } cnt = 0; FORE(e, yse) { ycomp[e] = ++cnt; } if (!xseg.empty()&& !yseg.empty()) { cout << "NO" << endl; return 0; } if (!xseg.empty()) { FORE(e, xseg) { bit.add(ycomp[y1[e]], 1); bit.add(ycomp[y2[e]] + 1, -1); } FORE(e, xseg) { if (bit.sum(ycomp[y1[e]]) != bit.sum(ycomp[y2[e]])) { cout << "NO" << endl; return 0; } } } else if (!yseg.empty()) { FORE(e, yseg) { bit.add(xcomp[x1[e]], 1); bit.add(xcomp[x2[e]] + 1, -1); } FORE(e, yseg) { if (bit.sum(xcomp[x1[e]]) != bit.sum(xcomp[x2[e]])) { cout << "NO" << endl; return 0; } } } cout << "YES" << endl; }
a.cc:102:19: error: 'LL y1 [100010]' redeclared as different kind of entity 102 | LL x1[MAX], y1[MAX], x2[MAX], y2[MAX]; | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:111:46: warning: pointer to a function used in arithmetic [-Wpointer-arith] 111 | scanf("%lld%lld%lld%lld", x1 + i, y1 + i, x2 + i, y2 + i); | ~~~^~~ a.cc:112:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 112 | xy1[i] = MP(x1[i], y1[i]); | ^ a.cc:112:33: error: no match for 'operator=' (operand types are 'PLL' {aka 'std::pair<long long int, long long int>'} and 'std::pair<long long int, double (*)(double) noexcept>') 112 | xy1[i] = MP(x1[i], y1[i]); | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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: /usr/include/c++/14/bits/stl_pair.h:946:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U2 = _U1; _T1 = long long int; _T2 = long long int]' 946 | operator=(const pair<_U1, _U2>& __p) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:946:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h: In substitution of 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<long long int&, const _U1&>, std::is_assignable<long long int&, const _U2&> >::value, std::pair<long long int, long long int>&>::type std::pair<long long int, long long int>::operator=(const std::pair<_T1, _T2>&) [with _U1 = long long int; _U2 = double (*)(double) noexcept]': a.cc:112:33: required from here 112 | xy1[i] = MP(x1[i], y1[i]); | ^ /usr/include/c++/14/bits/stl_pair.h:946:9: error: no type named 'type' in 'struct std::enable_if<false, std::pair<long long int, long long int>&>' 946 | operator=(const pair<_U1, _U2>& __p) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:957:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U2 = _U1; _T1 = long long int; _T2 = long long int]' 957 | operator=(pair<_U1, _U2>&& __p) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:957:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h: In substitution of 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<long long int&, _U1&&>, std::is_assignable<long long int&, _U2&&> >::value, std::pair<long long int, long long int>&>::type std::pair<long long int, long long int>::operator=(std::pair<_T1, _T2>&&) [with _U1 = long long int; _U2 = double (*)(double) noexcept]': a.cc:112:33: required from here 112 | xy1[i] = MP(x1[i], y1[i]); | ^ /usr/include/c++/14/bits/stl_pair.h:957:9: error: no type named 'type' in 'struct std::enable_if<false, std::pair<long long int, long long int>&>' 957 | operator=(pair<_U1, _U2>&& __p) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:921:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&>) [with _T1 = long long int; _T2 = long long int; std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&> = const std::pair<long long int, long long int>&]' 921 | operator=(__conditional_t<__and_<is_copy_assignable<_T1>, | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:923:65: note: no known conversion for argument 1 from 'std::pair<long long int, double (*)(double) noexcept>' to 'std::__conditional_t<true, const std::pair<long long int, long long int>&, const std::__nonesuch&>' {aka 'const std::pair<long long int, long long int>&'} 921 | operator=(__conditional_t<__and_<is_copy_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | is_copy_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 923 | const pair&, const __nonesuch&> __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_pair.h:931:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&>) [with _T1 = long long int; _T2 = long long int; std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&> = std::pair<long long int, long long int>&&]' 931 | operator=(__conditional_t<__and_<is_move_assignable<_T1>, | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:933:55: note: no known conversion for argument 1 from 'std::pair<long long int, double (*)(double) noexcept>' to 'std::__conditional_t<true, std::pair<long long int, long long int>&&, std::__nonesuch&&>' {aka 'std::pair<long long int, long long int>&&'} 931 | operator=(__conditional_t<__and_<is_move_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932 | is_move_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 933 | pair&&, __nonesuch&&> __p) | ~~~~~~~~~~~~~~~~~~~~~~^~~ a.cc:117:18: warning: pointer to a function used in arithmetic [-Wpointer-arith] 117 | if ((y1[i] == 0 && y2[i] == C) ||(y2[i] == 0 && y1[i] == C)) { | ^ a.cc:117:61: warning: pointer to a function used in arithmetic [-Wpointer-arith] 117 | if ((y1[i] == 0 && y2[i] == C) ||(y2[i] == 0 && y1[i] == C)) { | ^ a.cc:117:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 117 | if ((y1[i] == 0 && y2[i] == C) ||(y2[i] == 0 && y1[i] == C)) { | ~~~~~~^~~~ a.cc:125:24: warning: pointer to a function used in arithmetic [-Wpointer-arith] 125 | yse.insert(y1[i]); | ^ a.cc:125:19: error: no matching function for call to 'std::set<int>::insert(double (&)(double) noexcept)' 125 | yse.insert(y1[i]); | ~~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/set:63, from a.cc:19: /usr/include/c++/14/bits/stl_set.h:511:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<int>, int>::rebind<int>; typename _Alloc::value_type = int; value_type = int]' (near match) 511 | insert(const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:511:7: note: conversion of argument 1 would be ill-formed: a.cc:125:24: error: invalid conversion from 'double (*)(double) noexcept' to 'std::set<int>::value_type' {aka 'int'} [-fpermissive] 125 | yse.insert(y1[i]); | ~~~~^ | | | double (*)(double) noexcept /usr/include/c++/14/bits/stl_set.h:520:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std
s541735989
p03685
C++
// if both points not on the edge, it doesn't matter // what if both points on the same edge #include <stdio.h> #include <algorithm> #include <utility> #include <map> int t1,t2; int r,c,n; int xa[100005]; int ya[100005]; // int 'y1' redeclared as ... int xb[100005]; int yb[100005]; std::pair<int,int> e[100005]; int e2; std::map<int,int> take; // for stuff on the same edge std::map<int,int>::iterator it; void swapp(int u) { std::swap(xa[u],xb[u]); std::swap(ya[u],yb[u]); } bool work() { // get edge stuff connected to (0,x) e2=0; take.clear(); for (int i=0; i<n; i++) { if (xb[i]==0) swapp(i); if (xa[i]==0) { if (xb[i]==0) { // same edge if (xa[i]<xb[i]) swapp(i); take[xb[i]]=xa[i]; } else if (yb[i]==0) { // edge 1 e[e2++]={ya[i],xb[i]}; } else if (xb[i]==r) { // edge 2 e[e2++]={ya[i],yb[i]+150000000}; } else if (yb[i]==c) { // edge 3 e[e2++]={ya[i],450000000-xb[i]}; } } } // check std::sort(e,e+e2); //printf("e2 %d\n",e2); for (int i=0; i<e2; i++) printf("edge %d %d\n",e[i]); for (int i=1; i<e2; i++) { if (e[i-1].second>e[i].second) { return 0; } } for (int i=0; i<e2; i++) { it=take.lower_bound(e[i].first); if (it!=take.end() && it->second<e[i].first) { return 0; } } it=take.begin(); t1=take->first; t2=take->second; for (++it; it!=take.end(); ++it) { // check overlap // overlap is sequence t2 take->second t1 take->first if (t2<take->second && take->second<t1) return 0; t1=take->first; t2=take->second; } return 1; } int main() { #ifdef NOT_DMOJ freopen("data.txt","r",stdin); #endif // NOT_DMOJ scanf("%d%d%d",&r,&c,&n); for (int i=0; i<n; i++) { scanf("%d%d%d%d",xa+i,ya+i,xb+i,yb+i); } // do rotations for (int asdf=0; asdf<4; asdf++) { if (!work()) { printf("NO"); return 0; } //return 0; // rotate 90 deg for (int i=0; i<n; i++) { t1=c-ya[i]; t2=xa[i]; xa[i]=t1; ya[i]=t2; t1=c-yb[i]; t2=xb[i]; xb[i]=t1; yb[i]=t2; } std::swap(r,c); } printf("YES"); }
a.cc: In function 'bool work()': a.cc:71:12: error: base operand of '->' has non-pointer type 'std::map<int, int>' 71 | t1=take->first; | ^~ a.cc:72:12: error: base operand of '->' has non-pointer type 'std::map<int, int>' 72 | t2=take->second; | ^~ a.cc:76:20: error: base operand of '->' has non-pointer type 'std::map<int, int>' 76 | if (t2<take->second && take->second<t1) return 0; | ^~ a.cc:76:36: error: base operand of '->' has non-pointer type 'std::map<int, int>' 76 | if (t2<take->second && take->second<t1) return 0; | ^~ a.cc:77:16: error: base operand of '->' has non-pointer type 'std::map<int, int>' 77 | t1=take->first; | ^~ a.cc:78:16: error: base operand of '->' has non-pointer type 'std::map<int, int>' 78 | t2=take->second; | ^~
s350327392
p03685
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define rep(i,a,b) for(ll i=a;i<=b;++i) #define rev(i,a,b) for(ll i=a;i>=b;i--) #define pll pair<ll,ll> #define vll vector<ll> #define sll set<ll> #define vpll vector<pll> #define F first #define S second #define pb push_back #define mp make_pair #define ln length() #define M 1000000007 ll r,c,n; vector<pair<pll,pll> >lines; // Given three colinear points p, q, r, the function checks if // point q lies on line segment 'pr' bool onSegment(pll p, pll q, pll r) { if (q.F <= max(p.F, r.F) && q.F >= min(p.F, r.F) && q.S <= max(p.S, r.S) && q.S >= min(p.S, r.S)) return true; return false; } // To find orientation of ordered triplet (p, q, r). // The function returns following values // 0 --> p, q and r are colinear // 1 --> Clockwise // 2 --> Counterclockwise ll orientation(pll p, pll q, pll r) { // See http://www.geeksforgeeks.org/orientation-3-ordered-points/ // for details of below formula. int val = (q.S - p.S) * (r.F - q.F) - (q.F - p.F) * (r.S - q.S); if (val == 0) return 0; // colinear return (val > 0)? 1: 2; // clock or counterclock wise } // The main function that returns true if line segment 'p1q1' // and 'p2q2' intersect. bool intersect(pll p1, pll q1, pll p2, pll q2) { // Find the four orientations needed for general and // special cases ll o1 = orientation(p1, q1, p2); ll o2 = orientation(p1, q1, q2); ll o3 = orientation(p2, q2, p1); ll o4 = orientation(p2, q2, q1); // General case if (o1 != o2 && o3 != o4) return true; // Special Cases // p1, q1 and p2 are colinear and p2 lies on segment p1q1 if (o1 == 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are colinear and q2 lies on segment p1q1 if (o2 == 0 && onSegment(p1, q2, q1)) return true; // p2, q2 and p1 are colinear and p1 lies on segment p2q2 if (o3 == 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and q1 are colinear and q1 lies on segment p2q2 if (o4 == 0 && onSegment(p2, q1, q2)) return true; return false; // Doesn't fall in any of the above cases } bool check(){ vector<pair<pll,ll> > pts; map<pll,pll> getright,getleft; for(auto xp:lines) pts.pb(mp(xp.F,1)),pts.pb(mp(xp.S,2)),getright[xp.F]=xp.S,getleft[xp.S]=xp.F; sort(pts.begin(),pts.end()); set<pair<ll,pair<pll,pll> > > active; for(auto xp:pts){ if(xp.S == 1){ pll xpr = getright[xp.F]; pair<pll,pll> line = mp(xp.F,xpr); ll yc = xp.F.S; active.insert(mp(yc,line)); auto it = active.lower_bound(mp(yc,line))); it++; if(it!=active.end()){ auto idk = *it; pair<pll,pll> line2 = idk.S; if(intersect(line2.F,line2.S,line.F,line.S)) return false; } it--; if(it!=active.begin()){ it--; auto idk = *it; pair<pll,pll> line2 = idk.S; if(intersect(line2.F,line2.S,line.F,line.S)) return false; } } else{ pll xpl = getleft[xp.F]; pair<pll,pll> line = mp(xpl,xp.F); ll yc = xpl.S; active.erase(mp(yc,line)); auto it = active.lower_bound(mp(yc,line)); if(it==active.end() || it == active.begin()) continue; auto idk = *it; pair<pll,pll> line2 = idk.S; it--; auto idk2 = *it; pair<pll,pll> line3 = idk2.S; if(intersect(line2.F,line2.S,line3.F,line3.S)) return false; } } return true; } int main(){ ios::sync_with_stdio(false);cin.tie(0); cin>>r>>c>>n; rep(i,1,n){ ll a1,b1,a2,b2;cin>>a1>>b1>>a2>>b2; if(a1 == 0 && a2!=0 && (a2 == r || b2 == 0 || b2 == c)) lines.pb(mp(mp(a1,b1),mp(a2,b2))); else if(a1 == r && a2!=r && (a2 == 0 || b2 == 0 || b2 == c)) lines.pb(mp(mp(a1,b1),mp(a2,b2))); else if(b1 == 0 && b2!=0 && (b2 == c || a2 == 0 || a2 == r)) lines.pb(mp(mp(a1,b1),mp(a2,b2))); else if(b1 == c && b2!=c && (b2 == 0 || a2 == 0 || a2 == r)) lines.pb(mp(mp(a1,b1),mp(a2,b2))); } if(lines.size()<=1){ cout<<"YES"<<endl; return 0; } n=lines.size(); if(check()) cout<<"YES"<<endl; else cout<<"NO"<<endl; }
a.cc: In function 'bool check()': a.cc:94:54: error: expected ',' or ';' before ')' token 94 | auto it = active.lower_bound(mp(yc,line))); | ^
s114231549
p03685
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; using i64 = int64_t; int R, C, N; i64 get_ord(i64 x, i64 y) { if (y == 0) { return x; } else if (y == C) { return R + C + R - x; } else if (x == 0) { return R + C + R + C - y; } return R + y; } int main() { cin.tie(0); ios::sync_with_stdio(false); vector<pair<i64, i64> > ls, ks; cin >> R >> C >> N; for (int j = 0; j < N; ++j) { i64 x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if ((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) { i64 o1 = get_ord(x1, y1), o2 = get_ord(x2, y2); ls.emplace_back(min(o1, o2), max(o1, o2)); ks.emplace_back(max(o1, o2), min(o1, o2)); } } sort(begin(ls), end(ls)); sort(begin(ks), end(ks)); for (int j = 0; j < (int)ls.size() - 1; ++j) { vector<pair<i64, i64>>::iterator p = lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); i64 v1 = (ls[j].first - p->second) * (ls[j].first - p->first); i64 v2 = (ls[j].second - p->second) * (ls[j].second - p->first); if (v1 * v2 < 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long int, long int>*, std::vector<std::pair<long int, long int> > >; _Value = const std::pair<long int, long long int>]': /usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]' 1504 | if (__comp(__middle, __val)) | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>]' 1539 | return std::__lower_bound(__first, __last, __val, | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 1540 | __gnu_cxx::__ops::__iter_less_val()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:63:57: required from here 63 | vector<pair<i64, i64>>::iterator p = lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long int, long int>' and 'const std::pair<long int, long long int>') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long int' and 'long long int') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from a.cc:2: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_C
s096009949
p03685
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; using i64 = int64_t; int R, C, N; i64 get_ord(i64 x, i64 y) { if (y == 0) { return x; } else if (y == C) { return R + C + R - x; } else if (x == 0) { return R + C + R + C - y; } return R + y; } int main() { cin.tie(0); ios::sync_with_stdio(false); vector<pair<i64, i64> > ls, ks; cin >> R >> C >> N; for (int j = 0; j < N; ++j) { i64 x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if ((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) { i64 o1 = get_ord(x1, y1), o2 = get_ord(x2, y2); ls.emplace_back(min(o1, o2), max(o1, o2)); ks.emplace_back(max(o1, o2), min(o1, o2)); } } sort(begin(ls), end(ls)); sort(begin(ks), end(ks)); for (int j = 0; j < (int)ls.size() - 1; ++j) { pair<i64, i64> p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); i64 v1 = (ls[j].first - p.second) * (ls[j].first - p.first); i64 v2 = (ls[j].second - p.second) * (ls[j].second - p.first); if (v1 * v2 < 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long int, long int>*, std::vector<std::pair<long int, long int> > >; _Value = const std::pair<long int, long long int>]': /usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]' 1504 | if (__comp(__middle, __val)) | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>]' 1539 | return std::__lower_bound(__first, __last, __val, | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 1540 | __gnu_cxx::__ops::__iter_less_val()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:63:40: required from here 63 | pair<i64, i64> p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long int, long int>' and 'const std::pair<long int, long long int>') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long int' and 'long long int') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from a.cc:2: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 390
s688202555
p03685
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; using i64 = int64_t; int R, C, N; i64 get_ord(i64 x, i64 y) { if (y == 0) { return x; } else if (y == C) { return R + C + R - x; } else if (x == 0) { return R + C + R + C - y; } return R + y; } vector<pair<i64, i64> > ls, za; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> R >> C >> N; for (int j = 0; j < N; ++j) { i64 x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if ((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) { i64 o1 = get_ord(x1, y1), o2 = get_ord(x2, y2); ls.emplace_back(min(o1, o2), max(o1, o2)); za.emplace_back(max(o1, o2), min(o1, o2)); } } sort(begin(ls), end(ls)); for (int j = 0; j < (int)ls.size() - 1; ++j) { pair<i64, i64> p = *lower_bound(begin(za), end(za), make_pair(ls[j].second, 1LL<<60)); i64 v1 = (ls[j].first - p.second) * (ls[j].first - p.first); i64 v2 = (ls[j].second - p.second) * (ls[j].second - p.first); if (v1 * v2 < 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long int, long int>*, std::vector<std::pair<long int, long int> > >; _Value = const std::pair<long int, long long int>]': /usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]' 1504 | if (__comp(__middle, __val)) | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>]' 1539 | return std::__lower_bound(__first, __last, __val, | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 1540 | __gnu_cxx::__ops::__iter_less_val()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:62:40: required from here 62 | pair<i64, i64> p = *lower_bound(begin(za), end(za), make_pair(ls[j].second, 1LL<<60)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long int, long int>' and 'const std::pair<long int, long long int>') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long int' and 'long long int') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from a.cc:2: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 390
s761572080
p03685
C++
#include<set> #include<map> #include<queue> #include<cmath> #include<string> #include<cstdio> #include<vector> #include<cassert> #include<cstring> #include<iostream> #include<algorithm> #define rep(i,a,b) for (int i=a; i<=b; i++) #define per(i,a,b) for (int i=a; i>=b; i--) #define debug(x) {cout<<(#x)<<" "<<x<<endl;} using namespace std; typedef long long LL; inline int read() { int x=0,f=1; char ch=getchar(); while (!(ch>='0'&&ch<='9')) {if (ch=='-')f=-1;ch=getchar();} while (ch>='0'&&ch<='9') {x=x*10+(ch-'0'); ch=getchar();} return x*f; } const int N = 100005; int n,R,C; int tot=0; struct seg { int l,r; } a[N]; inline bool cmp(const seg&a,const seg&b) {if (a.l==b.l) return a.r<b.r; return a.l<b.l;} inline bool onSide(int x,int y) { return (x==0)||(y==0)||(x==R)||(y==C); } inline int G(int x,int y) { if (x==0) return y; if (y==C) return C+x; if (x==R) return C+R+C-y; return C+R+C+R-x; } inline seg getseg(int x1,int y1,int x2,int y2) { seg ret; int l=G(x1,y1),r=G(x2,y2); if (l>r)swap(l,r); ret.l=l,ret.r=r; return ret; } int main() { #ifndef ONLINE_JUDGE // freopen("data.in","r",stdin); // freopen("data.out","w",stdout); #endif R=read(),C=read(),n=read(); rep(i,1,n) { int x1=read(),y1=read(),x2=read(),y2=read(); if(onSide(x1,y1)&&onSide(x2,y2)) { a[++tot]=getseg(x1,y1,x2,y2); } } sort(a+1,a+tot+1,cmp); bool flag=1,rmost=-1; rep(i,2,tot) { if (a[i].l<=rmost&&a[i].r>=rmost) flag=0; rmost=max(rmost,a[i].r); } if (flag) puts("YES"); else puts("NO"); return 0; }
a.cc: In function 'int main()': a.cc:74:26: error: no matching function for call to 'max(bool&, int&)' 74 | rmost=max(rmost,a[i].r); | ~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/set: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:74:26: note: deduced conflicting types for parameter 'const _Tp' ('bool' and 'int') 74 | rmost=max(rmost,a[i].r); | ~~~^~~~~~~~~~~~~~ /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:11: /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:74:26: note: mismatched types 'std::initializer_list<_Tp>' and 'bool' 74 | rmost=max(rmost,a[i].r); | ~~~^~~~~~~~~~~~~~
s675205503
p03685
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; using i64 = int64_t; int R, C, N; i64 get_ord(i64 x, i64 y) { if (y == 0) { return x; } else if (y == C) { return R + C + R - x; } else if (x == 0) { return R + C + R + C - y; } return R + y; } vector<pair<i64, i64> > ls, ks; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> R >> C >> N; for (int j = 0; j < N; ++j) { i64 x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if ((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) { i64 o1 = get_ord(x1, y1), o2 = get_ord(x2, y2); ls.emplace_back(min(o1, o2), max(o1, o2)); ks.emplace_back(max(o1, o2), min(o1, o2)); } } sort(begin(ls), end(ls)); for (int j = 0; j < (int)ls.size() - 1; ++j) { pair<i64, i64> p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); i64 v1 = (ls[j].first - p.second) * (ls[j].first - p.first); i64 v2 = (ls[j].second - p.second) * (ls[j].second - p.first); if (v1 * v2 < 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long int, long int>*, std::vector<std::pair<long int, long int> > >; _Value = const std::pair<long int, long long int>]': /usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]' 1504 | if (__comp(__middle, __val)) | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>]' 1539 | return std::__lower_bound(__first, __last, __val, | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 1540 | __gnu_cxx::__ops::__iter_less_val()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:62:40: required from here 62 | pair<i64, i64> p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long int, long int>' and 'const std::pair<long int, long long int>') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long int' and 'long long int') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from a.cc:2: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 390
s239906915
p03685
C++
#include <bits/stdc++.h> using namespace std; static const int N = 1e5 + 4; static const int LN = 19; int mx, my, n; inline int get_point(int x, int y) { if (y == 0) return x; if (x == mx) return mx + y; if (y == my) return mx + my + (mx - x); if (x == 0) return mx + my + mx + (my - y); return -1; } inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } typedef pair<int, int> num; vector<num> c; map<int, int> dis; int a[N * 2]; struct rmq { int min[LN][N * 2], max[LN][N * 2]; inline void build(int n, int *a) { for (int i = 0; i < n; i ++) min[0][i] = max[0][i] = a[i]; for (int j = 1; j < LN; j ++) for (int i = 0; i < n - (1 << j); i ++) { max[j][i] = max(max[j - 1][i], max[j - 1][i + (1 << (j - 1))]); min[j][i] = min(min[j - 1][i], min[j - 1][i + (1 << (j - 1))]); } } inline pair<int, int> query(int l, int r) { if (l == r) return make_pair(min[0][l], max[0][l]); int sz = 8 * sizeof(int) - __builtin_clz(r - l) - 1; return make_pair ( min(min[sz][l], min[sz][r - (1 << sz) + 1]), max(max[sz][l], max[sz][r - (1 << sz) + 1]) ); } }rmq; int main() { mx = read(); my = read(); n = read(); for (int i = 0, x1, y1, x2, y2; i < n; ++i) { scanf("%d%d%d%d", &x1, &y1, &x2, &y2); int p1 = get_point(x1, y1), p2 = get_point(x2, y2); if (p1 != -1 && p2 != -1) { if (p1 > p2) swap(p1, p2); c.push_back(num(p1, p2)); dis.insert(make_pair(p1, 0)); dis.insert(make_pair(p2, 0)); } } int ct = 0; for (auto &kv : dis) kv.second = ct++; for (auto &p : c) { p.first = dis[p.first], p.second = dis[p.second]; a[p.first] = p.second; a[p.second] = p.first; } rmq.build(ct, a); sort(c.begin(), c.end()); for (auto p : c) if (p.second >= p.first + 2) { auto val = rmq.query(p.first + 1, p.second - 1); if (val.first < p.first || val.second > p.second) { puts("NO"); return 0; } } puts("YES"); return 0; }
a.cc: In member function 'void rmq::build(int, int*)': a.cc:40:32: error: expression cannot be used as a function 40 | max[j][i] = max(max[j - 1][i], max[j - 1][i + (1 << (j - 1))]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:41:32: error: expression cannot be used as a function 41 | min[j][i] = min(min[j - 1][i], min[j - 1][i + (1 << (j - 1))]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc: In member function 'std::pair<int, int> rmq::query(int, int)': a.cc:50:16: error: expression cannot be used as a function 50 | min(min[sz][l], min[sz][r - (1 << sz) + 1]), | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:51:16: error: expression cannot be used as a function 51 | max(max[sz][l], max[sz][r - (1 << sz) + 1]) | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s922620601
p03685
C++
#include <cstdio> #include <cstring> #include <vector> #include <queue> #include <string> #include <algorithm> #include <iostream> #include <string> #include <map> #include <set> #include <functional> #include <iostream> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int,int> P; int r,c,n; bool flag[2]; P p[2]; vector<int> xt; vector<int> pt; int main(void){ scanf("%d%d%d",&r,&c,&n); bool res=true; for(int i=0;i<n;i++){ scanf("%d%d",&p[0].first,&p[0].second); scanf("%d%d",&p[1].first,&p[1].second); if(abs(p[0].first-p[1].first)==r){ if(p[0].first>p[1].first)swap(p[0],p[1]); if(abs(p[0].second-p[1].second)==c){ if(flag[0] || flag[1])res=false; flag[0]=true; flag[1]=true; xt.push_back(P(p[0].second,p[1].second)); if(p[0].second>p[1].second)swap(p[0],p[1]); yt.push_back(P(p[0].first,p[1].first)); }else{ if(flag[1])res=false; flag[0]=true; xt.push_back(P(p[0].second,p[1].second)); } }else if(abs(p[0].second-p[1].second)==c){ if(p[0].second>p[1].second)swap(p[0],p[1]); if(flag[0])res=false; flag[1]=true; yt.push_back(P(p[0].first,p[1].first)); } } sort(xt.begin(),xt.end()); sort(yt.begin(),yt.end()); for(int i=0;i<(int)xt.size()-1;i++){ if(xt[i].second>xt[i+1].second)res=false; } for(int i=0;i<(int)yt.size()-1;i++){ if(yt[i].second>yt[i+1].second)res=false; } printf("%s\n",res?"YES":"NO"); return 0; }
a.cc: In function 'int main()': a.cc:36:45: error: no matching function for call to 'std::vector<int>::push_back(P)' 36 | xt.push_back(P(p[0].second,p[1].second)); | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'P' {aka 'std::pair<int, int>'} to 'const std::vector<int>::value_type&' {aka 'const int&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'P' {aka 'std::pair<int, int>'} to 'std::vector<int>::value_type&&' {aka 'int&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:38:33: error: 'yt' was not declared in this scope; did you mean 'xt'? 38 | yt.push_back(P(p[0].first,p[1].first)); | ^~ | xt a.cc:42:45: error: no matching function for call to 'std::vector<int>::push_back(P)' 42 | xt.push_back(P(p[0].second,p[1].second)); | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'P' {aka 'std::pair<int, int>'} to 'const std::vector<int>::value_type&' {aka 'const int&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'P' {aka 'std::pair<int, int>'} to 'std::vector<int>::value_type&&' {aka 'int&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:48:25: error: 'yt' was not declared in this scope; did you mean 'xt'? 48 | yt.push_back(P(p[0].first,p[1].first)); | ^~ | xt a.cc:52:14: error: 'yt' was not declared in this scope; did you mean 'xt'? 52 | sort(yt.begin(),yt.end()); | ^~ | xt a.cc:54:26: error: request for member 'second' in 'xt.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 54 | if(xt[i].second>xt[i+1].second)res=false; | ^~~~~~ a.cc:54:41: error: request for member 'second' in 'xt.std::vector<int>::operator[](((std::vector<int>::size_type)(i + 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 54 | if(xt[i].second>xt[i+1].second)res=false; | ^~~~~~
s350235978
p03685
C++
#include <iostream> #include <string> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <complex> #include <utility> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <bitset> #include <ctime> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <cassert> #include <cstddef> #include <iomanip> #include <numeric> #include <tuple> #include <sstream> #include <fstream> using namespace std; #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--) #define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--) #define DEBUG(C) cerr << #C << " = " << C << endl; using LL = long long; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<LL>; using VVL = vector<VL>; using VD = vector<double>; using VVD = vector<VD>; using PII = pair<int, int>; using PDD = pair<double, double>; using PLL = pair<LL, LL>; using VPII = vector<PII>; template<typename T> using VT = vector<T>; #define ALL(a) begin((a)), end((a)) #define RALL(a) rbegin((a)), rend((a)) #define SORT(a) sort(ALL((a))) #define RSORT(a) sort(RALL((a))) #define REVERSE(a) reverse(ALL((a))) #define MP make_pair #define FORE(a, b) for (auto &&a : (b)) #define FIND(s, e) ((s).find(e) != (s).end()) #define EB emplace_back template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;} template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;} const int INF = 1e9; const int MOD = INF + 7; const LL LLINF = 1e18; namespace Geometry2D { const double EPS = 1e-10; double add(double a, double b) { if (abs(a + b) < Geometry2D::EPS * (abs(a) + abs(b))) return 0; return a + b; } int sgn(double a, double b = 0.0) {// sign function return a < b - EPS ? -1 : a > b + EPS ? 1 : 0; } struct Point {//二次元座標 double x, y; Point() {} Point(double _x, double _y) : x(_x), y(_y) {} const Geometry2D::Point operator+ (const Geometry2D::Point p) { return Point(Geometry2D::add(this->x, p.x), Geometry2D::add(this->y, p.y)); } const Geometry2D::Point operator- (const Geometry2D::Point p) { return Point(Geometry2D::add(this->x, -p.x), Geometry2D::add(this->y, -p.y)); } const Geometry2D::Point operator* (double d) { return Point(this->x * d, this->y * d); } }; struct Line { Geometry2D::Point a, b, dis; Line() {} Line(const Geometry2D::Point &_a, const Geometry2D::Point &_b) : a(_a), b(_b), dis(b - a) {} double distSquare() { //距離の二乗 return (this->a.x - this->b.x) * (this->a.x - this->b.x) + (this->a.y - this->b.y) * (this->a.y - this->b.y); } double distance() { return sqrt(this->distSquare()); } }; double naiseki(const Geometry2D::Point &p1, const Geometry2D::Point &p2) { return Geometry2D::add(p1.x * p2.x, p1.y * p2.y); } double gaiseki(const Geometry2D::Point &p1, const Geometry2D::Point &p2) { return Geometry2D::add(p1.x * p2.y, -p1.y * p2.x); } Point intersection(Geometry2D::Line &l1, Geometry2D::Line &l2) {//p1-p2とq1-q2の交点 auto buf = (l1.b - l1.a); return l1.a + buf * (gaiseki(l2.b - l2.a, l2.a - l1.a) / gaiseki(l2.b - l2.a, l1.b - l1.a)); } bool on_seg(Geometry2D::Point &p, Geometry2D::Line &l) {//線分l上にこの点pがあるか return Geometry2D::sgn(Geometry2D::gaiseki((l.a - p), (l.b - p))) == 0 && Geometry2D::naiseki(l.a - p, l.b - p) <= 0; } bool isIntersect(Geometry2D::Line &l1, Geometry2D::Line &l2) { // l1とl2が交差してるか Point intersect = intersection(l1, l2); return on_seg(intersect, l1) && on_seg(intersect, l2); } struct Circle {//円 double r;//半径 Point center;//中心座標 Circle() {} Circle(double _x, double _y, double _r) : r(_r), center(_x, _y) {} Circle(const Point &_p, double _r) : r(_r), center(_p) {} bool inside(Point &p) {//円内部に居るか(円周含まない) return Geometry2D::sgn(Geometry2D::add(Geometry2D::Line(p, this->center).distSquare(), -(this->r * this->r))) == -1; } bool on_seg(Point &p) {//円周上に居るか return Geometry2D::sgn(Geometry2D::add(Geometry2D::Line(p, this->center).distSquare(), -(this->r * this->r))) == 0; } double square() { return this->r * this->r * acos(-1.0); } }; }; using namespace Geometry2D; const int MAX = 1e5 + 10; int R, C, N; LL x1[MAX], y1[MAX], x2[MAX], y2[MAX]; PPL xy1[MAX], xy2[MAX]; VT<int> xseg, yseg; BIT bit<LL>(MAX); map<int, int> xcomp, ycomp; int main(void) { scanf("%d%d%d", &R, &C, &N); REP(i, N) { scanf("%lld%lld%lld%lld", x1 + i, y1 + i, x2 + i, y2 + i); xy1[i] = MP(x1[i], y1[i]); xy2[i] = MP(x2[i], y2[i]); if ((x1[i] == 0 && x2[i] == R) ||(x2[i] == 0 && x1[i] == R)) { xseg.EB(i); } if ((y1[i] == 0 && y2[i] == C) ||(y2[i] == 0 && y1[i] == C)) { yseg.EB(i); } } set<int> xse, yse; REP(i, N) { xse.insert(x1[i]); xse.insert(x2[i]); yse.insert(y1[i]); yse.insert(y2[i]); } int cnt = 0; FORE(e, xse) { xcomp[e] = ++cnt; } cnt = 0; FORE(e, yse) { ycomp[e] = ++cnt; } if (xseg.size() >= 1 && yseg.size() >= 1) { cout << "NO" << endl; return 0; } if (xseg.size()) { VT<Line> v; xse.clear(); FORE(i, xseg) { xse.EB(Line(Point(x1[i], y1[i]), Point(x2[i], y2[i]))); } REP(i, N) { Line l = Line(Line(Point(x1[i], y1[i]), Point(x2[i], y2[i]))); FORE(el, xse) { if (l.a.x == el.a.x && l.b.x == el.b.x && l.a.y == el.a.y && l.b.y == el.b.y) { continue; } if (isIntersect(el, l)) { cout << "NO" << endl; return 0; } } } } else { VT<Line> v; yse.clear(); FORE(i, yseg) { yse.EB(Line(Point(x1[i], y1[i]), Point(x2[i], y2[i]))); } REP(i, N) { Line l = Line(Line(Point(x1[i], y1[i]), Point(x2[i], y2[i]))); FORE(el, xseg) { if (l.a.x == el.a.x && l.b.x == el.b.x && l.a.y == el.a.y && l.b.y == el.b.y) { continue; } if (isIntersect(el, l)) { cout << "NO" << endl; return 0; } } } } cout << "YES" << endl; }
a.cc:138:19: error: 'LL y1 [100010]' redeclared as different kind of entity 138 | LL x1[MAX], y1[MAX], x2[MAX], y2[MAX]; | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc:139:1: error: 'PPL' does not name a type; did you mean 'PLL'? 139 | PPL xy1[MAX], xy2[MAX]; | ^~~ | PLL a.cc:141:1: error: 'BIT' does not name a type 141 | BIT bit<LL>(MAX); | ^~~ a.cc: In function 'int main()': a.cc:147:46: warning: pointer to a function used in arithmetic [-Wpointer-arith] 147 | scanf("%lld%lld%lld%lld", x1 + i, y1 + i, x2 + i, y2 + i); | ~~~^~~ a.cc:148:9: error: 'xy1' was not declared in this scope; did you mean 'y1'? 148 | xy1[i] = MP(x1[i], y1[i]); | ^~~ | y1 a.cc:148:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 148 | xy1[i] = MP(x1[i], y1[i]); | ^ a.cc:149:9: error: 'xy2' was not declared in this scope; did you mean 'y2'? 149 | xy2[i] = MP(x2[i], y2[i]); | ^~~ | y2 a.cc:153:18: warning: pointer to a function used in arithmetic [-Wpointer-arith] 153 | if ((y1[i] == 0 && y2[i] == C) ||(y2[i] == 0 && y1[i] == C)) { | ^ a.cc:153:61: warning: pointer to a function used in arithmetic [-Wpointer-arith] 153 | if ((y1[i] == 0 && y2[i] == C) ||(y2[i] == 0 && y1[i] == C)) { | ^ a.cc:153:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 153 | if ((y1[i] == 0 && y2[i] == C) ||(y2[i] == 0 && y1[i] == C)) { | ~~~~~~^~~~ a.cc:161:24: warning: pointer to a function used in arithmetic [-Wpointer-arith] 161 | yse.insert(y1[i]); | ^ a.cc:161:19: error: no matching function for call to 'std::set<int>::insert(double (&)(double) noexcept)' 161 | yse.insert(y1[i]); | ~~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/set:63, from a.cc:19: /usr/include/c++/14/bits/stl_set.h:511:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<int>, int>::rebind<int>; typename _Alloc::value_type = int; value_type = int]' (near match) 511 | insert(const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:511:7: note: conversion of argument 1 would be ill-formed: a.cc:161:24: error: invalid conversion from 'double (*)(double) noexcept' to 'std::set<int>::value_type' {aka 'int'} [-fpermissive] 161 | yse.insert(y1[i]); | ~~~~^ | | | double (*)(double) noexcept /usr/include/c++/14/bits/stl_set.h:520:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<int>, int>::rebind<int>; typename _Alloc::value_type = int; value_type = int]' (near match) 520 | insert(value_type&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:520:7: note: conversion of argument 1 would be ill-formed: a.cc:161:24: error: invalid conversion from 'double (*)(double) noexcept' to 'std::set<int>::value_type' {aka 'int'} [-fpermissive] 161 | yse.insert(y1[i]); | ~~~~^ | | | double (*)(double) noexcept /usr/include/c++/14/bits/stl_set.h:568:9: note: candidate: 'template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 568 | insert(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:568:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_set.h:548:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; value_type = int]' 548 | insert(const_iterator __position, const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:548:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_set.h:553:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; value_type = int]' 553 | insert(const_iterator __position, value_type&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:553:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_set.h:580:7: note: candidate: 'void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 580 | insert(initializer_list<value_type> __l) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:580:43: note: no known conversion for argument 1 from 'double(double) noexcept' to 'std::initializer_list<int>' 580 | insert(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_set.h:600:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::insert_return_type std::set<_Key, _Compare, _Alloc>::insert(node_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; insert_return_type = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::insert_return_type; node_type = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::node_type]' 600 | insert(node_type&& __nh) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:600:26: note: no known conversion for argument 1 from 'double(double) noexcept' to 'std::set<int>::node_type&&' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::node_type&&'} 600 | insert(node_type&& __nh) | ~~~~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_set.h:605:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, node_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; node_type = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::node_type]' 605 | insert(const_iterator __hint, node_type&& __nh) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:605:7: note: candidate expects 2 arguments, 1 provided a.cc:55:12: error: 'class std::set<int>' has no member named 'emplace_back'; did you mean 'emplace_hint'? 55 | #define EB emplace_back | ^~~~~~~~~~~~ a.cc:180:17: note: in expansion of macro 'EB' 180 | xse.EB(Line(Point(x1[i], y1[i]), Point(x2[i], y2[i]))); | ^~ a.cc:180:42: warning: pointer to a function used in arithmetic [-Wpointer-arith] 180 | xse.EB(Line(Point(x1[i], y1[i]), Point(x2[i], y2[i]))); | ^ a.cc:180:43: error: no matching function for call to 'Geometry2D::Point::Point(LL&, double (&)(double) noexcept)' 180 | xse.EB(Line(Point(x1[i], y1[i]), Point(x2[i], y2[i]))); | ^ a.cc:76:9: note: candidate: 'Geometry2D::Point::Point(double, double)' 76 | Point(double _x, double _y) : x(_x), y(_y) {} | ^~~~~ a.cc:76:33: n
s363403474
p03685
C++
#include <bits/stdc++.h> #include <cstdio> #include <cstdlib> #ifdef _MSC_VER #include <Windows.h> #else #include <unistd.h> #endif using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef pair<int, int> PII; typedef pair<long, long> PLL; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB emplace_back #define MP make_pair #define SZ(a) int((a).size()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const LL MOD=(LL)1e9+7; //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) #define INF 1LL << 50 const LL MAX_N=(LL)1e5+3; LL x1,x2,y1,y2; int main(){ LL R,C,N; cin>>R>>C>>N; int res=0,resy=0,resx=0; REP(i,N){ cin>>x1>>y1>>x2>>y2; if(abs(x1-x2)==R&&abs(y1-y2)==C){ res+=2; }else if(abs(x1-x2)==R){ if(y1==y2){ if(y1==0||y1==C){ }else{ resy++; } }else if(x1==x2){ if(x1==0||x1==R){ }else{ resx++; } } } } if(res==2||min(resx,resy)>=1){ cout<<"NO"<<endl; }else{ cout<<"YES"<<endl; } return 0; }
a.cc:52:10: error: 'LL y1' redeclared as different kind of entity 52 | LL x1,x2,y1,y2; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:58:16: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept') 58 | cin>>x1>>y1>>x2>>y2; | ~~~~~~~^~~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /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:58:18: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept' 58 | cin>>x1>>y1>>x2>>y2; | ^~ /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:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(short int)y1' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(short unsigned int)y1' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(int)y1' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(unsigned int)y1' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(long int)y1' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(long unsigned int)y1' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(long long int)y1' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(long long unsigned int)y1' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept a.cc:58:18: error: cannot bind rvalue '(void*)y1' 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:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 58 | cin>>x1>>y1>>x2>>y2; | ^~ | | | double (*)(double) noexcept /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:58:18: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios
s086020448
p03685
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; using i64 = int64_t; int R, C, N; i64 get_ord(i64 x, i64 y) { if (y == 0) { return x; } else if (y == C) { return R + C + R - x; } else if (x == 0) { return R + C + R + C - y; } return R + y; } vector<pair<i64, i64> > ls, ks; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> R >> C >> N; for (int j = 0; j < N; ++j) { i64 x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if ((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) { i64 o1 = get_ord(x1, y1), o2 = get_ord(x2, y2); ls.emplace_back(min(o1, o2), max(o1, o2)); ks.emplace_back(max(o1, o2), min(o1, o2)); } } sort(begin(ls), end(ls)); for (int j = 0; j < (int)ls.size() - 1; ++j) { pair<i64, i64> p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); i64 v1 = (ls[j].first - p.second) * (ls[j].first - p.first); i64 v2 = (ls[j].second - p.second) * (ls[j].second - p.first); if (v1 * v2 < 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long int, long int>*, std::vector<std::pair<long int, long int> > >; _Value = const std::pair<long int, long long int>]': /usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]' 1504 | if (__comp(__middle, __val)) | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>]' 1539 | return std::__lower_bound(__first, __last, __val, | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 1540 | __gnu_cxx::__ops::__iter_less_val()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:62:40: required from here 62 | pair<i64, i64> p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long int, long int>' and 'const std::pair<long int, long long int>') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long int' and 'long long int') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from a.cc:2: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 390
s890871337
p03685
C++
#include <iostream> #include <vector> using namespace std; const int NICO = 100000+10; int r, c, n; long long x1[NICO], x2[NICO], y1[NICO], y2[NICO]; vector<int> v1, v2; #define cs const #define cp const P& #define op operator const double eps = 1e-8; inline int sig(double x) {return (x>eps)-(x<-eps);} struct P{ double x, y; void in() { scanf("%lf%lf", &x, &y); } P(double x=0.0, double y=0.0) : x(x), y(y) {} P op-(cp a)cs { return P(x-a.x, y-a.y); } double op^(cp a)cs { return x*a.y - y*a.x; } //叉积 double op*(cp a)cs {return x*a.x + y*a.y;} double cross(P a, P b) { return (a-*this) ^ (b-*this); } double dot(P a, P b) { return (a-(*this)) * (b-(*this)); } bool on_seg(P a, P b) { return !sig(cross(a, b)) && sig(dot(a, b)) <= 0; }//判断是否在点上 }; bool seg(P a, P b, P c, P d) { //判断相交(a - b)线段 、(c - d)线段 if(a.on_seg(c, d) || b.on_seg(c, d) || c.on_seg(a, b) || d.on_seg(a, b)) return true; return sig(a.cross(b, c)*a.cross(b, d)) < 0 && sig(c.cross(d, a)*c.cross(d, b)) < 0; } bool ok(int i, int j) { P a, b, c, d; a.x = x1[i], a.y = y1[i]; b.x = x2[i], b.y = y2[i]; c.x = x1[j], c.y = y1[j]; d.x = x2[j], d.y = y2[j]; //cout << a.x << " " << a.y << " " << b.x << " " << b.y << " " << //c.x << " " << c.y << " " << d.x << " " << d.y << endl; return !seg(a, b, c, d); } bool cmp1(int i, int j) { if(x1[i] == x1[j]) { return y1[i] > y2[j]; } return x1[i] < x2[j]; } bool cmp2(int i, int j) { if(y1[i] == y1[j]) { return x1[i] < x1[j]; } return y1[i] < y1[j]; } int main() { int gg = 0; scanf("%d %d %d", &r, &c, &n); for(int i=1;i<=n;i++) { scanf("%lld %lld %lld %lld", &x1[i], &y1[i], &x2[i], &y2[i]); if((x2[i]-x1[i]) * (y2[i]-y1[i]) >= 0) { if(x1[i] > x2[i]) { swap(x1[i], x2[i]); swap(y1[i], y2[i]); } if(y1[i] > y2[i]) { swap(x1[i], x2[i]); swap(y1[i], y2[i]); } if((x1[i] == 0 || y1[i] == 0) && (x2[i] == r || y2[i] == c)) { v1.push_back(i); } } if((x2[i]-x1[i]) * (y2[i]-y1[i]) < 0) { if(x1[i] > x2[i]) { swap(x1[i], x2[i]); swap(y1[i], y2[i]); } if((x1[i] == 0 || y1[i] == c) && (x2[i] == r || y2[i] == 0)) { //cout << x1[i] << " " << y1[i] << " " << x2[i] << " " << y2[i] << endl; v2.push_back(i); } } } //cout << v1.size() << " " << v2.size() << endl; sort(v1.begin(), v1.end(), cmp1); for(int i=0;i<(int)v1.size()-1;i++) { if(!ok(v1[i], v1[i+1])) { gg = 1; } } sort(v2.begin(), v2.end(), cmp2); for(int i=0;i<(int)v2.size()-1;i++) { if(!ok(v2[i], v2[i+1])) { gg = 1; } } if(v1.size() > 0 && v2.size() > 0) { if(!ok(v1[0], v2[0])) gg = 1; if(!ok(v1[0], v2[(int)v2.size()-1])) gg = 1; if(!ok(v1[(int)v1.size()-1], v2[0])) gg = 1; if(!ok(v1[(int)v1.size()-1], v2[v2.size()-1])) gg = 1; } printf("%s\n", gg?"NO":"YES"); }
a.cc:6:31: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch] 6 | long long x1[NICO], x2[NICO], y1[NICO], y2[NICO]; | ^~ a.cc: In function 'int main()': a.cc:96:5: error: 'sort' was not declared in this scope; did you mean 'short'? 96 | sort(v1.begin(), v1.end(), cmp1); | ^~~~ | short
s520092352
p03685
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; using i64 = int64_t; int R, C, N; i64 get_ord(i64 x, i64 y) { if (y == 0) { return x; } else if (y == C) { return R + C + R - x; } else if (x == 0) { return R + C + R + C - y; } return R + y; } vector<pair<i64, i64> > ls, ks; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> R >> C >> N; for (int j = 0; j < N; ++j) { i64 x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if ((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) { i64 o1 = get_ord(x1, y1), o2 = get_ord(x2, y2); ls.emplace_back(min(o1, o2), max(o1, o2)); ks.emplace_back(max(o1, o2), min(o1, o2)); } } sort(begin(ls), end(ls)); for (int j = 0; j < (int)ls.size() - 1; ++j) { auto p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); i64 v1 = (ls[j].first - p.second) * (ls[j].first - p.first); i64 v2 = (ls[j].second - p.second) * (ls[j].second - p.first); if (v1 * v2 < 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long int, long int>*, std::vector<std::pair<long int, long int> > >; _Value = const std::pair<long int, long long int>]': /usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]' 1504 | if (__comp(__middle, __val)) | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>]' 1539 | return std::__lower_bound(__first, __last, __val, | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 1540 | __gnu_cxx::__ops::__iter_less_val()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:62:30: required from here 62 | auto p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long int, long int>' and 'const std::pair<long int, long long int>') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long int' and 'long long int') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from a.cc:2: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(co
s433848904
p03685
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef vector<ll> VI; typedef vector<VI> VVI; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const int INF = numeric_limits<int>::max() / 2; const int NEG_INF = numeric_limits<int>::min() / 2; const int MOD = 1e9 + 7; bool judge(ll xi, ll yi, ll xj, ll yj,ll xk,ll yk,ll xl,ll yl) { if (xi == xj) { return (xi - xk)*(xi - xl) > 0; } else { return ((yi - yj)*xk - (xi - xj)*yk + (xi*yj - xj*yi))*((yi - yj)*xl - (xi - xj)*yl + (xi*yj - xj*yi)) > 0; } } int main() { cin.tie(0); ios::sync_with_stdio(false); ll r, c; cin >> r >> c; ll n; cin >> n; vector<pair<P, P>> v; for (int i = 0; i < n; i++) { ll xi, yi, xj, yj; cin >> xi >> yi >> xj >> yj; if ((xi == 0 || xi == r) || (yi == 0 || yi == c)) { if ((xj == 0 || xj == r) || (yj == 0 || yj == c)) { v.push_back(make_pair(P(xi, yi), P(xj, yj))); } } } bool flag = true; int sz = v.size(); for (int i = 0; i < sz; i++) { for (int j = i + 1; j < sz; j++) { ll xi = v[i].first.first, yi = v[i].first.second, xj = v[j].second.first, yj = v[j].second.second; ll xk = v[k].first.first, yk = v[k].first.second, xl = v[l].second.first, yl = v[l].second.second; flag &= judge(xi, yi, xj, yj, xk, yk, xl, yl); } } if (flag) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
a.cc: In function 'int main()': a.cc:45:35: error: 'k' was not declared in this scope; did you mean 'xk'? 45 | ll xk = v[k].first.first, yk = v[k].first.second, xl = v[l].second.first, yl = v[l].second.second; | ^ | xk a.cc:46:59: error: 'yk' was not declared in this scope; did you mean 'xk'? 46 | flag &= judge(xi, yi, xj, yj, xk, yk, xl, yl); | ^~ | xk a.cc:46:63: error: 'xl' was not declared in this scope; did you mean 'xk'? 46 | flag &= judge(xi, yi, xj, yj, xk, yk, xl, yl); | ^~ | xk a.cc:46:67: error: 'yl' was not declared in this scope; did you mean 'yj'? 46 | flag &= judge(xi, yi, xj, yj, xk, yk, xl, yl); | ^~ | yj
s902200604
p03685
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; using i64 = int64_t; int R, C, N; i64 get_ord(i64 x, i64 y) { if (y == 0) { return x; } else if (y == C) { return R + C + R - x; } else if (x == 0) { return R + C + R + C - y; } return R + y; } vector<pair<i64, i64> > ls, ks; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> R >> C >> N; for (int j = 0; j < N; ++j) { i64 x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if ((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) { i64 o1 = get_ord(x1, y1), o2 = get_ord(x2, y2); ls.emplace_back(min(o1, o2), max(o1, o2)); ks.emplace_back(max(o1, o2), min(o1, o2)); } } sort(begin(ls), end(ls)); for (int j = 0; j < (int)ls.size() - 1; ++j) { auto p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); i64 v1 = (ls[j].first - p.second) * (ls[j].first - p.first); i64 v2 = (ls[j].second - p.second) * (ls[j].second - p.first); if (v1 * v2 < 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long int, long int>*, std::vector<std::pair<long int, long int> > >; _Value = const std::pair<long int, long long int>]': /usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]' 1504 | if (__comp(__middle, __val)) | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Tp = pair<long int, long long int>]' 1539 | return std::__lower_bound(__first, __last, __val, | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 1540 | __gnu_cxx::__ops::__iter_less_val()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:62:30: required from here 62 | auto p = *lower_bound(begin(ks), end(ks), make_pair(ls[j].second, 1LL<<60)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long int, long int>' and 'const std::pair<long int, long long int>') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long int' and 'long long int') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from a.cc:2: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(co
s392931204
p03685
C++
#include <bits/stdc++.h> #include <cstdio> #include <cstdlib> #ifdef _MSC_VER #include <Windows.h> #else #include <unistd.h> #endif using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef pair<int, int> PII; typedef pair<long, long> PLL; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB emplace_back #define MP make_pair #define SZ(a) int((a).size()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const LL MOD=(LL)1e9+7; //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) #define INF 1LL << 50 const LL MAX_N=(LL)1e5+3; LL x1[MAX_N],x2[MAX_N],y1[MAX_N],y2[MAX_N]; int main(){ LL R,C,N; cin>>R>>C>>N; int res=0,resy=0,resx=0; REP(i,N){ cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; if(abs(x1[i]-x2[i])==R&&abs(y1[i]-y2[i])==C){ res+=2; }else if(abs(x1[i]-x2[i])==R){ if(y1[i]==y2[i]){ if(y1[i]==0||y1[i]==C){ }else{ resy++; } }else if(x1[i]==x2[i]){ if(x1[i]==0||x1[i]==R){ }else{ resx++; } } } } if(res==2||min(resx,resy)>=1){ cout<<"NO"<<endl; }else{ cout<<"YES"<<endl; } return 0; }
a.cc:52:32: error: 'LL y1 [100003]' redeclared as different kind of entity 52 | LL x1[MAX_N],x2[MAX_N],y1[MAX_N],y2[MAX_N]; | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:58:25: warning: pointer to a function used in arithmetic [-Wpointer-arith] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ^ a.cc:58:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept') 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~~~~~~~^~~~~~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /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:58:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept' 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ /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:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(short int)(y1 + ((sizetype)i))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(short unsigned int)(y1 + ((sizetype)i))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(int)(y1 + ((sizetype)i))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(unsigned int)(y1 + ((sizetype)i))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(long int)(y1 + ((sizetype)i))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(long unsigned int)(y1 + ((sizetype)i))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(long long int)(y1 + ((sizetype)i))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(long long unsigned int)(y1 + ((sizetype)i))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | | double (*)(double) noexcept a.cc:58:25: error: cannot bind rvalue '(void*)(y1 + ((sizetype)i))' 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:58:25: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 58 | cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]; | ~~~~^ | | |
s029134636
p03685
C++
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define per(i,a,b) for(ll i=b-1LL;i>=(a);--i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(c) string(1,c) #define print(x) cout<<#x<<" = "<<x<<endl; #define MOD 1000000007 int main() { ll h, w, n; cin >> h >> w >> n; ll flag1 = 0; ll flag2 = 0; vector<pair<ll, ll> > v1; vector<pair<ll, ll> > v2; vector<pair<pair<ll, ll> , ll> > v3; vector<pair<pair<ll, ll> , ll> > v4; rep(i, 0, n) { ll a, b, c, d; cin >> a >> b >> c >> d; v1.pb(mp(a, b)); v2.pb(mp(c, d)); if (a == 0 && c == h) { flag1 = 1; v3.pb(mp(mp(b, d), 0)); } if (a == h && c == 0) { flag1 = 1; v3.pb(mp(mp(d, b), 0)); } if (a == 0 && c == 0) { v3.pb(mp(mp(min(b, d), max(b, d)), 1)); } if (a == h && c == h) { v3.pb(mp(mp(min(b, d), max(b, d)), 2)); } if (b == 0 && d == w) { flag2 = 1; v4.pb(mp(mp(a, c), 0)); } if (b == w && d == 0) { flag2 = 1; v4.pb(mp(mp(c, a), 0)); } if (b == 0 && d == 0) { v3.pb(mp(mp(min(a, c), max(a, c)), 1)); } if (b == w && d == w) { v3.pb(mp(mp(min(a, c), max(a, c)), 2)); } } if (flag1 == 1 && flag2 == 1) { cout << "NO" << endl; return 0; } sort(all(v3)); sort(all(v4)); ll x1, x2, x3, x4, y1, y2, y3, y4; x1 = -1; x2 = -1; x3 = -1; x4 = -1; y1 = -1; y2 = -1; y3 = -1; y4 = -1; ll mx1 = v3[] if (v3.sz > 1) { rep(i, 0, v3.sz - 1) { if (v3[i].se == 0 && v3[i].se > v3[i + 1].se) { cout << "NO" << endl; return 0; } if (v3[i].se == 1) { if (x1 == -1) { x1 = v3[i].fi.fi; x2 = v3[i].fi.se; } else { if (v3[i].fi.fi < x2) { cout << "NO" << endl; return 0; } } } if (v3[i].se == 2) { if (x3 == -1) { x3 = v3[i].fi.fi; x4 = v3[i].fi.se; } else { if (v3[i].fi.fi < x4) { cout << "NO" << endl; return 0; } } } } } if (v4.sz > 1) { rep(i, 0, v4.sz - 1) { if (v4[i].se == 0 && v4[i].se > v4[i + 1].se) { cout << "NO" << endl; return 0; } if (v4[i].se == 1) { if (y1 == -1) { y1 = v4[i].fi.fi; y2 = v4[i].fi.se; } else { if (v4[i].fi.fi < y2) { cout << "NO" << endl; return 0; } } } if (v4[i].se == 2) { if (y3 == -1) { y3 = v4[i].fi.fi; y4 = v4[i].fi.se; } else { if (v4[i].fi.fi < y4) { cout << "NO" << endl; return 0; } } } } } cout << "YES" << endl; return 0; }
a.cc: In function 'int main()': a.cc:98:15: error: expected primary-expression before ']' token 98 | ll mx1 = v3[] | ^
s067783910
p03685
C++
#define _USE_MATH_DEFINES #include<iostream> #include<fstream> #include<cstdlib> #include<string> #include<math.h> #include<bitset> #include<algorithm> #include<vector> #include<set> #include<stack> #include<queue> using namespace std; typedef unsigned long long ull; bool judgeIentersected(ull ax, ull ay, ull bx, ull by, ull cx, ull cy, ull dx, ull dy) { ull ta = (cx - dx) * (ay - cy) + (cy - dy) * (cx - ax); ull tb = (cx - dx) * (by - cy) + (cy - dy) * (cx - bx); ull tc = (ax - bx) * (cy - ay) + (ay - by) * (ax - cx); ull td = (ax - bx) * (dy - ay) + (ay - by) * (ax - dx); return tc * td < 0 && ta * tb < 0; // return tc * td <= 0 && ta * tb <= 0; // 端点を含む場合 }; int main(){ unsigned long long r,c,n; cin>>r>>c>>n; unsigned long long sx[100000]={}; unsigned long long sy[100000]={}; unsigned long long gx[100000]={}; unsigned long long gy[100000]={}; bool linej[100000]={}; for(int i=0;i<n;i++){ cin >> sx[i] >> sy[i] >> gx[i] >> gy[i]; if((sx[i]==0 || sx[i]==r||sy[i]==0 || sy[i]==c)&&(gx[i]==0 || gx[i]==r||gy[i]==0 || gy[i]==c)){ linej[i]=1; } //cout << linej[i] << endl; } for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ //cout << i <<j << endl; if(linej[i] && linej[j]){ //bool ans=judgeIentersected(sx[i],sy[i],gx[i],gy[i],sx[j],sy[j],gx[j],gy[j]); cout << "i=" << i << ", j=" << j << ", ans=" << ans << endl; if(ans){ cout << "NO" << endl; return 0; } } } } cout << "YES" << endl; }
a.cc: In function 'int main()': a.cc:50:69: error: 'ans' was not declared in this scope; did you mean 'abs'? 50 | cout << "i=" << i << ", j=" << j << ", ans=" << ans << endl; | ^~~ | abs
s451166847
p03685
C++
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define per(i,a,b) for(ll i=b-1LL;i>=(a);--i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(c) string(1,c) #define print(x) cout<<#x<<" = "<<x<<endl; #define MOD 1000000007 int main() { ll h, w, n; cin >> h >> w >> n; ll flag1 = 0; ll flag2 = 0; vector<pair<ll, ll> > v1; vector<pair<ll, ll> > v2; vector<pair<pair<ll, ll> , ll> > v3; vector<pair<pair<ll, ll> , ll> > v4; rep(i, 0, n) { ll a, b, c, d; cin >> a >> b >> c >> d; v1.pb(mp(a, b)); v2.pb(mp(c, d)); if (a == 0 && c == h) { flag1 = 1; v3.pb(mp(mp(b, d), 0)); } if (a == h && c == 0) { flag1 = 1; v3.pb(mp(mp(d, b), 0)); } if (a == 0 && c == 0) { v3.pb(mp(mp(min(b, d), max(b, d)), 1)); } if (a == h && c == h) { v3.pb(mp(mp(min(b, d), max(b, d)), 2)); } if (b == 0 && d == w) { flag2 = 1; v4.pb(mp(mp(a, c), 0)); } if (b == w && d == 0) { flag2 = 1; v4.pb(mp(mp(c, a), 0)); } if (b == 0 && d == 0) { v3.pb(mp(mp(min(a, c), max(a, c)), 1)); } if (b == w && d == w) { v3.pb(mp(mp(min(a, c), max(a, c)), 2)); } } if (flag1 == 1 && flag2 == 1) { cout << "NO" << endl; return 0; } sort(all(v3)); sort(all(v4)); ll x1, x2; x1 = -1; x2 = -1; x3 = -1; x4 = -1; y1 = -1; y2 = -1; y3 = -1; y4 = -1; if (v3.sz > 1) { rep(i, 0, v3.sz - 1) { if (v3[i].se > v3[i + 1].se) { cout << "NO" << endl; return 0; } if (v3[i].se == 1) { if (x1 == -1) { x1 = v3[i].fi.fi; x2 = v3[i].fi.se; } else { if (v3[i].fi.fi < x2) { cout << "NO" << endl; return 0; } } } if (v3[i].se == 2) { if (x3 == -1) { x3 = v3[i].fi.fi; x4 = v3[i].fi.se; } else { if (v3[i].fi.fi < x4) { cout << "NO" << endl; return 0; } } } } } if (v4.sz > 1) { rep(i, 0, v4.sz - 1) { if (v4[i].se > v4[i + 1].se) { cout << "NO" << endl; return 0; } if (v4[i].se == 1) { if (y1 == -1) { y1 = v4[i].fi.fi; y2 = v4[i].fi.se; } else { if (v4[i].fi.fi < y2) { cout << "NO" << endl; return 0; } } } if (v4[i].se == 2) { if (y3 == -1) { y3 = v4[i].fi.fi; y4 = v4[i].fi.se; } else { if (v4[i].fi.fi < y4) { cout << "NO" << endl; return 0; } } } } } cout << "YES" << endl; return 0; }
a.cc: In function 'int main()': a.cc:92:3: error: 'x3' was not declared in this scope; did you mean 'x2'? 92 | x3 = -1; | ^~ | x2 a.cc:93:3: error: 'x4' was not declared in this scope; did you mean 'x2'? 93 | x4 = -1; | ^~ | x2 a.cc:94:6: error: assignment of function 'double y1(double)' 94 | y1 = -1; | ~~~^~~~ a.cc:95:3: error: 'y2' was not declared in this scope; did you mean 'x2'? 95 | y2 = -1; | ^~ | x2 a.cc:96:3: error: 'y3' was not declared in this scope; did you mean 'v3'? 96 | y3 = -1; | ^~ | v3 a.cc:97:3: error: 'y4' was not declared in this scope; did you mean 'v4'? 97 | y4 = -1; | ^~ | v4 a.cc:137:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 137 | if (y1 == -1) { | ~~~^~~~~ a.cc:138:14: error: assignment of function 'double y1(double)' 138 | y1 = v4[i].fi.fi; | ^
s966588109
p03685
C++
#Include <stdio.h> int main(){ printf("NO\n"); return 0; }
a.cc:1:2: error: invalid preprocessing directive #Include; did you mean #include? 1 | #Include <stdio.h> | ^~~~~~~ | include a.cc: In function 'int main()': a.cc:3:1: error: 'printf' was not declared in this scope 3 | printf("NO\n"); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #Include <stdio.h>
s499540802
p03685
C++
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<map> #include<set> #include<algorithm> #include<queue> #include<time.h> #define fo(i,a,b) for(int i=a;i<=b;i++) #define fd(i,a,b) for(int i=a;i>=b;i--) #define fe(x) for(int ii=be[x];ii;ii=e[ii].ne) using namespace std; int r,c,n,m,xx,yy,zz,ww,tot; int random(){ return rand()*32768+rand(); } bool bor(int a,int b){ if (a==0||a==r) return 1; if (b==0||b==c) return 1; return 0; } struct nod{ int x1,y1,x2,y2; }; nod a[110000]; double cj(double ax,double ay,double bx,double by){ return ax*by-ay*bx; } inline bool cro(int c,int d){ return ((cj(a[d].x1-a[c].x1,a[d].y1-a[c].y1,a[c].x2-a[c].x1,a[c].y2-a[c].y1)*cj(a[d].x2-a[c].x1,a[d].y2-a[c].y1,a[c].x2-a[c].x1,a[c].y2-a[c].y1))<0); } int main(){ scanf("%d%d%d",&r,&c,&n); fo(i,1,n){ scanf("%d%d%d%d",&xx,&yy,&zz,&ww); if (bor(xx,yy)&&bor(zz,ww)){ ++m; a[m].x1=xx; a[m].y1=yy; a[m].x2=zz; a[m].y2=ww; } } fo(i,1,4*m){ int xx=random()%m+1,yy=random()%m+1; swap(a[xx],a[yy]); } fo(i,1,m-1) fo(j,i+1,m){ if (cro(i,j)){ printf("NO\n"); return 0; } tot++; if (tot>=6000000){ printf("YES\n"); return 0; } } printf("YES\n"); return 0; }
a.cc:15:5: error: ambiguating new declaration of 'int random()' 15 | int random(){ | ^~~~~~ In file included from /usr/include/c++/14/bits/std_abs.h:38, from /usr/include/c++/14/cmath:49, from /usr/include/c++/14/math.h:36, from a.cc:2: /usr/include/stdlib.h:521:17: note: old declaration 'long int random()' 521 | extern long int random (void) __THROW; | ^~~~~~
s507803731
p03685
C++
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<map> #include<set> #include<algorithm> #include<queue> #include<time.h> #define fo(i,a,b) for(int i=a;i<=b;i++) #define fd(i,a,b) for(int i=a;i>=b;i--) #define fe(x) for(int ii=be[x];ii;ii=e[ii].ne) using namespace std; int r,c,n,m,xx,yy,zz,ww,tot; int random(){ return rand()*32768+rand(); } bool bor(int a,int b){ if (a==0||a==r) return 1; if (b==0||b==c) return 1; return 0; } struct nod{ int x1,y1,x2,y2; }; nod a[110000]; double cj(double ax,double ay,double bx,double by){ return ax*by-ay*bx; } inline bool cro(int c,int d){ return ((cj(a[d].x1-a[c].x1,a[d].y1-a[c].y1,a[c].x2-a[c].x1,a[c].y2-a[c].y1)*cj(a[d].x2-a[c].x1,a[d].y2-a[c].y1,a[c].x2-a[c].x1,a[c].y2-a[c].y1))<0); } int main(){ scanf("%d%d%d",&r,&c,&n); fo(i,1,n){ scanf("%d%d%d%d",&xx,&yy,&zz,&ww); if (bor(xx,yy)&&bor(zz,ww)){ ++m; a[m].x1=xx; a[m].y1=yy; a[m].x2=zz; a[m].y2=ww; } } fo(i,1,4*m){ int xx=random()%m+1,yy=random()%m+1; swap(a[xx],a[yy]); } fo(i,1,m-1) fo(j,i+1,m){ if (cro(i,j)){ printf("NO\n"); return 0; } tot++; if (tot>=6000000){ printf("YES\n"); return 0; } } printf("YES\n"); return 0; }
a.cc:15:5: error: ambiguating new declaration of 'int random()' 15 | int random(){ | ^~~~~~ In file included from /usr/include/c++/14/bits/std_abs.h:38, from /usr/include/c++/14/cmath:49, from /usr/include/c++/14/math.h:36, from a.cc:2: /usr/include/stdlib.h:521:17: note: old declaration 'long int random()' 521 | extern long int random (void) __THROW; | ^~~~~~
s668721238
p03685
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9+7; int r,c,n; int get(int x, int y){ if(x > 0 && x < r && y > 0 && y < c) return -1; int ans = 0; if(x == 0) return y; else ans += c; if(y == c) return ans + x; else ans += r; if(x == r) return ans + (c-y); else ans += c; return ans + (r-x); } const int N = 1e6+5; int ftree[N]; void fadd(int x){ for(int i = x; i < N; i += i&(-i)) ftree[i]++; } int fget(int x){ int ans = 0; for(int i = x; i > 0; i -= i&(-i)) ans += ftree[i]; return ans; } int main(){ cin >> r >> c >> n; vector<pair<int,int> > moves; for(int i = 0; i < n; ++i){ int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2; int a = get(x1,y1); int b = get(x2,y2); if(a == -1 || b == -1) continue; if(a > b) b += 2*(r+c); moves.push_back({a,b}); moves.push_back({a+2*(r+c),b+2*(r+c)}); } sort(moves.begin(),moves.end()); n = moves.size(); // [...............(.................]................) vector<int> all; for(auto cur : moves){ all.push_back(cur.first); all.push_back(cur.first+1); all.push_back(cur.second); all.push_back(cur.second-1); } sort(all.begin(),all.end()); all.erase(unique(all.begin(),all.end()),all.end()); for(auto &cur : moves){ cur.first = lower_bound(all.begin(),all.end(),cur.first)-all.begin()+1; cur.second = lower_bound(all.begin(),all.end(),cur.second)-all.begin()+1; } bool ok = true; int l = 0; for(int i = 0; i < n; ++i){ while(moves[l].first < moves[i].first) fadd(moves[l++].second); if(moves[i].first+1 >= moves[i].second) continue; /cout << moves[i].first << ' ' << moves[i].second << '\n'; //cout << "fget: " << fget(moves[i].second-1) << ' ' << fget(moves[i].first) << '\n'; if(fget(moves[i].second-1)-fget(moves[i].first)) ok = false; } if(!ok) puts("NO"); else puts("YES"); }
a.cc: In function 'int main()': a.cc:74:9: error: expected primary-expression before '/' token 74 | /cout << moves[i].first << ' ' << moves[i].second << '\n'; | ^
s345601547
p03685
C++
#include <bits/stdc++.h> #define double long double #define N 100010 using namespace std; map<int,int>mp,used; int w,h,n; void add(int x,int y,int i){ if(x == 0) mp[y] = i; else if(y == h) mp[h+x] = i; else if(x == w) mp[h+w+h-y] = i; else if(y == 0) mp[2*h + w + w - x] = i; } typedef pair<int,int> P; bool check(){ stack <int> S; for(P a:mp) { int num = a.second; if(num == -1) continue; if(used[num] == 1 && S.top() != num) return 0; if(used[num] == 1) S.pop(),used[num] = 0; else S.push(num),used[num] = 1; } for(P a:mp) { int num = a.second; if(num == -1) continue; if(used[num] == 1 && S.top() != num) return 0; if(used[num] == 1) S.pop(),used[num] = 0; else S.push(num),used[num] = 1; } return 1; } int main(){ cin>>w>>h>>n; memset(mp,-1,sizeof(mp)); for(int i=0;i<n;i++){ int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; if(!((x1 == 0 || y1 == 0 ||x1 == w || y1 == w) && (x2 == 0 || y2 == 0 ||x2 == w || y2 == w)))continue; add(x1,y1,i); add(x2,y2,i); } cout<<(check()? "YES":"NO")<<endl; return 0; }
a.cc: In function 'int main()': a.cc:41:10: error: cannot convert 'std::map<int, int>' to 'void*' 41 | memset(mp,-1,sizeof(mp)); | ^~ | | | std::map<int, int> In file included from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)' 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); | ~~~~~~^~~
s985956974
p03685
C++
#include <bits/stdc++.h> #define double long double #define N 100010 using namespace std; map<int,int>,mp,used; int w,h,n; void add(int x,int y,int i){ if(x == 0) mp[y] = i; else if(y == h) mp[h+x] = i; else if(x == w) mp[h+w+h-y] = i; else if(y == 0) mp[2*h + w + w - x] = i; } typedef pair<int,int> P; bool check(){ stack <int> S; for(P a:mp) { int num = a.second; if(num == -1) continue; if(used[num] == 1 && S.top() != num) return 0; if(used[num] == 1) S.pop(),used[num] = 0; else S.push(num),used[num] = 1; } for(P a:mp) { int num = a.second; if(num == -1) continue; if(used[num] == 1 && S.top() != num) return 0; if(used[num] == 1) S.pop(),used[num] = 0; else S.push(num),used[num] = 1; } return 1; } int main(){ cin>>w>>h>>n; memset(mp,-1,sizeof(mp)); for(int i=0;i<n;i++){ int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; if(!((x1 == 0 || y1 == 0 ||x1 == w || y1 == w) && (x2 == 0 || y2 == 0 ||x2 == w || y2 == w)))continue; add(x1,y1,i); add(x2,y2,i); } cout<<(check()? "YES":"NO")<<endl; return 0; }
a.cc:6:13: error: expected unqualified-id before ',' token 6 | map<int,int>,mp,used; | ^ a.cc: In function 'int main()': a.cc:41:10: error: cannot convert 'std::map<int, int>' to 'void*' 41 | memset(mp,-1,sizeof(mp)); | ^~ | | | std::map<int, int> In file included from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)' 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); | ~~~~~~^~~
s653250048
p03685
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <cstring> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> #include <unordered_set> #include <unordered_map> #include <array> #include <cassert> #include <bitset> using namespace std; using LL = long long; LL R, C, N; struct rim { LL x, y, id; int val; rim(LL xx, LL yy, LL idid) :x(xx), y(yy), id(idid) { val = value(); } LL value()const { if (y == 0)return x; if (x == R)return R + y; if (y == C)return R + C + R - x; assert(x == 0); return R + C + R + C - y; } }; int main(void) { cin >> R >> C >> N; vector<rim>cash; for (int i = 0; i < N; ++i) { LL x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; bool fl1 = (x1 == 0 || x1 == R); bool fl2 = (y1 == 0 || y1 == C); bool fl3 = (x2 == 0 || x2 == R); bool fl4 = (y2 == 0 || y2 == C); if ((fl1 || fl2) && (fl3 || fl4)) { cash.push_back(rim(x1, y1, i)); cash.push_back(rim(x2, y2, i)); } } sort(cash.begin(), cash.end(), [](const rim& c1, const rim&c2) { return c1.value() < c2.value(); }); list<int>ids; for (auto& a : cash) { ids.push_back(a.id); } if (ids.empty()) { cout << "YES\n"; return 0; } auto lef = ids.begin(); auto rht = lef; rht++; if (rht == ids.end())rht = ids.begin(); for (int i = 0; i < 1e7; ++i) { while (*lef == *rht) { lef = ids.erase(lef); lef = ids.erase(lef); if (ids.empty()) { cout << "YES\n"; return 0; } rht = lef; if (lef == ids.begin())lef = ids.end(); --lef; } lef++; rht++; if (lef == ids.end())lef = ids.begin(); if (rht == ids.end())rht = ids.begin(); if (ids.empty()) { cout << "YES\n"; return 0; } } cout << "NO\n"; return 0; }
a.cc: In function 'int main()': a.cc:72:9: error: 'list' was not declared in this scope 72 | list<int>ids; | ^~~~ a.cc:26:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>' 25 | #include <bitset> +++ |+#include <list> 26 | using namespace std; a.cc:72:14: error: expected primary-expression before 'int' 72 | list<int>ids; | ^~~ a.cc:75:17: error: 'ids' was not declared in this scope 75 | ids.push_back(a.id); | ^~~ a.cc:77:13: error: 'ids' was not declared in this scope 77 | if (ids.empty()) | ^~~ a.cc:82:20: error: 'ids' was not declared in this scope 82 | auto lef = ids.begin(); | ^~~
s994774947
p03685
C++
#include <bits/stdc++.h> #define N 100050 #define x first #define y second using namespace std; typedef pair<int,int> pii; inline int rd() { int x=0,f=1;char ch=getchar(); while (ch>'9'||ch<'0') {if(ch=='-')f=-1;ch=getchar();} while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } int r,c,n,x1[N],x2[N],y1[N],y2[N],tot; pii p[N]; inline int get(int x1,int y1) { if (!x1) return y1; if (y1==c) return r+x1; if (x1==r) return r+c+r-y1; return 2*r+c+c-x1; } bool fz(int x1,int y1) { return x1==0 || x1==r || y1==0 || y1==c; } int main() { r = rd(), c = rd(), n = rd(); for (int i=1;i<=n;i++) x1[i] = rd(), y1[i] = rd(), x2[i] = rd(), y2[i] = rd(); for (int i=1;i<=n;i++) if (fz(x1[i],y1[i]) && fz(x2[i],y2[i])) p[++tot] = pii(get(x1[i],y1[i]), get(x2[i],y2[i])); for (int i=1;i<=tot;i++) if (p[i].x > p[i].y) swap(p[i].x, p[i].y); sort(p+1,p+tot+1); int flag = 1; for (int i=1;i<tot;i++) if (p[i].y < p[i+1].y) flag = 0; puts(flag ? "YES" : "NO"); return 0; }
a.cc:14:27: error: 'int y1 [100050]' redeclared as different kind of entity 14 | int r,c,n,x1[N],x2[N],y1[N],y2[N],tot; | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:30:50: warning: pointer to a function used in arithmetic [-Wpointer-arith] 30 | for (int i=1;i<=n;i++) x1[i] = rd(), y1[i] = rd(), x2[i] = rd(), y2[i] = rd(); | ^ a.cc:30:52: error: assignment of read-only location '*(y1 + ((sizetype)i))' 30 | for (int i=1;i<=n;i++) x1[i] = rd(), y1[i] = rd(), x2[i] = rd(), y2[i] = rd(); | ~~~~~~^~~~~~ a.cc:32:34: warning: pointer to a function used in arithmetic [-Wpointer-arith] 32 | if (fz(x1[i],y1[i]) && fz(x2[i],y2[i])) | ^ a.cc:32:34: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 32 | if (fz(x1[i],y1[i]) && fz(x2[i],y2[i])) | ~~~~^ | | | double (*)(double) noexcept a.cc:23:20: note: initializing argument 2 of 'bool fz(int, int)' 23 | bool fz(int x1,int y1) { | ~~~~^~ a.cc:33:54: warning: pointer to a function used in arithmetic [-Wpointer-arith] 33 | p[++tot] = pii(get(x1[i],y1[i]), get(x2[i],y2[i])); | ^ a.cc:33:43: error: no matching function for call to 'get(int&, double (&)(double) noexcept)' 33 | p[++tot] = pii(get(x1[i],y1[i]), get(x2[i],y2[i])); | ~~~^~~~~~~~~~~~~ a.cc:16:12: note: candidate: 'int get(int, int)' (near match) 16 | inline int get(int x1,int y1) { | ^~~ a.cc:16:12: note: conversion of argument 2 would be ill-formed: a.cc:33:54: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 33 | p[++tot] = pii(get(x1[i],y1[i]), get(x2[i],y2[i])); | ~~~~^ | | | double (*)(double) noexcept In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1250:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)' 1250 | get(pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1250:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1255:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)' 1255 | get(pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1255:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1260:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)' 1260 | get(const pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1260:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1265:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)' 1265 | get(const pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1265:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/tuple:2445:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(tuple<_Elements ...>&)' 2445 | get(tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2445:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/tuple:2451:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const tuple<_Elements ...>&)' 2451 | get(const tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2451:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/tuple:2457:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(tuple<_Elements ...>&&)' 2457 | get(tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2457:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/tuple:2466:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&)' 2466 | get(const tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2466:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/functional:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/array:390:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(array<_Tp, _Nm>&)' 390 | get(array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/14/array:390:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/array:399:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(array<_Tp, _Nm>&&)' 399 | get(array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/14/array:399:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/array:408:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const array<_Tp, _Nm>&)' 408 | get(const array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/14/array:408:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/array:417:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const array<_Tp, _Nm>&&)' 417 | get(const array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/14/array:417:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1272:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)' 1272 | get(pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1272:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1277:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)' 1277 | get(const pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1277:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1282:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_T1, _T2>&&)' 1282 | get(pair<_Tp, _Up>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1282:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1287:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_T1, _T2>&&)' 1287 | get(const pair<_Tp, _Up>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1287:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1292:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_Up, _Tp>&)' 1292 | get(pair<_Up, _Tp>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1292:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1297:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_Up, _Tp>&)' 1297 | get(const pair<_Up, _Tp>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1297:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1302:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_Up, _Tp>&&)' 1302 | get(pair<_Up, _Tp>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1302:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:1307:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_Up, _Tp>&&)' 1307 | get(const pair<_Up, _Tp>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1307:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/tuple:2476:5: note: candidate: 'template<long unsigned int
s758535043
p03685
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <cstring> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> #include <unordered_set> #include <unordered_map> #include <array> #include <cassert> #include <bitset> using namespace std; using LL = long long; LL R, C, N; struct rim { LL x, y, id; int val; rim(LL xx, LL yy, LL idid) :x(xx), y(yy), id(idid) { val = value(); } LL value()const { if (y == 0)return x; if (x == R)return R + y; if (y == C)return R + C + R - x; assert(x == 0); return R + C + R + C - y; } }; int main(void) { cin >> R >> C >> N; vector<rim>cash; for (int i = 0; i < N; ++i) { LL x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; bool fl1 = (x1 == 0 || x1 == R); bool fl2 = (y1 == 0 || y1 == C); bool fl3 = (x2 == 0 || x2 == R); bool fl4 = (y2 == 0 || y2 == C); if ((fl1 || fl2) && (fl3 || fl4)) { cash.push_back(rim(x1, y1, i)); cash.push_back(rim(x2, y2, i)); } } sort(cash.begin(), cash.end(), [](const rim& c1, const rim&c2) { return c1.value() < c2.value(); }); list<int>ids; for (auto& a : cash) { ids.push_back(a.id); } auto lef = ids.begin(); auto rht = lef; rht++; for (int i = 0; i < 1e7; ++i) { while (*lef == *rht) { lef = ids.erase(lef); lef = ids.erase(lef); if (ids.empty()) { cout << "YES\n"; return 0; } rht = lef; if (lef == ids.begin())lef = ids.end(); --lef; } lef++; rht++; if (lef == ids.end())lef = ids.begin(); if (rht == ids.end())rht = ids.begin(); if (ids.empty()) { cout << "YES\n"; return 0; } } cout << "NO\n"; return 0; }
a.cc: In function 'int main()': a.cc:72:9: error: 'list' was not declared in this scope 72 | list<int>ids; | ^~~~ a.cc:26:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>' 25 | #include <bitset> +++ |+#include <list> 26 | using namespace std; a.cc:72:14: error: expected primary-expression before 'int' 72 | list<int>ids; | ^~~ a.cc:75:17: error: 'ids' was not declared in this scope 75 | ids.push_back(a.id); | ^~~ a.cc:77:20: error: 'ids' was not declared in this scope 77 | auto lef = ids.begin(); | ^~~
s479001519
p03685
C++
#include <cstdio> #include <map> #include <utility> #include <vector> static const int MAXN = 1e5 + 4; static const int LOGN = 19; int mx, my, n; inline int get_point(int x, int y) { if (y == 0) return x; if (x == mx) return mx + y; if (y == my) return mx + my + (mx - x); if (x == 0) return mx + my + mx + (my - y); return -1; } typedef std::pair<int, int> num; std::vector<num> c; std::map<int, int> dis; int a[MAXN * 2]; namespace rmq { int min[LOGN][MAXN * 2], max[LOGN][MAXN * 2]; inline void build(int n, int *a) { for (int i = 0; i < n; ++i) min[0][i] = max[0][i] = a[i]; for (int j = 1; j < LOGN; ++j) for (int i = 0; i < n - (1 << j); ++i) { max[j][i] = std::max(max[j - 1][i], max[j - 1][i + (1 << (j - 1))]); min[j][i] = std::min(min[j - 1][i], min[j - 1][i + (1 << (j - 1))]); } } inline std::pair<int, int> query(int l, int r) { if (l == r) return std::make_pair(min[0][l], max[0][l]); int sz = 8 * sizeof(int) - __builtin_clz(r - l) - 1; return std::make_pair( std::min(min[sz][l], min[sz][r - (1 << sz) + 1]), std::max(max[sz][l], max[sz][r - (1 << sz) + 1]) ); } } int main() { scanf("%d%d%d", &mx, &my, &n); for (int i = 0, x1, y1, x2, y2; i < n; ++i) { scanf("%d%d%d%d", &x1, &y1, &x2, &y2); int p1 = get_point(x1, y1), p2 = get_point(x2, y2); if (p1 != -1 && p2 != -1) { if (p1 > p2) std::swap(p1, p2); c.push_back(num(p1, p2)); dis.insert(std::make_pair(p1, 0)); dis.insert(std::make_pair(p2, 0)); } } int ct = 0; for (auto &kv : dis) kv.second = ct++; for (auto &p : c) { p.first = dis[p.first], p.second = dis[p.second]; a[p.first] = p.second; a[p.second] = p.first; } rmq::build(ct, a); std::sort(c.begin(), c.end()); for (auto p : c) if (p.second >= p.first + 2) { auto val = rmq::query(p.first + 1, p.second - 1); if (val.first < p.first || val.second > p.second) { puts("NO"); return 0; } } puts("YES"); return 0; }
a.cc: In function 'int main()': a.cc:68:10: error: 'sort' is not a member of 'std' 68 | std::sort(c.begin(), c.end()); | ^~~~
s324838846
p03685
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; const int kMod = 1e9+7; const int kMaxN = 1e5+10; struct Point { int x, y, i; Point(int x, int y, int i) : x(x), y(y), i(i) {} Point() {} }; struct FenTree { int n; vector<int> aib; FenTree(int n) : n(n) { aib.resize(n+1); } static inline int LSB(int i) { return i&-i; } void update(int i, int val) { for (; i <= n; i += LSB(i)) { aib[i] += val; } } int query(int i) { int res = 0; for (; i > 0; i -= LSB(i)) { res += aib[i]; } return res; } int query(int i, int j) { if (j > i) { return query(j) - query(i-1); } else { return query(j) + query(n) - query(i-1); } } }; bool on_border(int a, int b, int r, int c) { return (a == r || a == 0 || b == c || b == 0); } void Solve() { int r, c, n; cin >> r >> c >> n; vector<Point> points; vector<int> first(n+1), second(n+1); for (int i = 1; i <= n; ++i) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (on_border(x1, y1, r, c) && on_border(x2, y2, r, c)) { points.emplace_back(x1, y1, i); points.emplace_back(x2, y2, i); } } auto cmp = [&](Point a, Point b) { a.x -= 1; a.y -= 1; b.x -= 1; b.y -= 1; return atan2(a.y, a.x) < atan2(b.y, b.x); }; sort(points.begin(), points.end(), cmp); FenTree fen(points.size()); for (int i = 0; i < points.size(); ++i) { if (first[points[i].i]) { second[points[i].i] = i + 1; fen.update(i+1, -1); } else { first[points[i].i] = i + 1; fen.update(i+1, 1); } } for (int i = 0; i < points.size(); ++i) { if (i+1 == first[points[i].i]) { if(fen.query(first[points[i].i], second[points[i].i]) != 0) { cout << "NO\n"; return; } fen.update(i+1, -2); fen.update(second[points[i].i], 2); } } cout << "YES\n"; } int main() { int tests = 1; for (;tests; --tests) { Solve(); } }
a.cc: In lambda function: a.cc:81:24: error: 'atan2' was not declared in this scope 81 | return atan2(a.y, a.x) < atan2(b.y, b.x); | ^~~~~
s396105581
p03685
C++
#include <bits/stdc++.h> using namespace std; #define fo(i,s,t) for(int i = s; i <= t; ++ i) #define fd(i,s,t) for(int i = s; i >= t; -- i) int r, c, n, lucky; int main() { scanf("%d%d%d",&r,&c,&n); srand(time(null)); lucky = rand()%2; if(lucky == 0) printf("YES"); else printf("NO"); return 0; }
a.cc: In function 'int main()': a.cc:12:20: error: 'null' was not declared in this scope 12 | srand(time(null)); | ^~~~
s898837726
p03686
C++
12332131233333333333333333333333333333333333333333
a.cc:1:1: warning: integer constant is too large for its type 1 | 12332131233333333333333333333333333333333333333333 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:1:1: error: expected unqualified-id before numeric constant
s219907595
p03686
C++
#pragma GCC optimize(3,"Ofast") #include <bits/stdc++.h> using namespace std; template<class t> inline t read(t &x){ char c=getchar();bool f=0;x=0; while(!isdigit(c)) f|=c=='-',c=getchar(); while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar(); if(f) x=-x;return x; } template<class t> inline void write(t x){ if(x<0) putchar('-'),write(-x); else{if(x>9) write(x/10);putchar('0'+x%10);} } const int N=2e5+5; int n,m,ans,pn,p[N]; struct dislike{ int l,r; inline operator < (const dislike &nt) const { if(l==nt.l) return r>nt.r; return l<nt.l; } }a[N]; priority_queue<int,vector<int>,greater<int> > q; signed main(){ read(n);read(m); for(int i=1;i<=n;i++) read(a[i].l),read(a[i].r); sort(a+1,a+1+n); int l=1,r=m; for(int i=1;i<=n;i++){ q.push(a[i].r); if(l<=r&&l<=a[i].l) l++; else{ p[++pn]=q.top(); q.pop(); } } sort(p+1,p+1+pn,greater<int>()); for(int i=1;i<=pn;i++){ if(l<=r&&p[i]<=r) r--; else ans++; } write(ans); }
a.cc:20:16: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive] 20 | inline operator < (const dislike &nt) const { | ^~~~~~~~
s730497709
p03686
C++
#pragma GCC optimize(3,"Ofast") #include <bits/stdc++.h> using namespace std; template<class t> inline t read(t &x){ char c=getchar();bool f=0;x=0; while(!isdigit(c)) f|=c=='-',c=getchar(); while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar(); if(f) x=-x;return x; } template<class t> inline void write(t x){ if(x<0) putchar('-'),write(-x); else{if(x>9) write(x/10);putchar('0'+x%10);} } const int N=2e5+5; int n,m,ans,pn,p[N]; struct dislike{ int l,r; inline operator < (const dislike &nt) const { if(l==nt.l) return r>nt.r; return l<nt.l; } }a[N]; priority_queue<int,vector<int>,greater<int> > q; signed main(){ read(n);read(m); for(int i=1;i<=n;i++) read(a[i].l),read(a[i].r); sort(a+1,a+1+n); int l=1,r=m; for(int i=1;i<=n;i++){ q.push(a[i].r); if(l<=r&&l<=a[i].l) l++; else{ p[++pn]=q.top(); q.pop(); } } sort(p+1,p+1+pn,greater<int>()); for(int i=1;i<=pn;i++){ if(l<=r&&p[i]<=r) r--; else ans++; } write(ans); }
a.cc:20:16: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive] 20 | inline operator < (const dislike &nt) const { | ^~~~~~~~
s798503495
p03686
C++
#include <iostream> #include <vector> using namespace std; typedef long long ll; const int MAX_V = 200010; ll INF = 100000000000000; struct edge{ll to,cap,rev;}; vector<edge> G[MAX_V]; bool used[MAX_V]; ll b[MAX_V],f[MAX_V],can[MAX_V][MAX_V]; vector<int> v,w; void add_edge(ll from,ll to,ll cap){ G[from].push_back({to,cap,(ll)G[to].size()}); G[to].push_back({from,0,(ll)G[from].size() - 1}); } ll dfs(int s,int t,ll val){ for(edge e:G[s]){ if(used[e.to]) continue; b[e.to] += e.cap; if(b[e.to]>=val){ used[e.to] = true; v.push_back(e.to); w.push_back(e.to); } } if(v.size()==0) return 0; int vv = v.back(); if(vv==t) return 1; v.pop_back(); return dfs(vv,t,val); } ll rev_dfs(int s,int t,ll val){ for(int i=0;i<MAX_V;i++) f[i] = 0; f[t] = val; while(w.size()){ int now = w.back(); w.pop_back(); used[now] = false; for(edge ee:G[now]){ int from = ee.to; if(!used[from]) continue; int j = can[from][now]; if(j==-1) continue; edge &e = G[from][j]; ll f_ = min(f[now],e.cap); e.cap -= f_; G[e.to][e.rev].cap += f_; f[now] -= f_; f[from] += f_; } } } ll max_flow(int s,int t){ ll flow = 0,val = 0; int i,j; for(i=0;i<MAX_V;i++){ b[i] = 0; for(j=0;j<MAX_V;j++){ can[i][j]= -1; } for(j=0;j<G[i].size();j++){ can[i][G[i][j].to] = j; val = max(val,G[i][j].cap); } } while(val){ v.clear(); w.clear(); w.push_back(s); for(i=0;i<MAX_V;i++){ b[i] = 0; used[i] = false; } used[s] = true; if(!dfs(s,t,val)){ val /= 2; continue; } rev_dfs(s,t,val); flow += val; } return flow; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, m; cin >> n >> m; int s = n + 3 * m, t = s + 1; for (int i = 0; i < n; ++i) { int l, r; cin >> l >> r; --r; add_edge(s, i, 1); if (l) { add_edge(i, n + (l - 1), 1); } if (r < m) { add_edge(i, n + m + r, 1); } } for (int j = 0; j < m; ++j) { add_edge(n + j, n + 2 * m + j, 1); add_edge(n + m + j, n + 2 * m + j, 1); add_edge(n + 2 * m + j, t, 1); if (j) { add_edge(n + j, n + (j - 1), INF); } if (j < m - 1) { add_edge(n + m + j, n + m + (j + 1), INF); } } cout << n - max_flow(s, t) << endl; }
a.cc: In function 'll rev_dfs(int, int, ll)': a.cc:53:1: warning: no return statement in function returning non-void [-Wreturn-type] 53 | } | ^ /tmp/ccRhfdeM.o: in function `dfs(int, int, long long)': a.cc:(.text+0x1eb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccRhfdeM.o a.cc:(.text+0x208): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccRhfdeM.o a.cc:(.text+0x241): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccRhfdeM.o a.cc:(.text+0x261): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccRhfdeM.o a.cc:(.text+0x284): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccRhfdeM.o /tmp/ccRhfdeM.o: in function `rev_dfs(int, int, long long)': a.cc:(.text+0x30e): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccRhfdeM.o a.cc:(.text+0x322): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccRhfdeM.o a.cc:(.text+0x557): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccRhfdeM.o /tmp/ccRhfdeM.o: in function `max_flow(int, int)': a.cc:(.text+0x6fe): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccRhfdeM.o a.cc:(.text+0x70d): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccRhfdeM.o a.cc:(.text+0x723): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s192145446
p03686
C++
#include <iostream> #include<vector> #include<queue> #include<algorithm> using namespace std; const int N = 2e5 + 5; typedef bool boolean #define pii pair<int, int> int n, m; pii seg[N]; int uf[N]; priority_queue<int, vector<int>, greater<int>> Q; int find(int x) { return uf[x] == x ? x : (uf[x] = find(uf[x])); } void unit(int x, int y) { x = find(x), y = find(y); if (x > y) swap(x, y); if (x ^ y) uf[x] = y; } int main() { scanf("%d%d", &n, &m); for (int i = 1, l, r; i <= n; i++) { scanf("%d%d", &l, &r); seg[i] = pii(l, r); } sort(seg + 1, seg + n + 1); uf[0] = 1; for (int i = 1; i <= m + 1; i++) { uf[i] = i; } pii *p = seg + 1, *_p = seg + n + 1; int ans = 0; for (int i = 0; i <= m; i++) { if (i && find(i) == i) { Q.push(0); } else if (i) { Q.push(i); } while (p != _p && p->first == i) { int R = p->second; boolean suc = false; if (!Q.empty()) { int tp = Q.top(); if (tp < R) { int p = find(tp); if (p <= m) { unit(p, p + 1); Q.pop(); Q.push(R); ans++; suc = true; } } } if (!suc) { int p = find(R); if (p <= m) { unit(p, p + 1); ans++; suc = true; } } p++; } } printf("%d\n", n - ans); return 0; #include <bits/stdc++.h> using namespace std; typedef bool boolean; const int N = 2e5 + 5; #define pii pair<int, int> int n, m; pii seg[N]; int uf[N]; priority_queue<int, vector<int>, greater<int>> Q; int find(int x) { return uf[x] == x ? x : (uf[x] = find(uf[x])); } void unit(int x, int y) { x = find(x), y = find(y); if (x > y) swap(x, y); if (x ^ y) uf[x] = y; } int main() { scanf("%d%d", &n, &m); for (int i = 1, l, r; i <= n; i++) { scanf("%d%d", &l, &r); seg[i] = pii(l, r); } sort(seg + 1, seg + n + 1); uf[0] = 1; for (int i = 1; i <= m + 1; i++) { uf[i] = i; } pii *p = seg + 1, *_p = seg + n + 1; int ans = 0; for (int i = 0; i <= m; i++) { if (i && find(i) == i) { Q.push(0); } else if (i) { Q.push(i); } while (p != _p && p->first == i) { int R = p->second; boolean suc = false; if (!Q.empty()) { int tp = Q.top(); if (tp < R) { int p = find(tp); if (p <= m) { unit(p, p + 1); Q.pop(); Q.push(R); ans++; suc = true; } } } if (!suc) { int p = find(R); if (p <= m) { unit(p, p + 1); ans++; suc = true; } } p++; } } printf("%d\n", n - ans); return 0; }
a.cc:11:1: error: expected initializer before 'int' 11 | int n, m; | ^~~ a.cc: In function 'int main()': a.cc:27:24: error: 'n' was not declared in this scope 27 | scanf("%d%d", &n, &m); | ^ a.cc:27:28: error: 'm' was not declared in this scope; did you mean 'tm'? 27 | scanf("%d%d", &n, &m); | ^ | tm a.cc:47:25: error: 'boolean' was not declared in this scope; did you mean 'bool'? 47 | boolean suc = false; | ^~~~~~~ | bool a.cc:57:49: error: 'suc' was not declared in this scope 57 | suc = true; | ^~~ a.cc:61:30: error: 'suc' was not declared in this scope 61 | if (!suc) { | ^~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/assert.h:66:1: error: expected unqualified-id before string constant 66 | __BEGIN_DECLS | ^~~~~~~~~~~~~ /usr/include/setjmp.h:27:1: error: expected unqualified-id before string constant 27 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:39, from a.cc:74: /usr/include/c++/14/csetjmp:55:1: error: 'namespace' definition is not allowed here 55 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:40: /usr/include/c++/14/cstdarg:53:1: error: 'namespace' definition is not allowed here 53 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:45: /usr/include/c++/14/cstdint:48:1: error: 'namespace' definition is not allowed here 48 | namespace std | ^~~~~~~~~ /usr/include/c++/14/bitset:71:15: error: expected '=' before '__attribute__' 71 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bitset:71:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bitset:71:14: error: expected ';' before '__attribute__' 71 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bitset:72:1: error: expected primary-expression before '{' token 72 | { | ^ /usr/include/c++/14/bitset:1710:15: error: expected '=' before '__attribute__' 1710 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bitset:1710:15: error: expected identifier before '__attribute__' /usr/include/c++/14/bitset:1710:14: error: expected ';' before '__attribute__' 1710 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bitset:1711:1: error: expected primary-expression before '{' token 1711 | { | ^ /usr/include/c++/14/bits/std_function.h:45:15: error: expected '=' before '__attribute__' 45 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/std_function.h:45:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/functional:59, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/bits/std_function.h:45:14: error: expected ';' before '__attribute__' 45 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/std_function.h:46:1: error: expected primary-expression before '{' token 46 | { | ^ In file included from /usr/include/c++/14/bits/hashtable_policy.h:38, from /usr/include/c++/14/bits/hashtable.h:35, from /usr/include/c++/14/bits/unordered_map.h:33, from /usr/include/c++/14/unordered_map:41, from /usr/include/c++/14/functional:63: /usr/include/c++/14/ext/aligned_buffer.h:40:1: error: 'namespace' definition is not allowed here 40 | namespace __gnu_cxx | ^~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:42:15: error: expected '=' before '__attribute__' 42 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:42:15: error: expected identifier before '__attribute__' /usr/include/c++/14/bits/hashtable_policy.h:42:14: error: expected ';' before '__attribute__' 42 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/hashtable_policy.h:43:1: error: expected primary-expression before '{' token 43 | { | ^ /usr/include/c++/14/bits/enable_special_members.h:37:15: error: expected '=' before '__attribute__' 37 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/enable_special_members.h:37:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/bits/hashtable.h:36: /usr/include/c++/14/bits/enable_special_members.h:37:14: error: expected ';' before '__attribute__' 37 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/enable_special_members.h:38:1: error: expected primary-expression before '{' token 38 | { | ^ /usr/include/c++/14/bits/node_handle.h:44:15: error: expected '=' before '__attribute__' 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/node_handle.h:44:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/bits/hashtable.h:39: /usr/include/c++/14/bits/node_handle.h:44:14: error: expected ';' before '__attribute__' 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/node_handle.h:45:1: error: expected primary-expression before '{' token 45 | { | ^ /usr/include/c++/14/bits/hashtable.h:42:15: error: expected '=' before '__attribute__' 42 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:42:15: error: expected identifier before '__attribute__' /usr/include/c++/14/bits/hashtable.h:42:14: error: expected ';' before '__attribute__' 42 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/hashtable.h:43:1: error: expected primary-expression before '{' token 43 | { | ^ /usr/include/c++/14/bits/unordered_map.h:38:15: error: expected '=' before '__attribute__' 38 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/unordered_map.h:38:15: error: expected identifier before '__attribute__' /usr/include/c++/14/bits/unordered_map.h:38:14: error: expected ';' before '__attribute__' 38 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/unordered_map.h:39:1: error: expected primary-expression before '{' token 39 | { | ^ In file included from /usr/include/c++/14/unordered_map:43: /usr/include/c++/14/bits/erase_if.h:39:1: error: 'namespace' definition is not allowed here 39 | namespace std | ^~~~~~~~~ /usr/include/c++/14/unordered_map:60:15: error: expected '=' before '__attribute__' 60 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/unordered_map:60:15: error: expected identifier before '__attribute__' /usr/include/c++/14/unordered_map:60:14: error: expected ';' before '__attribute__' 60 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/unordered_map:61:1: error: expected primary-expression before '{' token 61 | { | ^ /usr/include/c++/14/array:54:15: error: expected '=' before '__attribute__' 54 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/array:54:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/functional:65: /usr/include/c++/14/array:54:14: error: expected ';' before '__attribute__' 54 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/array:55:1: error: expected primary-expression before '{' token 55 | { | ^ /usr/include/c++/14/functional:92:15: error: expected '=' before '__attribute__' 92 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/functional:92:15: error: expected identifier before '__attribute__' /usr/include/c++/14/functional:92:14: error: expected ';' before '__attribute__' 92 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/functional:93:1: error: expected primary-expression before '{' token 93 | { | ^ /usr/include/c++/14/bits/stream_iterator.h:40:15: error: expected '=' before '__attribute__' 40 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stream_iterator.h:40:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/iterator:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/stream_iterator.h:40:14: error: expected ';' before '__attribute__' 40 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/stream_iterator.h:41:1: error: expected primary-expression before '{' token
s310049557
p03686
C++
#include <iostream> #include<vector> #include<queue> #include<algorithm> using namespace std; const int N = 2e5 + 5; #define pii pair<int, int> int n, m; pii seg[N]; int uf[N]; priority_queue<int, vector<int>, greater<int>> Q; int find(int x) { return uf[x] == x ? x : (uf[x] = find(uf[x])); } void unit(int x, int y) { x = find(x), y = find(y); if (x > y) swap(x, y); if (x ^ y) uf[x] = y; } int main() { scanf("%d%d", &n, &m); for (int i = 1, l, r; i <= n; i++) { scanf("%d%d", &l, &r); seg[i] = pii(l, r); } sort(seg + 1, seg + n + 1); uf[0] = 1; for (int i = 1; i <= m + 1; i++) { uf[i] = i; } pii *p = seg + 1, *_p = seg + n + 1; int ans = 0; for (int i = 0; i <= m; i++) { if (i && find(i) == i) { Q.push(0); } else if (i) { Q.push(i); } while (p != _p && p->first == i) { int R = p->second; boolean suc = false; if (!Q.empty()) { int tp = Q.top(); if (tp < R) { int p = find(tp); if (p <= m) { unit(p, p + 1); Q.pop(); Q.push(R); ans++; suc = true; } } } if (!suc) { int p = find(R); if (p <= m) { unit(p, p + 1); ans++; suc = true; } } p++; } } printf("%d\n", n - ans); return 0; #include <bits/stdc++.h> using namespace std; typedef bool boolean; const int N = 2e5 + 5; #define pii pair<int, int> int n, m; pii seg[N]; int uf[N]; priority_queue<int, vector<int>, greater<int>> Q; int find(int x) { return uf[x] == x ? x : (uf[x] = find(uf[x])); } void unit(int x, int y) { x = find(x), y = find(y); if (x > y) swap(x, y); if (x ^ y) uf[x] = y; } int main() { scanf("%d%d", &n, &m); for (int i = 1, l, r; i <= n; i++) { scanf("%d%d", &l, &r); seg[i] = pii(l, r); } sort(seg + 1, seg + n + 1); uf[0] = 1; for (int i = 1; i <= m + 1; i++) { uf[i] = i; } pii *p = seg + 1, *_p = seg + n + 1; int ans = 0; for (int i = 0; i <= m; i++) { if (i && find(i) == i) { Q.push(0); } else if (i) { Q.push(i); } while (p != _p && p->first == i) { int R = p->second; boolean suc = false; if (!Q.empty()) { int tp = Q.top(); if (tp < R) { int p = find(tp); if (p <= m) { unit(p, p + 1); Q.pop(); Q.push(R); ans++; suc = true; } } } if (!suc) { int p = find(R); if (p <= m) { unit(p, p + 1); ans++; suc = true; } } p++; } } printf("%d\n", n - ans); return 0; }
a.cc: In function 'int main()': a.cc:47:25: error: 'boolean' was not declared in this scope; did you mean 'bool'? 47 | boolean suc = false; | ^~~~~~~ | bool a.cc:57:49: error: 'suc' was not declared in this scope 57 | suc = true; | ^~~ a.cc:61:30: error: 'suc' was not declared in this scope 61 | if (!suc) { | ^~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/assert.h:66:1: error: expected unqualified-id before string constant 66 | __BEGIN_DECLS | ^~~~~~~~~~~~~ /usr/include/setjmp.h:27:1: error: expected unqualified-id before string constant 27 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:39, from a.cc:74: /usr/include/c++/14/csetjmp:55:1: error: 'namespace' definition is not allowed here 55 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:40: /usr/include/c++/14/cstdarg:53:1: error: 'namespace' definition is not allowed here 53 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:45: /usr/include/c++/14/cstdint:48:1: error: 'namespace' definition is not allowed here 48 | namespace std | ^~~~~~~~~ /usr/include/c++/14/bitset:71:15: error: expected '=' before '__attribute__' 71 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bitset:71:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bitset:71:14: error: expected ';' before '__attribute__' 71 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bitset:72:1: error: expected primary-expression before '{' token 72 | { | ^ /usr/include/c++/14/bitset:1710:15: error: expected '=' before '__attribute__' 1710 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bitset:1710:15: error: expected identifier before '__attribute__' /usr/include/c++/14/bitset:1710:14: error: expected ';' before '__attribute__' 1710 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bitset:1711:1: error: expected primary-expression before '{' token 1711 | { | ^ /usr/include/c++/14/bits/std_function.h:45:15: error: expected '=' before '__attribute__' 45 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/std_function.h:45:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/functional:59, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/bits/std_function.h:45:14: error: expected ';' before '__attribute__' 45 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/std_function.h:46:1: error: expected primary-expression before '{' token 46 | { | ^ In file included from /usr/include/c++/14/bits/hashtable_policy.h:38, from /usr/include/c++/14/bits/hashtable.h:35, from /usr/include/c++/14/bits/unordered_map.h:33, from /usr/include/c++/14/unordered_map:41, from /usr/include/c++/14/functional:63: /usr/include/c++/14/ext/aligned_buffer.h:40:1: error: 'namespace' definition is not allowed here 40 | namespace __gnu_cxx | ^~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:42:15: error: expected '=' before '__attribute__' 42 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:42:15: error: expected identifier before '__attribute__' /usr/include/c++/14/bits/hashtable_policy.h:42:14: error: expected ';' before '__attribute__' 42 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/hashtable_policy.h:43:1: error: expected primary-expression before '{' token 43 | { | ^ /usr/include/c++/14/bits/enable_special_members.h:37:15: error: expected '=' before '__attribute__' 37 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/enable_special_members.h:37:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/bits/hashtable.h:36: /usr/include/c++/14/bits/enable_special_members.h:37:14: error: expected ';' before '__attribute__' 37 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/enable_special_members.h:38:1: error: expected primary-expression before '{' token 38 | { | ^ /usr/include/c++/14/bits/node_handle.h:44:15: error: expected '=' before '__attribute__' 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/node_handle.h:44:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/bits/hashtable.h:39: /usr/include/c++/14/bits/node_handle.h:44:14: error: expected ';' before '__attribute__' 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/node_handle.h:45:1: error: expected primary-expression before '{' token 45 | { | ^ /usr/include/c++/14/bits/hashtable.h:42:15: error: expected '=' before '__attribute__' 42 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:42:15: error: expected identifier before '__attribute__' /usr/include/c++/14/bits/hashtable.h:42:14: error: expected ';' before '__attribute__' 42 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/hashtable.h:43:1: error: expected primary-expression before '{' token 43 | { | ^ /usr/include/c++/14/bits/unordered_map.h:38:15: error: expected '=' before '__attribute__' 38 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/unordered_map.h:38:15: error: expected identifier before '__attribute__' /usr/include/c++/14/bits/unordered_map.h:38:14: error: expected ';' before '__attribute__' 38 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/unordered_map.h:39:1: error: expected primary-expression before '{' token 39 | { | ^ In file included from /usr/include/c++/14/unordered_map:43: /usr/include/c++/14/bits/erase_if.h:39:1: error: 'namespace' definition is not allowed here 39 | namespace std | ^~~~~~~~~ /usr/include/c++/14/unordered_map:60:15: error: expected '=' before '__attribute__' 60 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/unordered_map:60:15: error: expected identifier before '__attribute__' /usr/include/c++/14/unordered_map:60:14: error: expected ';' before '__attribute__' 60 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/unordered_map:61:1: error: expected primary-expression before '{' token 61 | { | ^ /usr/include/c++/14/array:54:15: error: expected '=' before '__attribute__' 54 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/array:54:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/functional:65: /usr/include/c++/14/array:54:14: error: expected ';' before '__attribute__' 54 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/array:55:1: error: expected primary-expression before '{' token 55 | { | ^ /usr/include/c++/14/functional:92:15: error: expected '=' before '__attribute__' 92 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/functional:92:15: error: expected identifier before '__attribute__' /usr/include/c++/14/functional:92:14: error: expected ';' before '__attribute__' 92 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/functional:93:1: error: expected primary-expression before '{' token 93 | { | ^ /usr/include/c++/14/bits/stream_iterator.h:40:15: error: expected '=' before '__attribute__' 40 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stream_iterator.h:40:15: error: expected identifier before '__attribute__' In file included from /usr/include/c++/14/iterator:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/stream_iterator.h:40:14: error: expected ';' before '__attribute__' 40 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/14/bits/stream_iterator.h:41:1: error: expected primary-expression before '{' token 41 | { | ^ /usr/include/c++/14/limits:158:15: error: expected '=' before '__attribute__' 158 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/limits:158:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:55: /usr/include/c++/14/limits:158:14: error: ex
s226124049
p03686
C++
#include <bits/stdc++.h> //#include <unistd.h> //#include <iostream> using namespace std; #define DEBUG(x) cerr<<#x<<": "<<x<<endl; #define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl; #define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;} typedef long long ll; #define int ll #define vi vector<int> #define vl vector<ll> #define vii vector< vector<int> > #define vll vector< vector<ll> > #define vs vector<string> #define pii pair<int,int> #define pis pair<int,string> #define psi pair<string,int> #define pll pair<ll,ll> template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); } template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); } template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; } #define X first #define Y second #define rep(i,n) for(int i=0;i<(n);i++) #define rep1(i,n) for(int i=1;i<=(n);i++) #define rrep(i,n) for(int i=(n)-1;i>=0;i--) #define rrep1(i,n) for(int i=(n);i>0;i--) #define REP(i,a,b) for(int i=a;i<b;i++) #define in(x, a, b) (a <= x && x < b) #define all(c) c.begin(),c.end() template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; } #define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end()); const ll inf = 1000000001; const ll INF = (ll)1e18 + 1; const long double pi = 3.1415926535897932384626433832795028841971L; #define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 }; #define fio() cin.tie(0); ios::sync_with_stdio(false); const ll MOD = 1000000007; //const ll MOD = 998244353; // #define mp make_pair //#define endl '\n' int n, m; vl memo; int f(int mid, vector<pii> &lr) { if (memo[mid] != -1) return memo[mid]; int idx = 0; priority_queue<int> pq; int res = 0; while (idx < n and lr[idx].first >= mid) { pq.push(lr[idx].second); idx++; } for (int i = mid - 1; i >= 0; i--) { while (idx < n and lr[idx].first >= i) { pq.push(lr[idx].second); idx++; } if (pq.size() > 0) { pq.pop(); res++; } } while (idx < n) { pq.push(lr[idx].second); idx++; } for (int i = m - 1; i >= mid; i--) { while (pq.size() > 0) { int to = pq.top(); pq.pop(); if (to <= i) { res++; break; } } if (pq.size() == 0) break; } memo[mid] = res; return res; } signed main() { fio(); cin >> n >> m; memo.resize(m + 2); fill(all(memo), -1); vector<pll> lr(n); rep (i, n) { cin >> lr[i].first >> lr[i].second; lr[i].first--; lr[i].second--; } auto cmp = [](pii a, pii b) { if (a.first != b.first) return a.first > b.first; else return a < b; }; sort(all(lr), cmp); int ma = 0; rep (i, m + 1) { chmax(ma, f(i, lr)); } cout << n - ma << endl; return 0; //DEBUG_VEC(lr); int l = 0, r = m; while (l + 2 < r) { int x1 = (2 * l + r) / 3, x2 = (l + 2 * r) / 3; int y1 = f(x1, lr), y2 = f(x2, lr); if (y1 == y2) { l = x1; r = x1; break; } if (y1 > y2) { r = x2; } else { l = x1; } } int ma = 0; for (int i = max(l - 1, 0LL); i <= min(r, m); i++) { chmax(ma, f(i, lr)); } cout << n - ma << endl; }
a.cc: In function 'int main()': a.cc:130:9: error: redeclaration of 'll ma' 130 | int ma = 0; | ^~ a.cc:107:9: note: 'll ma' previously declared here 107 | int ma = 0; | ^~
s234267316
p03686
C++
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, m, L, R; vector<int> val[N]; int lch[N << 2], rch[N << 2], Max[N << 2], lazy[N << 2]; inline void update(int x) { lazy[x]++; Max[x]++; } inline void pushup(int x) { Max[x] = max(Max[x << 1], Max[x << 1 | 1]); } inline void pushdown(int x) { if (lazy[x]) { update(x << 1, lazy[x]); update(x << 1 | 1, lazy[x]); lazy[x] = 0; } } void build(int x, int l, int r) { lch[x] = l; rch[x] = r; if (l == r) { Max[x] = l; return; } int mid = (l + r) / 2; build(x << 1, l, mid); build(x << 1 | 1, mid + 1, r); pushup(x); } void update(int x, int l, int r) { if (l <= lch[x] && rch[x] <= r) { update(x); return; } pushdown(x); int mid = (lch[x] + rch[x]) / 2; if (r <= mid) update(x << 1, l, r); else if (l > mid) update(x << 1 | 1, l, r); else update(x << 1, l, mid), update(x << 1 | 1, mid + 1, r); pushup(x); } int query(int x, int l, int r) { if (l <= lch[x] && rch[x] <= r) { return Max[x]; } pushdown(x); int mid = (lch[x] + rch[x]) / 2; if (r <= mid) return query(x << 1, l, r); else if (l > mid) return query(x << 1 | 1, l, r); else return max(query(x << 1, l, mid), query(x << 1 | 1, mid + 1, r)); } int ans = 0; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) { scanf("%d%d", &L, &R); val[L].push_back(R); } build(1, 0, m + 1); for (int i = 0; i <= m; ++i) { for (int j = 0; j < val[i].size(); ++j) { update(1, 0, val[i][j]); } ans = max(ans, query(1, i + 1, m + 1) - m - i - 1); } printf("%d\n", max(ans, n - m)); return 0; }
a.cc: In function 'void pushdown(int)': a.cc:20:15: error: too many arguments to function 'void update(int)' 20 | update(x << 1, lazy[x]); | ~~~~~~^~~~~~~~~~~~~~~~~ a.cc:8:13: note: declared here 8 | inline void update(int x) | ^~~~~~ a.cc:21:15: error: too many arguments to function 'void update(int)' 21 | update(x << 1 | 1, lazy[x]); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~ a.cc:8:13: note: declared here 8 | inline void update(int x) | ^~~~~~
s728596951
p03686
C++
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, m, L, R; vector<int> val[N]; int lch[N << 2], rch[N << 2], Max[N << 2], lazy[N << 2]; inline void update(int x, int v) { lazy[x] += v; Max[x] += v; } inline void pushup(int x) {Max[x] = max(Max[x << 1], Max[x << 1 | 1]);} inline void pushdown(int x) { if(lazy[x]) { update(x << 1, lazy[x]); update(x << 1 | 1, lazy[x]); lazy[x] = 0; } } void build(int x,int l, int r) { lch[x] = l; rch[x] = r; if(l == r) { Max[x] = l; return; } int mid = (l + r) / 2; build(x << 1, l, mid); build(x << 1 | 1, mid + 1, r); pushup(x); } void update(int x, int l, int r, int v) { if(l <= lch[x] && rch[x] <= r) { update(x, v); return; } pushdown(x); int mid = (lch[x] + rch[x]) / 2; if(r <= mid) update(x << 1, l, r, v); else if(l > mid) update(x << 1 | 1, l, r, v); else update(x << 1, l, mid, v), update(x << 1 | 1, mid + 1, r, v); pushup(x); } int query(int x, int l, int r) { if(l <= lch[x] && rch[x] <= r) { return Max[x]; } pushdown(x); int mid = (lch[x] + rch[x]) / 2; if(r <= mid) return query(x << 1, l, r); else if(l > mid) return query(x << 1 | 1, l, r); else return max(query(x << 1, l, mid), query(x << 1 | 1, mid + 1, r)); } int ans = 0; int main() { scanf("%d%d", &n, &m); for(int i = 1; i <= n; ++i) { scanf("%d%d", &L, &R); val[L].push_back(R); } build(1, 0, m + 1); for(int i = 0; i <= m; ++i) { for(int j = 0; j < val[i].size(); ++j) { update(1, 0, val[i][j], 1); } ans = max(ans, query(1, i + 1, m + 1) - m - i - 1); } printf("%d\n", max(ans, n - m)); return 0; } ​
a.cc:62:1: error: '\U0000200b' does not name a type 62 | ​ |
s966305735
p03686
C++
//package com.company; // Always comment out package when submitting. import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static class Task { public class SegmentTree { int n; int[] val; int[] lazy; public SegmentTree(int n) { this.n = n; val = new int[4 * n]; lazy = new int[4 * n]; } public void build(int[] initialVal) { // System.arraycopy(initialVal, 0, val, 0, initialVal.length); build(initialVal, 0, n, 1); } public void build(int[] initialVal, int l, int r, int idx) { if (l == r - 1) { val[idx] = initialVal[l]; return; } int mid = (l + r) >> 1; build(initialVal, l, mid, idx << 1); build(initialVal, mid, r, idx << 1 | 1); val[idx] = Math.max(val[idx << 1], val[idx << 1 | 1]); } public void push(int idx) { if ((idx << 1 | 1) < val.length) { lazy[idx << 1] += lazy[idx]; lazy[idx << 1 | 1] += lazy[idx]; val[idx << 1] += lazy[idx]; val[idx << 1 | 1] += lazy[idx]; lazy[idx] = 0; } } public void addRange(int L, int R, int v) { // for (int i = L; i < R; i++) { // val[i] += v; // } addRange(0, n, 1, L, R, v); } public void addRange(int l, int r, int idx, int L, int R, int v) { if (L <= l && r <= R) { lazy[idx] += v; val[idx] += v; return; } if (L >= r || l >= R) return; push(idx); int mid = (l + r) >> 1; addRange(l, mid, idx << 1, L ,R, v); addRange(mid, r, idx << 1 | 1, L ,R, v); val[idx] = Math.max(val[idx << 1], val[idx << 1 | 1]); } public int query() { // int mx = 0; // for (int i = 0; i < n; i++) { // mx = Math.max(mx, val[i]); // } // return mx; // return query(0, n, 1, 0, n); push(1); return val[1]; } public int query(int l, int r, int idx, int L, int R) { return 0; } } int n, m; int[][] lr; public void solve(Scanner sc, PrintWriter pw) throws IOException { n = sc.nextInt(); m = sc.nextInt(); lr = new int[n][2]; for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { lr[i][j] = sc.nextInt(); } } SegmentTree st = new SegmentTree(m + 1); int[] initialArr = new int[m + 1]; for (int i = 0; i < initialArr.length; i++) { initialArr[i] = -(initialArr.length - i); } st.build(initialArr); Arrays.sort(lr, new Comparator<int[]>() { @Override public int compare(int[] o1, int[] o2) { return o1[0] - o2[0]; } }); int maxVal = n - m; int free = 0; for (int i = 0; i < n; i++) { int l = lr[i][0]; int r = lr[i][1]; if (r <= m) { st.addRange(0, r + 1, 1); } else { free++; } maxVal = Math.max(maxVal, st.query() - l + free); } pw.println(Math.max(0, maxVal)); } } // template, actual code is in class Task. static long TIME_START, TIME_END; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); // Scanner sc = new Scanner(new FileInputStream("Test.in")); PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out)); // PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out")); Runtime runtime = Runtime.getRuntime(); long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory(); TIME_START = System.currentTimeMillis(); Task t = new Task(); t.solve(sc, pw); TIME_END = System.currentTimeMillis(); long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory(); pw.close(); // System.err.println("Memory increased: " + (usedMemoryAfter - usedMemoryBefore) / 1000000); // System.err.println("Time used: " + (TIME_END - TIME_START) + "."); } // Faster IO with BufferedReader wrapped with Scanner static class Scanner { StringTokenizer st; BufferedReader br; public Scanner(InputStream s) { br = new BufferedReader(new InputStreamReader(s)); } public Scanner(FileReader s) throws FileNotFoundException { br = new BufferedReader(s); } public String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return st.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public String nextLine() throws IOException { return br.readLine(); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public boolean ready() throws IOException { return br.ready(); } } }
a.cc:92:17: error: stray '@' in program 92 | @Override | ^ a.cc:3:1: error: 'import' does not name a type 3 | import java.io.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.math.BigInteger; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.util.*; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: expected unqualified-id before 'public' 7 | public class Main { | ^~~~~~
s201901065
p03686
C++
//package com.company; // Always comment out package when submitting. import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static class Task { public class SegmentTree { int n; int[] val; int[] lazy; public SegmentTree(int n) { this.n = n; val = new int[4 * n]; lazy = new int[4 * n]; } public void build(int[] initialVal) { // System.arraycopy(initialVal, 0, val, 0, initialVal.length); build(initialVal, 0, n, 1); } public void build(int[] initialVal, int l, int r, int idx) { if (l == r - 1) { val[idx] = initialVal[l]; return; } int mid = (l + r) >> 1; build(initialVal, l, mid, idx << 1); build(initialVal, mid, r, idx << 1 | 1); val[idx] = Math.max(val[idx << 1], val[idx << 1 | 1]); } public void push(int idx) { if ((idx << 1 | 1) < val.length) { lazy[idx << 1] += lazy[idx]; lazy[idx << 1 | 1] += lazy[idx]; val[idx << 1] += lazy[idx]; val[idx << 1 | 1] += lazy[idx]; lazy[idx] = 0; } } public void addRange(int L, int R, int v) { // for (int i = L; i < R; i++) { // val[i] += v; // } addRange(0, n, 1, L, R, v); } public void addRange(int l, int r, int idx, int L, int R, int v) { if (L <= l && r <= R) { lazy[idx] += v; val[idx] += v; return; } if (L >= r || l >= R) return; push(idx); int mid = (l + r) >> 1; addRange(l, mid, idx << 1, L ,R, v); addRange(mid, r, idx << 1 | 1, L ,R, v); val[idx] = Math.max(val[idx << 1], val[idx << 1 | 1]); } public int query() { // int mx = 0; // for (int i = 0; i < n; i++) { // mx = Math.max(mx, val[i]); // } // return mx; // return query(0, n, 1, 0, n); push(1); return val[1]; } public int query(int l, int r, int idx, int L, int R) { return 0; } } int n, m; int[][] lr; public void solve(Scanner sc, PrintWriter pw) throws IOException { n = sc.nextInt(); m = sc.nextInt(); lr = new int[n][2]; for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { lr[i][j] = sc.nextInt(); } } SegmentTree st = new SegmentTree(m + 1); int[] initialArr = new int[m + 1]; for (int i = 0; i < initialArr.length; i++) { initialArr[i] = -(initialArr.length - i); } st.build(initialArr); Arrays.sort(lr, new Comparator<int[]>() { @Override public int compare(int[] o1, int[] o2) { return o1[0] - o2[0]; } }); int maxVal = n - m; int free = 0; for (int i = 0; i < n; i++) { int l = lr[i][0]; int r = lr[i][1]; if (r <= m) { st.addRange(0, r + 1, 1); } else { free++; } maxVal = Math.max(maxVal, st.query() - l + free); } pw.println(Math.max(0, maxVal)); } } // template, actual code is in class Task. static long TIME_START, TIME_END; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); // Scanner sc = new Scanner(new FileInputStream("Test.in")); PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out)); // PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out")); Runtime runtime = Runtime.getRuntime(); long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory(); TIME_START = System.currentTimeMillis(); Task t = new Task(); t.solve(sc, pw); TIME_END = System.currentTimeMillis(); long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory(); pw.close(); // System.err.println("Memory increased: " + (usedMemoryAfter - usedMemoryBefore) / 1000000); // System.err.println("Time used: " + (TIME_END - TIME_START) + "."); } // Faster IO with BufferedReader wrapped with Scanner static class Scanner { StringTokenizer st; BufferedReader br; public Scanner(InputStream s) { br = new BufferedReader(new InputStreamReader(s)); } public Scanner(FileReader s) throws FileNotFoundException { br = new BufferedReader(s); } public String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return st.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public String nextLine() throws IOException { return br.readLine(); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public boolean ready() throws IOException { return br.ready(); } } }
a.cc:92:17: error: stray '@' in program 92 | @Override | ^ a.cc:3:1: error: 'import' does not name a type 3 | import java.io.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.math.BigInteger; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.util.*; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: expected unqualified-id before 'public' 7 | public class Main { | ^~~~~~
s444644981
p03686
C++
#include<queue> #include<cstdio> #include<algorithm> using namespace std; int n,m,l,r,tot,ans,tmp[200010]; pair<int,int>a[200010]; priority_queue<int>q; char buffer[10000010],*hed; char Getchar(){ return *hed++; } int rd(){ int x=0; char c; do c=Getchar(); while(!isdigit(c)); do{ x=(x<<1)+(x<<3)+(c^48); c=Getchar(); }while(isdigit(c)); return x; } int main(){ fread(buffer,1,10000000,stdin); hed=buffer; n=rd(),m=rd(); l=1,r=m; for(int i=1;i<=n;i++) a[i].first=rd(),a[i].second=-rd(); sort(a+1,a+n+1); for(int i=1;i<=n;i++){ q.push(a[i].second); if(l<=r&&l<=a[i].first) l++; else{ tmp[++tot]=-q.top(); q.pop(); } } sort(tmp+1,tmp+tot+1); for(int i=tot;i>=1;i--){ if(l<=r&&tmp[i]<=r) r--; else ans++; } printf("%d",ans); return 0; }
a.cc: In function 'int rd()': a.cc:16:16: error: 'isdigit' was not declared in this scope 16 | while(!isdigit(c)); | ^~~~~~~
s185881275
p03686
C++
#include <cstdio> #define gc getchar() inline int read(){ int x=0;char c=gc; for(;c<48||c>57;c=gc); for(;c>47&&c<58;c=gc) x=x*10+c-48; return x; } #define io read() #define maxn 800005 #define maxm 3200005 #define inf 0x7fffffff int n,m,s,t; int st[maxn],pv[maxm],p1[maxm],pf[maxm],tot=1; inline void side1(int u,int v,int f){ pv[++tot]=v; pf[tot]=f; p1[tot]=st[u]; st[u]=tot; } inline void side(int u,int v,int f){ side1(u,v,f);side1(v,u,0); }   inline void init(){ n=io;m=io; s=n+m*3+1;t=s+1; for(int i=1;i<=n;++i){ int l=io,r=io; side(s,i,1); if(l)side(i,n+l,1); if(r<=m)side(i,n+m+r,1); } int b2=n+m,b3=b2+m; for(int i=1;i<m;++i){ side(n+i+1,n+i,inf); side(b2+i,b2+i+1,inf); } for(int i=1;i<=m;++i){ side(n+i,b3+i,1); side(b2+i,b3+i,1); side(b3+i,t,1); } } int d[maxn],gap[maxn]; inline int sap(int x,int flow){ if(x==t)return flow; int f,rest=flow; for(int i=st[x];i;i=p1[i]){ int v=pv[i]; if(pf[i]&&d[x]==d[v]+1){ f=sap(v,pf[i]<rest?pf[i]:rest); pf[i]-=f; pf[i^1]+=f; rest-=f; if(!rest||d[s]==t)return flow-rest; } } if(!--gap[d[x]])d[s]=t; ++gap[++d[x]]; return flow-rest; }   inline void solve(){ int ans=n; while(d[s]<t)ans-=sap(s,inf); printf("%d\n",ans); }   int main(){ init(); solve(); return 0; }
a.cc:26:1: error: extended character   is not valid in an identifier 26 |   | ^ a.cc:67:1: error: extended character   is not valid in an identifier 67 |   | ^ a.cc:73:1: error: extended character   is not valid in an identifier 73 |   | ^ a.cc:26:1: error: '\U000000a0' does not name a type 26 |   | ^ a.cc:67:1: error: '\U000000a0' does not name a type 67 |   | ^ a.cc:73:1: error: '\U000000a0' does not name a type 73 |   | ^
s008696203
p03686
C++
#include <cstdio> #include <string.h> #include <iostream> using namespace std; #define N 810000 int n, m; int l[N], r[N], tx[N], mi[N], add[N]; int ans; bool cmp(int x, int y) { return l[x] < l[y]; } void mkt(int k, int q, int h) { if (q < h) { mkt(k * 2, q, (q + h) / 2); mkt(k * 2 + 1, (q + h) / 2 + 1, h); mi[k] = min(mi[k * 2], mi[k * 2 + 1]); }else { mi[k] = m + 1 - q; } } void modify(int k, int q, int h, int l, int r, int c) { if (l <= q && h <= r) add[k] += c; else { if (r <= (q + h) / 2) modify(k * 2, q, (q + h) / 2, l, r, c); else if ((q + h) / 2 < l) modify(k * 2 + 1, (q + h) / 2 + 1, h, l, r, c); else modify(k * 2, q, (q + h) / 2, l, r, c), modify(k * 2 + 1, (q + h) / 2 + 1, h, l, r, c); mi[k] = min(mi[k * 2] + add[k * 2], mi[k * 2 + 1] + add[k * 2 + 1]); } } int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d%d", &l[i], &r[i]); ans = max(0, n - m); ans = - ans; for (int i = 1; i <= n; i++) tx[i] = i; sort(tx + 1, tx + n + 1, cmp); mkt(1, 1, m + 1); for (int i = 1; i <= n; i++) { modify(1, 1, m + 1, 1, r[tx[i]], -1); ans = min(ans, l[tx[i]] + mi[1] + add[1]); // printf("?? %d %d\n", i, ans); } printf("%d\n", -ans); }
a.cc: In function 'int main()': a.cc:48:9: error: 'sort' was not declared in this scope; did you mean 'short'? 48 | sort(tx + 1, tx + n + 1, cmp); | ^~~~ | short
s118488150
p03686
C++
#include <cstdio> #include <iostream> using namespace std; const int N = 2e5 + 5; struct edge { int nxt, to; } e[N]; int fir[N], a[N]; namespace Segment_Tree { #define mid ((L + R) >> 1) #define no ID(L, R) #define lc ID(L, mid) #define rc ID(mid + 1, R) int key[N << 1], lazy[N << 1]; inline int ID(int L, int R) {return (L + R) | (L != R);} inline void PushDown(int L, int R) { if (!lazy[no] || L == R) return; lazy[lc] += lazy[no]; lazy[rc] += lazy[no]; key[lc] += lazy[no]; key[rc] += lazy[no]; lazy[no] = 0; } inline void PushUp(int L, int R) { key[no] = max(key[lc], key[rc]); } inline void Init(int L, int R) { lazy[no] = 0; if (L == R) { key[no] = L; return; } Init(L, mid); Init(mid + 1, R); PushUp(L, R); } inline void Add(int L, int R, int l, int r) { if (L == l && R == r) { key[no] ++; lazy[no] ++; return; } PushDown(L, R); if (r <= mid) Add(L, mid, l, r); else if (l > mid) Add(mid + 1, R, l, r); else { Add(L, mid, l, mid); Add(mid + 1, R, mid + 1, r); } PushUp(L, R); } inline int Max(int L, int R, int l, int r) { if (L == l && R == r) return key[no]; PushDown(L, R); if (r <= mid) return Max(L, mid, l, r); else if (l > mid) return Max(mid + 1, r, l, r); else return max(Max(L, mid, l, mid), Max(mid + 1, R, mid + 1, r)); } #undef mid #undef no #undef lc #undef rc } using namespace Segment_Tree; int main() { int ans = max(0, n - m), n, m; scanf("%d%d", &n, &m); for (int i = 1, l, r; i <= n; i ++) { scanf("%d%d", &l, &r); e[i] = (edge){fir[l], r}; fir[l] = i; } Segment_Tree::Init(0, m + 1); for (int i = 0; i <= m; i ++) { for (int j = fir[i]; j; j = e[j].nxt) Segment_Tree::Add(0, m + 1, 0, e[j].to); ans = max(ans, Segment_Tree::Max(0, m + 1, i + 1, m + 1) - m - i - 1); } printf("%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:70:20: error: 'n' was not declared in this scope 70 | int ans = max(0, n - m), n, m; | ^ a.cc:70:24: error: 'm' was not declared in this scope; did you mean 'tm'? 70 | int ans = max(0, n - m), n, m; | ^ | tm
s619101332
p03686
C++
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define For(i , a , b) for (int i = a , _b = b ; i <= _b ; ++i) #define Ford(i , a ,b) for (int i = a , _b = b : i >= _b ; --i) #define Rep(i , n) for (int i = 0 , _n = n ; i < _n ; ++i) #define sz(A) ((int)A.size()) #define LL(x) (x << 1) #define RR(x) ((x << 1) | 1) typedef pair<int , int> pt; const int maxn = 300000 + 123; int n, m; pt a[maxn]; #define fi first #define se second void ReadData() { cin >> n >> m; For(i,1,n) cin >> a[i].first >> a[i].second; } bool cmp(pt a, pt b) { if (a.second == b.second) return a.first > b.first return a.second > b.second; } class segmentTree{ public: int l[maxn * 4], h[maxn * 4]; int it[maxn * 4]; int lazy[maxn * 4]; void buildTree(const int x, const int lo, const int hi) { l[x] = lo; h[x] = hi; lazy[x] = 0; if (lo == hi) { it[x] = lo; } else { int mid = (lo + hi) >> 1; buildTree(LL(x), lo, mid); buildTree(RR(x),mid + 1, hi); it[x] = min(it[LL(x)], it[RR(x)]); } } void add(const int x, const int val) { it[x] += val; lazy[x] += val; } void pushDown(const int x) { if (lazy[x] != 0) { add(LL(x), lazy[x]); add(RR(x), lazy[x]); lazy[x] = 0; } } void update(const int x, const int u, const int v, const int val) { if (l[x] > v || h[x] < u) return; if (u <= l[x] && h[x] <= v) { add(x,val); return; } pushDown(x); update(LL(x),u,v,val); update(RR(x),u,v,val); it[x] = min(it[LL(x)], it[RR(x)]); } } tree; void Process() { tree.buildTree(1,0,200000); int minVal = maxn; sort(a + 1, a + 1 + n, cmp); For(i,1,n) { tree.update(1, a[i].first, 200000, -1); minVal = min(minVal, tree.it[1] + m - a[i].second + 1); } if (minVal >= 0) minVal = 0; cout << -minVal << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("input.inp" , "r", stdin); ReadData(); Process(); return 0; }
a.cc: In function 'bool cmp(pt, pt)': a.cc:28:55: error: expected ';' before 'return' 28 | if (a.second == b.second) return a.first > b.first | ^ | ; 29 | return a.second > b.second; | ~~~~~~
s957306813
p03686
C++
#include <queue> #include <cstdio> #include <cstring> #include <algorithm> #define MN 110000 using namespace std; struct na{int l,r;}p[MN]; bool cmpl(na a,na b){return a.l==b.l?a.r>b.r:a.l<b.l;} priority_queue<int,vector<int>,greater<int> > q,_q; int n,m,mmh; int main(){ cin >> n >> m; mmh = n; for (int i=1;i<=n;i++) cin >> p[i].l >> p[i].r; sort(p+1,p+1+n,cmpl); for (int i=1;i<=n;i++) if (p[i].l==q.size()) q.push(p[i].r),_q.push(q.top()),q.pop();else q.push(p[i].r),mmh--; for (int i=q.size()+1;i<=m&&!_q.empty();i++) if (_q.top()<=i) _q.pop(),mmh--; printf("%d\n",mmh); }
a.cc: In function 'int main()': a.cc:12:5: error: 'cin' was not declared in this scope 12 | cin >> n >> m; | ^~~ a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 4 | #include <algorithm> +++ |+#include <iostream> 5 | #define MN 110000
s170247470
p03686
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) #define reps(i,x,n) for(int i=x; i<(n); i++) #define rrep(i,n) for(int i=(n)-1; i>=0; i--) #define all(X) (X).begin(),(X).end() #define X first #define Y second #define pb push_back #define eb emplace_back using namespace std; typedef long long int ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); } const ll INF = 1e9+7; // 各ノードの情報 template <typename T> struct node { T v, lazy; node(){ v = INF; lazy = 0; } // ノードの値の更新 void merge(T vl, T vr){ v = min(vl, vr); } // ノードの値の更新(lazy適用) T add(int l, int r, T _v=0){ T sum = lazy + _v; v += sum; lazy = 0; return sum; } // 遅延分の変更(加算) void addLazy(T v){ lazy += v; } }; template <typename T, typename NODE=node<T> > class SegTree{ // 遅延分の適応と伝播(現在のノードの値を確定させてLazyを伝搬させる) void propLazy(int a, int b, int k, T v=0){ T lazy = data[k].add(a, b, v); if( k < N ){ data[k*2+0].addLazy(lazy); data[k*2+1].addLazy(lazy); } } // セグメントツリーをたどる T prop(int l, int r, T v, int a, int b, int k=1){ // 今いるノードの値を確定させる propLazy(a, b, k); // たどる NODE nd; // 結果保存用(範囲外の場合は初期値が返る) if( l <= a && b <= r ){ // 完全に範囲内の場合 propLazy(a, b, k, v); return data[k].v; }else if( l < b && a < r ){ // 中途半端に含まれる場合 int m = (a+b) / 2; T vl = prop(l,r,v, a, m, k*2); T vr = prop(l,r,v, m, b, k*2+1); data[k].merge( data[k*2].v, data[k*2+1].v ); nd.merge( vl, vr ); } return nd.v; } public: vector<NODE> data; int N; SegTree(int _N){ // _N <= (N = 2^k) を満たすNを見つける N = 1; while( N < _N ) N<<=1; data.resize(N*2); } // セグメントツリーの更新(指定した場所の値をvに変更) void update(int l, T v){ prop(l, l+1, v-get(l), 0, N); } // セグメントツリーの更新(範囲に加算) T add(int l, int r, T v){ return prop(l,r,v,0,N); } // 値を取得 [l,r) T get(int l, int r){ return prop(l,r,0,0,N); } // 値を取得 [l,l+1) T get(int l){ return prop(l,l+1,0,0,N); } }; int main(){ //ios_base::sync_with_stdio(0); int N, M, ans=0; vector<pii> v; cin >> N >> M; rep(i,N){ int L, R; cin >> L >> R; v.eb(R, L); } // Rの値が大きい順にソート sort(all(v)); reverse(all(v)); // SegTreeで累積和を持つ // (i番目の要素が持つ値) = (iまでの席数) - (iまでのどこかに座りたい人の数) // この値が、負になってはいけない。 SegTree<ll> sg(M+5); rep(i,M) sg.update(i+1, i+1); // 初期値は席数の累積和 // 左から順に座らせていく。 vector<pii> late; for(auto t: v){ int R = t.X; int L = t.Y; if( l > 0 && sg.get(L, M+2) > 0 ){ // 席があれば座りたい。座りたい人が増えるので、それ以降のsgは1減る。 sg.add(L, M+2, -1); }else{ // うまく座れない場合は、右側に座るとして後回し。 late.push_back( t ); } } // Rの値が小さい順にソート sort(all(late)); int pos = 0; // 今見ている席 for(auto t: late){ int R = t.X; int L = t.Y; // posに座ることが可能であれば座る。 while(true){ if( pos <= M && R <= pos && sg.get(pos, M+2) > 0 ){ // 座ることが可能 sg.add(pos, M+2, -1); pos++; }else if( pos < M ){ // 座れるまでposを進める pos++; continue; }else{ // 座ることが不可能 ans++; } break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:136:21: error: 'l' was not declared in this scope 136 | if( l > 0 && sg.get(L, M+2) > 0 ){ | ^
s016169229
p03686
C++
#include<string> #include<deque> #include<queue> #include<vector> #include<algorithm> #include<iostream> #include<set> #include<cmath> #include<tuple> #include<map> #include<functional> using namespace std; typedef long long int llint; typedef bool izryt; #define mp make_pair #define mt make_tuple #define pub push_back #define puf push_front #define pob pop_back #define pof pop_front #define fir first #define sec second #define res resize #define ins insert #define era erase template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}} template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}} template <typename T> class seg_tree{ public: T treemax,treemin,lazyplus; int seghi,segmg; seg_tree *left; seg_tree *right; seg_tree(int hi,int mg){ treemax=0;treemin=0;lazyplus=0; seghi=hi;segmg=mg; left=NULL;right=NULL; int tyu=(hi+mg)/2; if(hi+1<mg){make_left(hi,tyu);make_right(tyu,mg);} } ~seg_tree(){delete left;delete right;} void make_left(int hi,int mg){if(this->left!=NULL){cout<<"ばぐ"<<endl;throw(1);}this->left=new seg_tree(hi,mg);} void make_right(int hi,int mg){if(this->right!=NULL){cout<<"ばぐ"<<endl;throw(1);}this->right=new seg_tree(hi,mg);} void seg_plus(int hi,int mg,T val){//区間加算クエリ //timecount++;//計算量 if(hi<=seghi&&segmg<=mg){lazyplus+=val;return;} if(mg<=seghi||segmg<=hi){return;} left->seg_plus(hi,mg,val); right->seg_plus(hi,mg,val); treemin=min(left->treemin+left->lazyplus,right->treemin+right->lazyplus); treemax=max(left->treemax+left->lazyplus,right->treemax+right->lazyplus); return; } /*T ask_min(int hi,int mg){//区間(hi,mg]について,最小を返す //timecount++;//計算量 if(hi<=seghi&&segmg<=mg){return treemin+lazyplus;} if(mg<=seghi||segmg<=hi){return big;} T leret,riret; if(right!=NULL&&left!=NULL&&lazyplus!=0){ right->lazyplus+=this->lazyplus; left->lazyplus+=this->lazyplus; treemax+=lazyplus; treemin+=lazyplus; lazyplus=0; } leret=left->ask_min(hi,mg); riret=right->ask_min(hi,mg); return min(leret,riret); }*/ T ask_max(int hi,int mg){ //timecount++;//計算量 if(hi<=seghi&&segmg<=mg){return treemax+lazyplus;} if(mg<=seghi||segmg<=hi){return -big;} T leret,riret; if(right!=NULL&&left!=NULL&&lazyplus!=0){ right->lazyplus+=this->lazyplus; left->lazyplus+=this->lazyplus; treemax+=lazyplus; treemin+=lazyplus; lazyplus=0; } leret=left->ask_max(hi,mg); riret=right->ask_max(hi,mg); return max(leret,riret); } }; const int big=1e9; const int mod=1e9+7; //実装にかかった。 int main(void){ int i,j,n,m,q,w,ans=0; cin>>n>>m; maxeq(ans,n-m); vector<pair<int,int>>taka(n); seg_tree<int> isu(0,m+2); for(i=0;i<n;i++){cin>>q>>w;taka[i]=mp(q,w);} sort(taka.begin(),taka.end()); for(i=0;i<m+2;i++){isu.seg_plus(i,i+1,i-m-1);} //ans=maxeq(ans,高橋君の数-椅子の数) //この↑高橋君は椅子の集合以外に座れない for(i=0;i<n;i++){ isu.seg_plus(0,taka[i].sec+1,1); int nowisu=isu.ask_max(0,m+2)-taka[i].fir; //cout<<"nowisu="<<nowisu<<endl; //for(j=0;j<m+2;j++){cout<<i<<" "<<j<<" "<<isu.ask_max(j,j+1)<<endl;} maxeq(ans,nowisu); } cout<<ans<<endl; }
a.cc: In member function 'T seg_tree<T>::ask_max(int, int)': a.cc:74:50: error: 'big' was not declared in this scope 74 | if(mg<=seghi||segmg<=hi){return -big;} | ^~~
s851290795
p03686
C++
#include<bits/stdc++.h> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) typedef long long LL; typedef pair<LL,LL> P; const LL MAX_N = 1 << 18; //セグメント木を持つグローバル配列 LL n; P dat[2*MAX_N-1]; //初期化 void init(LL n_){ //簡単のために要素数を2のべき乗に n=1; while(n<n_) n*=2; //全ての値をINT_MAXに for(int i=0;i<2*n-1;i++) dat[i]=P(1e7,0); } //k番目の値(0-indexed)をaに変更 void update(int k,P p){ //葉の節点 k+=n-1; dat[k]=p; //登りながら更新 while(k>0){ k=(k-1)/2; dat[k] = min(dat[k*2+1],dat[k*2+2]); } } //[a,b)の最小値を求める //後ろの方の引数は、計算の簡単のための引数 //kは節点の番号、l,rはその接点が[l,r)に対応していることを表す //従って外からはquery(a,b,0,0,nと呼ぶ) P query(int a,int b,int k=0,int l=0,int r=n){ //[a,b)と[l,r)が交差しなければINT_MAX if(r<=a||b<=l) return P(1e7,0); //[a,b)が[l,r)を完全に含んでいればこの接点の値 if(a<=l&&r<=b) return dat[k]; else{ //そうでなければ、2つの子の最小値 P vl =query(a,b,k*2+1,l,(l+r)/2); P vr =query(a,b,k*2+2,(l+r)/2,r); return min(vl,vr); } } int N,M; int L[250001]; int R[250001]; bool used[250001]; vector<P>v; vector<LL>que; int main(){ cin>>N>>M; REP(i,N){ cin>>L[i]>>R[i]; v.push_back(P(R[i],L[i])); //if(i%1000==0)cout<<i<<endl; } sort(v.begin(),v.end()); reverse(v.begin(),v.end()); //初期化 init(M+10); REP(i,M+10){ update(i,P(-i,i)); used[i]=false; if(i>M){ used[i]=true; } } update(0,P(1e7,0)); used[0]=true; int c=0; //Riの大きい方から順に取り出す REP(i,N){ P q=query(0,v[i].second+1); if(q.first>M){ if(used[q.second]==false){ int a=0; int b=1/a; return -1; } que.push_back(v[i].first); c++; }else{ used[q.second]=true; update(q.second,P(1e7,0)); } } sort(que.begin(),que.end()); int count=0; for(int i=c+1,i<M+1;i++){ if(que.size()==count)break; //if(used[i]==false){ if(que[count]<=i){ count++; } //} } cout<<max(max(N-M,0),(int)que.size()-count)<<endl; return(0); }
a.cc: In function 'int main()': a.cc:100:24: error: expected ';' before '<' token 100 | for(int i=c+1,i<M+1;i++){ | ^ | ; a.cc:100:24: error: expected primary-expression before '<' token
s003003165
p03686
C++
#include <iostream> #include <vector> #include <cstring> using namespace std; int n,m; vector<int> l,r; int match[200000]; bool used[200000]; bool dfs(int v){ for(int i = 1;i <= l[v];i++){ int w = match[u]; if(w < 0){ match[i] = v; return true; } if(!used[i]){ used[i] = true; bool f = dfs(w); used[i] = false; if(f){ match[i] = v; return true; } } } for(int i = r[v];i <= m;i++){ int w = match[u]; if(w < 0){ match[i] = v; return true; } if(!used[i]){ used[i] = true; bool f = dfs(w); used[i] = false; if(f){ match[i] = v; return true; } } } return false; } int bipartite_matching(){ int res = 0; memset(match,-1,sizeof(match)); memset(used,0,sizeof(used)); for(int v = 0;v < n;v++){ if(dfs(v)){ res++; } } return res; } int i,j; string str; int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ int li,ri; cin >> li >> ri; l.push_back(li); r.push_back(ri); } long long ans = 0; cout << n-bipartite_matching() << endl; }
a.cc: In function 'bool dfs(int)': a.cc:14:19: error: 'u' was not declared in this scope 14 | int w = match[u]; | ^ a.cc:30:19: error: 'u' was not declared in this scope 30 | int w = match[u]; | ^
s834592484
p03686
C++
#include <bits/stdc++.h> using namespace std; typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc(i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec(i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define UB upper_bound #define LB lower_bound #define PQ priority_queue #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define FOR(it, v) for(auto it = v.begin(); it != v.end(); ++it) #define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it) template<typename T> bool setmin(T & a, T b) { if(b < a) { a = b; return true; } else { return false; } } template<typename T> bool setmax(T & a, T b) { if(b > a) { a = b; return true; } else { return false; } } template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } } template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } } template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- int n, m, ans; pair<int, int> p[200000]; pair<int, int> q[200000]; int main() { cin >> n >> m; inc(i, n) { int l, r; cin >> l >> r; l--; r--; p[i] = MP(r, l + m); } sort(p, p + n); int p = 0; inc(i, n) { int k = max(p + 1, p.FI); if(k <= p.SE) { p = k; } else { ans++; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:12: error: request for member 'first' in 'p', which is of non-class type 'int' 22 | #define FI first | ^~~~~ a.cc:58:38: note: in expansion of macro 'FI' 58 | int k = max(p + 1, p.FI); | ^~ a.cc:23:12: error: request for member 'second' in 'p', which is of non-class type 'int' 23 | #define SE second | ^~~~~~ a.cc:59:27: note: in expansion of macro 'SE' 59 | if(k <= p.SE) { p = k; } else { ans++; } | ^~
s634982638
p03686
C++
#include <bits/stdc++.h> #define Maxn 400007 using namespace std; int read() { int x=0,f=1;char ch=getchar(); while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();} while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int n,m,L[Maxn],R[Maxn],ans=0; int last[Maxn],next[Maxn]; bool vis[Maxn]; pair<int,int> pos[Maxn]; void del(int x) { next[last[x]]=next[x]; last[next[x]]=last[x]; vis[x]=false; } int pre(int x) { if (vis[x]) return x; while (x>0) { x=last[x]; if (vis[x]) return x; } return x; } int nxt(int x) { if (vis[x]) return x; while (x<m+1) { x=next[x]; if (vis[x]) return x; } return x; } int main() { n=read(),m=read(); for (int i=1;i<=n;i++) L[i]=read(),R[i]=read(); for (int i=1;i<=n;i++) pos[i]=make_pair(L[i],-R[i]); sort(pos+1,pos+n+1); for (int i=1;i<=m;i++) last[i]=i-1,next[i]=i+1; next[0]=1,last[m+1]=m; last[0]=0,next[m+1]=m+1; memset(vis,true,sizeof(vis)); for (int i=1;i<=n;i++) { int x=pre(pos[i].first),y=nxt(-pos[i].second); if (x>0) del(x); else if (y<m+1) del(y); else ++ans; } printf("%d\n",ans); return 0; }
a.cc: In function 'void del(int)': a.cc:17:9: error: reference to 'next' is ambiguous 17 | next[last[x]]=next[x]; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, 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_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:12:16: note: 'int next [400007]' 12 | int last[Maxn],next[Maxn]; | ^~~~ a.cc:17:23: error: reference to 'next' is ambiguous 17 | next[last[x]]=next[x]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:12:16: note: 'int next [400007]' 12 | int last[Maxn],next[Maxn]; | ^~~~ a.cc:18:14: error: reference to 'next' is ambiguous 18 | last[next[x]]=last[x]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:12:16: note: 'int next [400007]' 12 | int last[Maxn],next[Maxn]; | ^~~~ a.cc: In function 'int nxt(int)': a.cc:36:19: error: reference to 'next' is ambiguous 36 | x=next[x]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:12:16: note: 'int next [400007]' 12 | int last[Maxn],next[Maxn]; | ^~~~ a.cc: In function 'int main()': a.cc:50:29: error: reference to 'next' is ambiguous 50 | last[i]=i-1,next[i]=i+1; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:12:16: note: 'int next [400007]' 12 | int last[Maxn],next[Maxn]; | ^~~~ a.cc:51:9: error: reference to 'next' is ambiguous 51 | next[0]=1,last[m+1]=m; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:12:16: note: 'int next [400007]' 12 | int last[Maxn],next[Maxn]; | ^~~~ a.cc:52:19: error: reference to 'next' is ambiguous 52 | last[0]=0,next[m+1]=m+1; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:12:16: note: 'int next [400007]' 12 | int last[Maxn],next[Maxn]; | ^~~~
s134922532
p03686
C++
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int inf=10000000; int edge[2000000],next[2000000],flow[2000000],first[1000000]; int g[1000000],h[1000000]; int i,m,n,s,x,y,head,tail,sum_edge; inline void addedge(int x,int y,int f) { sum_edge++,edge[sum_edge]=y,next[sum_edge]=first[x],flow[sum_edge]=f,first[x]=sum_edge; return; } inline int oppedge(int x) { return ((x-1)^1)+1; } inline void buildgraph() { scanf("%d%d",&n,&m); for (i=1;i<=m;i++) { if (i<m) addedge(i,i+1,inf),addedge(i+1,i,0); if (i<m) addedge(m+i+1,m+i,inf),addedge(m+i,m+i+1,0); addedge(i,m+m+i,inf),addedge(m+m+i,i,0); addedge(m+i,m+m+i,inf),addedge(m+m+i,m+i,0); addedge(m+m+i,m+m+m+n+1,1),addedge(m+m+m+n+1,m+m+i,0); } for (i=1;i<=n;i++) { scanf("%d%d",&x,&y); addedge(0,m+m+m+i,1),addedge(m+m+m+i,0,0); if (x>0) addedge(m+m+m+i,m+x,inf),addedge(m+x,m+m+m+i,0); if (y<=m) addedge(m+m+m+i,y,inf),addedge(y,m+m+m+i,0); } return; } inline int dinic_bfs() { memset(h,0,sizeof(h)); tail=1,g[tail]=0,h[g[tail]]=1; for (head=1;head<=tail;head++) for (i=first[g[head]];i!=0;i=next[i]) if ((flow[i]) && (! h[edge[i]])) tail++,g[tail]=edge[i],h[g[tail]]=h[g[head]]+1; return h[m+m+m+n+1]; } inline int dinic_dfs(int now,int cap) { if (now==m+m+m+n+1) return cap; int s=0,t=0; for (int i=first[now];i!=0;i=next[i]) if ((flow[i]) && (h[edge[i]]==h[now]+1)) { t=dinic_dfs(edge[i],min(cap,flow[i])); s=s+t,cap=cap-t; flow[i]=flow[i]-t,flow[oppedge(i)]=flow[oppedge(i)]+t; if (! cap) break; } if (! s) h[now]=0; return s; } inline void maxflow() { while (dinic_bfs()) s=s+dinic_dfs(0,inf); printf("%d",n-s); return; } int main() { buildgraph(); maxflow(); return 0; }
a.cc: In function 'void addedge(int, int, int)': a.cc:15:37: error: reference to 'next' is ambiguous 15 | sum_edge++,edge[sum_edge]=y,next[sum_edge]=first[x],flow[sum_edge]=f,first[x]=sum_edge; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, from /usr/include/c++/14/algorithm:60, from a.cc:3: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:19: note: 'int next [2000000]' 9 | int edge[2000000],next[2000000],flow[2000000],first[1000000]; | ^~~~ a.cc: In function 'int dinic_bfs()': a.cc:54:46: error: reference to 'next' is ambiguous 54 | for (i=first[g[head]];i!=0;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:19: note: 'int next [2000000]' 9 | int edge[2000000],next[2000000],flow[2000000],first[1000000]; | ^~~~ a.cc: In function 'int dinic_dfs(int, int)': a.cc:65:38: error: reference to 'next' is ambiguous 65 | for (int i=first[now];i!=0;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:19: note: 'int next [2000000]' 9 | int edge[2000000],next[2000000],flow[2000000],first[1000000]; | ^~~~
s836745900
p03686
C++
#include <cmath> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <map> #include <list> #include <time.h> #include <math.h> #include <random> #include <deque> #include <queue> #include <cassert> #include <unordered_map> #include <iomanip> using namespace std; typedef long long ll; struct edge { int v, to; int cap, scap; }; const int M = 1e6 + 7; int dx[] = {0, 0, -1, 1}; int dy[] = {-1, 1, 0, 0}; vector<edge> e; vector<int> g[M]; int d[M]; int ptr[M]; int s, t; bool bfs() { for (int i = 0; i <= t; i++) { d[i] = -1; } queue<int> q; q.push(s); d[s] = 0; while (!q.empty()) { int v = q.front(); q.pop(); for (auto x : g[v]) { if (e[x].cap > 0 && d[e[x].to] == -1) { d[e[x].to] = d[v] + 1; q.push(e[x].to); } } } return d[t] != -1; } ll dfs(int v = s, int fl = 1e9) { if (!fl) { return 0; } if (v == t) { return fl; } for (; ptr[v] < (int) g[v].size(); ptr[v]++) { int x = g[v][ptr[v]]; if (e[x].cap > 0 && d[e[x].to] == d[v] + 1) { ll push = dfs(e[x].to, min(fl, e[x].cap)); if (push) { e[x].cap -= push; e[x ^ 1].cap += push; return push; } } } return 0; } void add_edge(int v, int to, int cap) { g[v].push_back(e.size()); e.push_back({v, to, cap, cap}); g[to].push_back(e.size()); e.push_back({to, v, 0, 0}); } int n, m; vector <int> ind; void build(int v, int l, int r) { if (r - l == 1) { ind.push_back(v + n); } else { int m = (l + r) / 2; add_edge(v + n, n + v * 2 + 1, 1); add_edge(v + n, n + v * 2 + 2, 1); build(v * 2 + 1, l, m); build(v * 2 + 2, m, r); } } void add(int i, int v, int l, int r, int tl, int tr) { if (tl >= r || tr <= l) { return; } if (tl >= l && tr <= r) { add_edge(i, n + v, 1); } else { int tm = (tl + tr) / 2; add(i, v * 2 + 1, l, r, tl, tm); add(i, v * 2 + 2, l, r, tm, tr); } } class Main { public: void solve(std::istream &in, std::ostream &out) { e.clear(); for (int i = 0; i < M; i++) { g[i].clear(); } in >> n >> m; ind.clear(); build(0, 0, m); for (int i = 0; i < n; i++) { int l, r; in >> l >> r; l--, r--; if (l != -1) { add(i, 0, 0, l + 1, 0, m); } if (r != m) { add(i, 0, r, m, 0, m); } } s = ind.back() + 1; t = ind.back() + 2; for (int i = 0; i < n; i++) { add_edge(s, i, 1); } for (int c : ind) { add_edge(c, t, 1); } ll ans = 0; while (bfs()) { for (int i = 0; i <= t; i++) { ptr[i] = 0; } while (ll cur = dfs()) { ans += cur; } } out << n - ans << '\n'; } };
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s562636912
p03687
C++
#include <iostream> #include <cstring> using namespace std; bool allLettersAreEqual(string str) { for(int i=0; i<str.size(); i++) { if(s[i] != s[0]) return false; } return true; } int bruteForce(int N, string str, int max) { int res = 1e9; // max for integer for(int i=0; i<N; i++) { // try out each letter in the string char target = str[i]; string str2 = str; int count = 0; while(!allLettersAreEqual(str2)) { string str3 = ""; for(int i=0; i<str2.size()-1; i++) { if(str2[i] == target || str2[i+1] == target) { str2 += target; } else str3 += str2[i]; } str2 = str3; count++; } res = min(res, count); } return max; } int main() { string str; cin >> str; int N = str.length(); cout << bruteForce(N, str, -1) << endl; }
a.cc: In function 'bool allLettersAreEqual(std::string)': a.cc:7:16: error: 's' was not declared in this scope 7 | if(s[i] != s[0]) return false; | ^
s258277299
p03687
C
#include<iostream> #include<vector> #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) using namespace std; //12:34 int main(){ string s; cin>>s; int head,cnt,max,min=s.size(); for(char c='a';c<='z';c++){ head=0; cnt=0; max=0; while(head<s.size()){ if(s[head]==c){ cnt=0; }else{ cnt+=1; if(max<cnt)max=cnt; } head++; } if(min>max)min=max; } cout<<min<<endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s358092768
p03687
C++
#include <iostream> using namespace std; int main() { cout<<"Hello World"; cin >> n; int A[2][n], Sum = 0, flag = 0, temp = 0; for(int i = 0; i < n; i++){ cin >> A[0][i]; Sum += A[0][i]; } for(int i = 0; i < n; i++){ if(!flag){ if(int((Sum - A[0][i])/(n - 1)) >= A[0][i]) flag = 1; } } if(flag == 1) cout << "Yes"; else cout << "No"; return 0; }
a.cc: In function 'int main()': a.cc:9:12: error: 'n' was not declared in this scope 9 | cin >> n; | ^ a.cc:12:16: error: 'A' was not declared in this scope 12 | cin >> A[0][i]; | ^ a.cc:19:27: error: 'A' was not declared in this scope 19 | if(int((Sum - A[0][i])/(n - 1)) >= A[0][i]) | ^
s453954887
p03687
C++
#include <iostream> #include <algorithm> #include <string> #include <queue> #include <cmath> #include <map> #include <iomanip> using namespace std; typedef long long ll; int main() { string str; cin >> str; bool same = true; for (size_t i = 0; i < str.length(); i++) { if (str[i] != s[0]) same = false; } if (same) { cout << 0 << endl; } ll ans = 1000; for (char c = 'a'; c < 'a' + 26; c++) { ll cnt = 0; bool flag = true; string temp = str; while (flag && temp.length() > 1) { flag = false; for (size_t i = 0; i < temp.length() - 1; i++) { string n; if (temp[i] == c || temp[i + 1] == c) { temp[i] = c; } else { flag = true; } } temp = temp.substr(0, temp.length() - 1); cnt++; } ans = min(cnt, ans); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:31: error: 's' was not declared in this scope 18 | if (str[i] != s[0]) same = false; | ^
s291145978
p03687
C++
#include <bits/stdc++.h> #include<chrono> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { string s; cin >> s; priority_queue<int, vector<int>, greater<int>> ans; bool same = true; rep(i, s.size()-1) { if (s[i] != s[i+1]){ same = false break; } } if (same) { cout << 0 << endl; return 0; } for (char i = 'a'; i <= 'z'; i++) { int count = 0; string t = s; while (t.size() > 0) { string nt; bool check = true; rep(j, t.size()-1) { if (t[j] == i || t[j+1] == i) { nt += i; } else { nt += t[j]; check = false; } } count++; t = nt; if (check) { break; } } ans.push(count); } cout << ans.top() << endl; }
a.cc: In function 'int main()': a.cc:15:25: error: expected ';' before 'break' 15 | same = false | ^ | ; 16 | break; | ~~~~~
s856320044
p03687
C++
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const ll mod = 1000000007; const int INF = 1001001001; const ll LINF = 1001001001001001001; int main(){ string s; cin >> s; vector<ll> a(26,0); ll ans = INF; for(int i=0;i<26;i++){ ll x = -1; ll mem = 0; char c = 'a' + i; for(int j=0;j<(int)(s.size());j++){ if(s.at(j)==c){ mem = max(mem,j-(x+1)); x=j; } } mem=max(mem,(s.size())-(x+1)); ans = min(ans,mem); //cout << c <<" "<<ans << endl; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:16: error: no matching function for call to 'max(ll&, long long unsigned int)' 25 | mem=max(mem,(s.size())-(x+1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: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:25:16: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 25 | mem=max(mem,(s.size())-(x+1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:25:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 25 | mem=max(mem,(s.size())-(x+1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s892339582
p03687
C++
#include <bits/stdc++.h> #define REP(i,n) for (int i = 0; i < (n); i++) #define RREP(i, s, n) for (int i = s; i < (n); i++) #define ALL(a) a.begin(), a.end() #define RALL(a) a.rbegin(), a.rend() template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; using ll = long long; typedef pair<int, int> pint; typedef pair<ll, ll> pll; const ll MOD = 1000000007; const ll INF = MOD * MOD; const int inf = (1<<29); int main() { string s; cin >> s; set<char> st; for (ll i = 0; i < s.length(); i++) { st.insert(s[i]); } if(s.size() == 1) { cout << 0 << endl; return 0; } ll ans = 100, cnt; for (auto key = st.begin(); key != st.end(); key++) { string str = s; bool flag = true; cbt = 1; while (flag) { string vacant; flag = false; for (ll i = 0; i < str.length()-1; i++) { if (str[i] == *key || str[i+1] == *key) { vacant += *key; } else { vacant += str[i]; flag = true; } } if (flag) { str = vacant; cnt ++; } } ans = min(ans, cnt); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:36:9: error: 'cbt' was not declared in this scope; did you mean 'cnt'? 36 | cbt = 1; | ^~~ | cnt
s408424407
p03687
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ string s; cin >> s; ll n=s.size(); ll ans,mx;] ll i,j for(i=0;i<n;i++){ mx=i-1; j=i+1; while(j<N){ if(S[i]==S[j])mx=max(j-i,0); } mx=max(mx,N-1-j); ans=min(ans,mx); } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:18:15: error: expected primary-expression before ']' token 18 | ll ans,mx;] | ^ a.cc:20:13: error: 'i' was not declared in this scope 20 | for(i=0;i<n;i++){ | ^
s443799685
p03687
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ string s; cin >> s; ll n=s.size(); ll ans,mx; for(i=0;i<n;i++){ mx=i-1; while(j<N){ if(S[i]==S[j])mx=max(j-i,0); } mx=max(mx,N-1-j); ans=min(ans,mx); } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'i' was not declared in this scope 19 | for(i=0;i<n;i++){ | ^ a.cc:21:15: error: 'j' was not declared in this scope 21 | while(j<N){ | ^ a.cc:21:17: error: 'N' was not declared in this scope 21 | while(j<N){ | ^ a.cc:22:16: error: 'S' was not declared in this scope 22 | if(S[i]==S[j])mx=max(j-i,0); | ^ a.cc:24:19: error: 'N' was not declared in this scope 24 | mx=max(mx,N-1-j); | ^ a.cc:24:23: error: 'j' was not declared in this scope 24 | mx=max(mx,N-1-j); | ^
s280961187
p03687
C++
#include <bits/stdc++.h> using namespace std; int main(){ string S; set<char> chars; for(int i=0;i<S.length();i++){ chars.insert(S[i])) } if(chars.size()==1){ cout << 0 << endl; } int res=100,times; for(auto key=chars.begin();key!=chars.end();key++){ string str = S; bool flag = true; times = 1; while (flag) { string vacant; flag = false; for (ll i = 0; i < str.length()-1; ++i) { if (str[i] == *key || str[i+1] == *key) { vacant += *key; } else{ vacant += str[i]; flag = true; } } if(flag){ str = vacant; times++; } } res = min(res,times); } cout << res << endl; }
a.cc: In function 'int main()': a.cc:7:23: error: expected ';' before ')' token 7 | chars.insert(S[i])) | ^ | ; a.cc:21:12: error: 'll' was not declared in this scope 21 | for (ll i = 0; i < str.length()-1; ++i) { | ^~ a.cc:21:22: error: 'i' was not declared in this scope 21 | for (ll i = 0; i < str.length()-1; ++i) { | ^
s763785367
p03687
C
#include <stdio.h> #include <stdlib.h> typedef struct { int flag; int cost; }moji_t; int main(void) { char s[110] = { 0 }; int len; moji_t moji[26] = { 0 }; scanf("%s", s); len = strlen(s); for (int i = 0; i < len; i++) moji[s[i] - 97].flag = 1; for (int i = 0; i < 26; i++) { int left = -1,temp=-1; if (moji[i].flag) { for (int j = 0; j < len; j++) { if (j == 0 && s[j] == i - 97)left = 0; else if (s[j] == i+97) { temp = j - left - 1; if(temp>moji[i].cost) moji[i].cost = temp; left = j; } else if (j == len - 1) { temp= len - 1 - left; if (temp > moji[i].cost) moji[i].cost = temp; left = j; } } } } int min = INT_MAX; for (int i = 0; i < 26; i++) { if (moji[i].flag&&min > moji[i].cost)min = moji[i].cost; } printf("%d",min); return 0; }
main.c: In function 'main': main.c:15:15: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 15 | len = strlen(s); | ^~~~~~ main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen' 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | main.c:15:15: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 15 | len = strlen(s); | ^~~~~~ main.c:15:15: note: include '<string.h>' or provide a declaration of 'strlen' main.c:36:19: error: 'INT_MAX' undeclared (first use in this function) 36 | int min = INT_MAX; | ^~~~~~~ main.c:3:1: note: 'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>' 2 | #include <stdlib.h> +++ |+#include <limits.h> 3 | main.c:36:19: note: each undeclared identifier is reported only once for each function it appears in 36 | int min = INT_MAX; | ^~~~~~~
s686633143
p03687
C++
#include<iostream> #include<stdio.h> #include<string> #include<vector> #include<map> #include<tuple> #include<algorithm> #include<cmath> #include<limits> #include<set> #include<queue> using namespace std; #define int long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } typedef pair<int, int>P; const int INF = 1e15; const int MOD = 1e9 + 7; const double PI = 3.14159265358979323846; signed main() { string s; cin >> s; int ans = INF; for (int i = s.size() - 1; i >= 0; i--) { vector<int>v; int cnt = 0; for(int j = 1; j <= i; j++) { if (s[i - j] != s[i])cnt++; else { v.push_back(cnt); cnt = 0; } } v.push_back(cnt); sort(v.begin(), v.end()); int top = v[v.size() - 1]; int num = max(s.size() - 1 - i, top); ans = min(ans, num); } cout << ans; }
a.cc: In function 'int main()': a.cc:39:30: error: no matching function for call to 'max(long long unsigned int, long long int&)' 39 | int num = max(s.size() - 1 - i, top); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ 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: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:39:30: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long long int') 39 | int num = max(s.size() - 1 - i, top); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /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:7: /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:39:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int' 39 | int num = max(s.size() - 1 - i, top); | ~~~^~~~~~~~~~~~~~~~~~~~~~~
s413261969
p03687
C++
#include<iostream> #include<stdio.h> #include<string> #include<vector> #include<map> #include<tuple> #include<algorithm> #include<cmath> #include<limits> #include<set> #include<queue> using namespace std; #define int long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } typedef pair<int, int>P; const int INF = 1e15; const int MOD = 1e9 + 7; const double PI = 3.14159265358979323846; signed main() { string s; cin >> s; int ans = INF; for (int i = s.size() - 1; i >= 0; i--) { priority_queue<int>q; int cnt = 0; for(int j = 1; j <= i; j++) { if (s[i - j] != s[i])cnt++; else { q.push(cnt); cnt = 0; } } q.push(cnt); int top = q.top(); int num = max(s.size() - 1 - i, top); ans = min(ans, num); } cout << ans; }
a.cc: In function 'int main()': a.cc:38:30: error: no matching function for call to 'max(long long unsigned int, long long int&)' 38 | int num = max(s.size() - 1 - i, top); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ 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: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:38:30: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long long int') 38 | int num = max(s.size() - 1 - i, top); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /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:7: /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:38:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int' 38 | int num = max(s.size() - 1 - i, top); | ~~~^~~~~~~~~~~~~~~~~~~~~~~
s564653799
p03687
C++
#include<iostream> #include<stdio.h> #include<string> #include<vector> #include<map> #include<tuple> #include<algorithm> #include<cmath> #include<limits> #include<set> #include<queue> using namespace std; #define int long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } typedef pair<int, int>P; const int INF = 1e15; const int MOD = 1e9 + 7; const double PI = 3.14159265358979323846; signed main() { string s; cin >> s; int ans = INF; for (int i = s.size() - 1; i >= 0; i--) { priority_queue<int>q; int cnt = 0; for(int j = 1; j <= i; j++) { if (s[i - j] != s[i])cnt++; else { q.push(cnt); cnt = 0; } } q.push(cnt); int num = max(s.size() - 1 - i, q.top()); ans = min(ans, num); } cout << ans; }
a.cc: In function 'int main()': a.cc:37:30: error: no matching function for call to 'max(long long unsigned int, const __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 37 | int num = max(s.size() - 1 - i, q.top()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ 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: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:37:30: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 37 | int num = max(s.size() - 1 - i, q.top()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:7: /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:37:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int' 37 | int num = max(s.size() - 1 - i, q.top()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s940715117
p03687
C++
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=(a);i<=(b);i++) #define per(i,a,b) for(int i=(a);i>=(b);i--) #define REP(i,n) for(int i=(0);i<(n);i++) #define fi first #define se second #define pb push_back #define mp make_pair using namespace std; typedef pair<int,int> pii; typedef vector<int> vi; typedef long long ll; template<class T> inline void read(T &x){ int f=0;x=0;char ch=getchar(); for(;!isdigit(ch);ch=getchar())f|=(ch=='-'); for(;isdigit(ch);ch=getchar())x=x*10+ch-'0'; if(f)x=-x; } int ans[505][505],H,W,h,w; ll sum; int main(){ read(H),read(W); read(h),read(w); rep(i,1,H){ rep(j,1,W){ int a=min(i,H+1-i),b=min(j,W+1-j); ans[i][j]=(a%h==0&&b%w==0||i==h&&j==w?-h*w:1); sum+=ans[i][j]; } } if(sum<=0) puts("No"); else{ puts("Yes"); rep(i,1,n){ rep(j,1,m) printf("%d ",ans[i][j]); puts(""); } } return 0; }
a.cc: In function 'int main()': a.cc:37:25: error: 'n' was not declared in this scope 37 | rep(i,1,n){ | ^ a.cc:2:38: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(int i=(a);i<=(b);i++) | ^ a.cc:38:33: error: 'm' was not declared in this scope 38 | rep(j,1,m) printf("%d ",ans[i][j]); | ^ a.cc:2:38: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(int i=(a);i<=(b);i++) | ^
s842007769
p03687
C++
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) s = read().decode().rstrip() ans = len(s) for i in range(97, 97+26): c = chr(i) cnt = 0 acc = s while len(acc) != acc.count(c): s_ = "" for j, _ in enumerate(acc): if j == len(acc)-1: break if acc[j:j+2].count(c) > 0: s_ += c else: s_ += acc[j] cnt += 1 acc = s_ ans = min(ans, cnt) print(ans)
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s730092296
p03687
C++
#include <bits/stdc++.h> #include <array> using namespace std; using ULL = unsigned long long; using UL = unsigned; using LL = long long; #define rep(i, n) for(UL i = 0; i < (n); i++) struct Problem { void Solve() { vector<UL> ans; ans.assign(26, 0); vector<UL> prev; prev.assign(26, (UL)-1); string S; cin >> S; rep(i, S.size()) { UL p = S[i] - 'a'; if (prev[p] == (UL)-1) { ans[p] = max(ans[p], i); } else { ans[p] = max(ans[p], (UL)(i - prev[p] - 1)); } prev[p] = i; } UL ans2 = 10000000; rep(i, 26) { if (prev[i] == (UL)-1) continue; ans[i] = max(ans[i], S.size() - 1 - prev[i]); ans2 = min(ans2, ans[i]); } cout << ans2 << endl; } Problem(); }; int main() { unique_ptr<Problem> p(new Problem()); p->Solve(); return 0; } Problem::Problem() { cout << fixed << setprecision(10); }
a.cc: In member function 'void Problem::Solve()': a.cc:28:37: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<unsigned int>, unsigned int>::value_type&, std::__cxx11::basic_string<char>::size_type)' 28 | ans[i] = max(ans[i], S.size() - 1 - prev[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc: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:28:37: note: deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 28 | ans[i] = max(ans[i], S.size() - 1 - prev[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:37: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned int' 28 | ans[i] = max(ans[i], S.size() - 1 - prev[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~