submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s104565903
p00496
C++
#include <cstdio> #include <algorithm> using namespace std; long long dp[3001][3001]={}; long long x[3001][2]; long long n,t,s; int main(){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j-x[i+1][1]<0){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=dp[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j>s && j-x[i+1][1]<s){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=dp[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long long maxi=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int k=0;k<=j-x[i+1][1];k++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;maxi=max(maxi,dp[i][k]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=max(dp[i][j],maxi+x[i+1][0]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}/*DEGwer*/ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//for(int i=1;i<=n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; for(int j=0;j<=t;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;&#160;&#160;&#160;&#160; printf("%d ",dp[i][j]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; } &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; printf("\n"); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long long&#160; ans=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//for(int i=0;i<=t;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;&#160;ans=max(ans,dp[n][i]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf("%lld\n",dp[n][t]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%d",&n); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return 0; &#160;&#160;&#160;&#160;}
a.cc:8:2: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:8: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:14: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:20: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:26: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:32: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:38: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:44: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:9:2: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:8: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:14: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:20: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:26: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:32: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:38: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:44: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:10:2: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:8: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:14: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:20: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:26: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:32: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:38: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:44: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:50: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:56: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:62: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:68: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:11:2: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:8: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:14: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:20: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:26: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:32: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:38: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:44: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:12:2: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:8: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:14: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:20: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:26: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:32: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:38: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:44: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:13:2: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:8: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:14: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:20: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:26: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:32: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:38: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:44: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:14:2: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:8: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:14: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:20: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:26: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:32: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:38: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:44: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:50: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:56: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:62: error
s125189940
p00496
C++
#include <string> #include <vector> #include<iostream> #include<algorithm> #include<cstdio> #include<cstdlib> #include<sstream> #include<functional> #include<map> #include<set> #include<cmath> using namespace std; int main(){ int N,T,S; cin >> N; cin >> T; cin >> S; int AB[N+1][2]; AB[0][0]=0; AB[0][1]=0; for(int i=1;i<=N;i++){ cin >> AB[i][0]; cin >> AB[i][1]; } int dp[N+1][T+1]; int dq[N+1][T+1]; for(int i=0;i<=N;i++){ for(int j=0;j<=T;j++){ dp[i][j]=0; dq[i][j]=0; } } int p=0; for(int K=0;K<=N;K++){ if(K==0) dp[K][S]=0; if(K>=1){ for(int i=0;i<K;i++){ for(int j=0;j<=S;j++){ if(j<AB[i][1]) dp[i+1][j]=dp[i][j]; else dp[i+1][j]=max(dp[i][j],dp[i][j-AB[i][1]]+AB[i[0]); } } } if(K==N) dq[N-K][T-S]=0; if(K<N){ for(int i=0;i<N-K;i++){ for(int j=0;j<=T-S;j++){ if(i==0) dq[i][j]=0; else if(j<AB[i+K][1]) dq[i+1][j]=dq[i][j]; else dq[i+1][j]=max(dq[i][j],dq[i][j-AB[i+K][1]]+AB[i+K][0]); } } } if(p<dp[K][S]+dq[N-K][T-S]) p=dp[K][S]+dq[N-K][T-S]; for(int i=0;i<=N;i++){ for(int j=0;j<=T;j++){ dp[i][j]=0; dq[i][j]=0; } } } cout << p; return 0; }
a.cc: In function 'int main()': a.cc:53:59: error: invalid types 'int[int]' for array subscript 53 | else dp[i+1][j]=max(dp[i][j],dp[i][j-AB[i][1]]+AB[i[0]); | ^ a.cc:53:62: error: expected ']' before ')' token 53 | else dp[i+1][j]=max(dp[i][j],dp[i][j-AB[i][1]]+AB[i[0]); | ^ | ]
s009876174
p00496
C++
#include <cstdio> #include <vector> #include <algorithm> using namespace std; static int dp[3010][3010]; const int inf = (int)1e9; int solve(int n, int t, int s, vector<int> &a, vector<int> &b) { if(t < 0) return -inf; if(n < 0) return 0; if(dp[n][t] != -1) return dp[n][t]; int ans = 0; int temp; temp = solve(n - 1, t, s, a, b); ans = max(temp, ans); bool cross = s < t && t - b[i] < s; if(cross) temp = solve(n, s, s, a, b); else temp = solve(n - 1, t - b[i], s, a, b); ans = max(temp, ans); return dp[n][t] = ans; } int main() { int n, t, s; vector<int> a, b; scanf("%d%d%d", &n, &t, &s); for(int i = 0; i < n; ++i) scanf("%d%d", &a[i], &b[i]); fill(dp[0], dp[3010], -1); int ans = solve(n, t, s, a, b); printf("%d\n", ans); return 0; }
a.cc: In function 'int solve(int, int, int, std::vector<int>&, std::vector<int>&)': a.cc:22:29: error: 'i' was not declared in this scope 22 | bool cross = s < t && t - b[i] < s; | ^
s137168567
p00497
Java
import java.io.InputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; public class Main{ static PrintWriter out; static InputReader ir; static void solve(){ int n=ir.nextInt(); AL[] seg=new AL[n]; for(int i=0;i<n;i++) seg[i]=new AL(); int m=ir.nextInt(); for(int i=0;i<n;i++){ int a=ir.nextInt()-1; int b=ir.nextInt()-1; int x=ir.nextInt(); for(int j=a;j<=a+x;j++){ seg[j].add(new int{b,b+j-a}); } } long tot=0; for(int i=0;i<n;i++) tot+=(long)UniteSegmentsAndGetTotalLength(seg[i],1); out.println(tot); } static class AL extends ArrayList<int[]>{} static long UniteSegmentsAndGetTotalLength(AL seg,int k){ int n=seg.size(); Point[] ps=new Point[2*n]; for(int i=0;i<n;i++){ int[] s=seg.get(i); ps[2*i]=new Point(s[0],true); ps[2*i+1]=new Point(s[1],false); } seg.clear(); Arrays.sort(ps,new Comparator<Point>(){ public int compare(Point a,Point b){ if(a.pos!=b.pos) return Integer.compare(a.pos,b.pos); if(a.isLeftSide==b.isLeftSide) return 0; if(a.isLeftSide) return -1; return 1; } }); int cur=0,l=-1; long ret=0; boolean f=false; for(int i=0;i<2*n;i++){ cur+=ps[i].isLeftSide?1:-1; if(cur>=k&&!f){ f=true; l=ps[i].pos; } else if(cur<k&&f){ f=false; if(l!=ps[i].pos) seg.add(new int[]{l,ps[i].pos}); ret+=ps[i].pos-l; } } return ret; } static class Point{ public int pos; public boolean isLeftSide; public Point(int pos,boolean isLeftSide){ this.pos=pos; this.isLeftSide=isLeftSide; } } public static void main(String[] args) throws Exception{ ir=new InputReader(System.in); out=new PrintWriter(System.out); solve(); out.flush(); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;} public boolean hasNextByte() { if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); }catch(IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return false; } return true; } private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;} private boolean isSpaceChar(int c){return !(c>=33&&c<=126);} private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;} public boolean hasNext(){skip(); return hasNextByte();} public String next(){ if(!hasNext()) throw new NoSuchElementException(); StringBuilder sb=new StringBuilder(); int b=readByte(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public double nextDouble(){return Double.parseDouble(next());} public int[] nextIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } public long[] nextLongArray(int n){ long[] a=new long[n]; for(int i=0;i<n;i++) a[i]=nextLong(); return a; } public char[][] nextCharMap(int n,int m){ char[][] map=new char[n][m]; for(int i=0;i<n;i++) map[i]=next().toCharArray(); return map; } } }
Main.java:26: error: '[' expected seg[j].add(new int{b,b+j-a}); ^ 1 error
s162862421
p00497
C++
å#include <cstdio> #define S 5010 using namespace std; int l[S][S]={0}; int main(){ int N,M,a,b,x,i,j; scanf("%d %d",&N,&M); for(i=0;i<M;i++){ scanf("%d %d %d",&a,&b,&x); l[a][b]++; l[a][b+1]--; l[a+x+1][b]--; l[a+x+2][b+1]++; l[a+x+2][b+x+2]--; l[a+x+1][b+x+2]++; } for(i=1;i<N+4;i++){ for(j=1;j<N+4;j++){ l[i][j]+=l[i][j-1]; } } for(j=1;j<N+4;j++){ for(i=1;i<N+4;i++){ l[i][j]+=l[i-1][j]; } } for(i=1;i<N+4;i++){ for(j=1;j<N+4;j++){ if(i+j-1<S){ l[i+j-1][j]+=l[i+j-2][j-1]; } } } int cnt=0; for(i=0;i<N+4;i++){ for(j=0;j<N+4;j++){ if(l[i][j]>0){cnt++;} } } printf("%d\n",cnt); return 0; }
a.cc:1:2: error: stray '#' in program 1 | å#include <cstdio> | ^ a.cc:1:1: error: '\U000000e5' does not name a type 1 | å#include <cstdio> | ^ a.cc: In function 'int main()': a.cc:8:5: error: 'scanf' was not declared in this scope 8 | scanf("%d %d",&N,&M); | ^~~~~ a.cc:41:5: error: 'printf' was not declared in this scope 41 | printf("%d\n",cnt); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | å#include <cstdio>
s288192371
p00497
C++
å#include <cstdio> #define S 5010 using namespace std; int l[S][S]={0}; int main(){ int N,M,a,b,x,i,j; scanf("%d %d",&N,&M); for(i=0;i<M;i++){ scanf("%d %d %d",&a,&b,&x); l[a][b]++; l[a][b+1]--; l[a+x+1][b]--; l[a+x+2][b+1]++; l[a+x+2][b+x+2]--; l[a+x+1][b+x+2]++; } for(i=1;i<N+4;i++){ for(j=1;j<N+4;j++){ l[i][j]+=l[i][j-1]; } } for(j=1;j<N+4;j++){ for(i=1;i<N+4;i++){ l[i][j]+=l[i-1][j]; } } for(i=1;i<N+4;i++){ for(j=1;j<N+4;j++){ if(i+j-1<S){ l[i+j-1][j]+=l[i+j-2][j-1]; } } } int cnt=0; for(i=0;i<N+4;i++){ for(j=0;j<N+4;j++){ if(l[i][j]>0){cnt++;} } } printf("%d\n",cnt); return 0; }
a.cc:1:2: error: stray '#' in program 1 | å#include <cstdio> | ^ a.cc:1:1: error: '\U000000e5' does not name a type 1 | å#include <cstdio> | ^ a.cc: In function 'int main()': a.cc:8:5: error: 'scanf' was not declared in this scope 8 | scanf("%d %d",&N,&M); | ^~~~~ a.cc:41:5: error: 'printf' was not declared in this scope 41 | printf("%d\n",cnt); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | å#include <cstdio>
s663031957
p00497
C++
#include<iostream> #include<cstdio> using namespace std; int n,m,ans=0; vector<int> tri[5007]; int main(void){ scanf("%d%d",&n,&m); for(int i=0;i<=n+3;i++){ for(int j=0;j<i;j++)tri[i].push_back(0); } for(int i=0;i<m;i++){ int x,y,size; scanf("%d%d%d",&y,&x,&size); size++; tri[x][y]+=1; tri[x+1][y]-=1; tri[x][y+size]-=1; tri[x+1][y+size+1]+=1; tri[x+size+1][y+size]+=1; tri[x+size+1][y+size+1]-=1; } for(int i=1;i<=n;i++){ for(int j=2;j<=n;j++){ tri[j][i]+=tri[j-1][i]; } } for(int i=1;i<=n;i++){ for(int j=2;j<=n;j++){ tri[i][j]+=tri[i][j-1]; } } for(int i=1;i<=n;i++){ int y=2,x=i+2; while(x<=n){ tri[x][y]+=tri[x-1][y-1]; y++,x++; } } for(int i=1;i<=n;i++){ int y=i+1,x=2; while(y<=n){ tri[x][y]+=tri[x-1][y-1]; y++,x++; } } for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ if(tri[j][i]>=1)ans++; //printf("%d%c",tri[j][i],j==n?'\n':' '); } } printf("%d\n",ans); return 0; }
a.cc:7:1: error: 'vector' does not name a type 7 | vector<int> tri[5007]; | ^~~~~~ a.cc: In function 'int main()': a.cc:13:37: error: 'tri' was not declared in this scope 13 | for(int j=0;j<i;j++)tri[i].push_back(0); | ^~~ a.cc:19:17: error: 'tri' was not declared in this scope 19 | tri[x][y]+=1; | ^~~ a.cc:28:25: error: 'tri' was not declared in this scope 28 | tri[j][i]+=tri[j-1][i]; | ^~~ a.cc:33:25: error: 'tri' was not declared in this scope 33 | tri[i][j]+=tri[i][j-1]; | ^~~ a.cc:39:25: error: 'tri' was not declared in this scope 39 | tri[x][y]+=tri[x-1][y-1]; | ^~~ a.cc:46:25: error: 'tri' was not declared in this scope 46 | tri[x][y]+=tri[x-1][y-1]; | ^~~ a.cc:52:28: error: 'tri' was not declared in this scope 52 | if(tri[j][i]>=1)ans++; | ^~~
s935079846
p00497
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef tuple<int, int> duo; const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; const int Mod = 1000000000 + 0; //{{{ templates #define TT_ template<typename T>inline #define TTF_ template<typename T,typename F>inline TT_ T sq(T x){return x*x;} TT_ T In(){T x;cin>>x;return x;} TT_ void Out(T&x){cout<<x;} TT_ void sort(T&v){sort(begin(v),end(v));} TT_ void revs(T&v){reverse(begin(v),end(v));} TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));} TT_ int ubnd(T&v,typename T::value_type x){return upper_bound(begin(v),end(v),x)-begin(v);} TT_ int lbnd(T&v,typename T::value_type x){return lower_bound(begin(v),end(v),x)-begin(v);} TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));} TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;} TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));} TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));} inline void fast_io(){ios_base::sync_with_stdio(0);cin.tie(0);} inline int in(){int x;scanf("%d",&x);return x;} inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;} inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);} //}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple short nails[5050][5050]; int main() { int N, M; N = in(), M = in(); for (int i = 0; i < M; i++){ int a, b, x; a = in(), b = in(), x = in(); nails[a][b] = x + 1; } for (int i = 1; i <= N; i++){ for (int j = 1; j <= i; j++){ nails[i][j] = max(nails[i][j], max(nails[i - 1][j], nails[i - 1][j - 1]) - 1); } } int cnt = 0; for (int i = 1; i <= N; i++){ for (int j = 1; j <= i; j++){ if (nails[i][j]) cnt++; } } cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:46:24: error: no matching function for call to 'max(short int&, int)' 46 | nails[i][j] = max(nails[i][j], max(nails[i - 1][j], nails[i - 1][j - 1]) - 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:46:24: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 46 | nails[i][j] = max(nails[i][j], max(nails[i - 1][j], nails[i - 1][j - 1]) - 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:46:24: note: mismatched types 'std::initializer_list<_Tp>' and 'short int' 46 | nails[i][j] = max(nails[i][j], max(nails[i - 1][j], nails[i - 1][j - 1]) - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s331588979
p00497
C++
#include<iostream> #include<map> #define REP(i,x) for (int i = 0; i < (x); i++) #define TRI(i,j) (nails[(((i)*((i)-1)/2)+(j))]); using namespace std; typedef pair<int,int> P; const int NMAX = 5008; const int NAILMAX = NMAX * NMAX / 2; int nails[NAILMAX]; int N, M; void put(int a, int b, int x) { TRI(a,b) ++; TRI(a,b+1) --; TRI(a+x+1,b) --; TRI(a+x+2,b+1) ++; TRI(a+x+1,b+x+2) ++; TRI(a+x+2,b+x+2) --; } void show() { for (int a = 1; a < N+1; a++) { REP(b,a+1) { cout << TRI(a,b); } cout << endl; } } void accumulate() { show(); for (int c = 1; c <= N; c++) for (int n = 1; c + n <= N; n++) { TRI(c + n, c) += TRI(c + n - 1, c); } show(); for (int c = 1; c <= N; c++) for (int n = 1; c + n <= N; n++) { TRI(c + n , n) += TRI(c + n - 1, c); } show(); for(int a = 1; a <= N; a++) for (int b = 2; b <= N; b++) { TRI(a, b) += TRI(a, b - 1); } int count() { int sum = 0; REP(a, N) { REP(b, N) { if (TRI(a+1,b+1) > 0) sum++; } } return sum; } int main() { cin >> N >> M; REP(i, M) { int a, b, x; cin >> a >> b >> x; put(a, b, x); } accumulate(); cout << count() << endl; }
a.cc: In function 'void put(int, int, int)': a.cc:16:14: error: expected primary-expression before ';' token 16 | TRI(a,b) ++; | ^ a.cc:17:16: error: expected primary-expression before ';' token 17 | TRI(a,b+1) --; | ^ a.cc:18:18: error: expected primary-expression before ';' token 18 | TRI(a+x+1,b) --; | ^ a.cc:19:20: error: expected primary-expression before ';' token 19 | TRI(a+x+2,b+1) ++; | ^ a.cc:20:22: error: expected primary-expression before ';' token 20 | TRI(a+x+1,b+x+2) ++; | ^ a.cc:21:22: error: expected primary-expression before ';' token 21 | TRI(a+x+2,b+x+2) --; | ^ a.cc: In function 'void accumulate()': a.cc:36:19: error: expected primary-expression before '+=' token 36 | TRI(c + n, c) += TRI(c + n - 1, c); | ^~ a.cc:41:20: error: expected primary-expression before '+=' token 41 | TRI(c + n , n) += TRI(c + n - 1, c); | ^~ a.cc:46:15: error: expected primary-expression before '+=' token 46 | TRI(a, b) += TRI(a, b - 1); | ^~ a.cc:49:10: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 49 | int count() { | ^~ a.cc:49:10: note: remove parentheses to default-initialize a variable 49 | int count() { | ^~ | -- a.cc:49:10: note: or replace parentheses with braces to value-initialize a variable a.cc:49:13: error: a function-definition is not allowed here before '{' token 49 | int count() { | ^ a.cc:59:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 59 | int main() { | ^~ a.cc:59:9: note: remove parentheses to default-initialize a variable 59 | int main() { | ^~ | -- a.cc:59:9: note: or replace parentheses with braces to value-initialize a variable a.cc:59:12: error: a function-definition is not allowed here before '{' token 59 | int main() { | ^ a.cc:68:2: error: expected '}' at end of input 68 | } | ^ a.cc:33:19: note: to match this '{' 33 | void accumulate() { | ^
s543643148
p00497
C++
#include <iostream> #include <cstdio> #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,a) FOR(i,0,a) using namespace std; short maps[5001][5001]; int main() { int N,M,x,y,size; cin >> N >> M; REP(i,M){ scanf("%d%d%d",&x,&y,&size); maps[x][y]=max(size+1,maps[x][y]); } int sum=0; REP(i,N+1) REP(j,i+1){ maps[i+1][j+1]=max(maps[i+1][j+1],maps[i][j]-1); maps[i+1][j]=max(maps[i+1][j],maps[i][j]-1); if(maps[i][j]) sum++; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:31: error: no matching function for call to 'max(int, short int&)' 12 | maps[x][y]=max(size+1,maps[x][y]); | ~~~^~~~~~~~~~~~~~~~~~~ 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:12:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'short int') 12 | maps[x][y]=max(size+1,maps[x][y]); | ~~~^~~~~~~~~~~~~~~~~~~ /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 a.cc:17:43: error: no matching function for call to 'max(short int&, int)' 17 | maps[i+1][j+1]=max(maps[i+1][j+1],maps[i][j]-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:17:43: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 17 | maps[i+1][j+1]=max(maps[i+1][j+1],maps[i][j]-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 a.cc:18:41: error: no matching function for call to 'max(short int&, int)' 18 | maps[i+1][j]=max(maps[i+1][j],maps[i][j]-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:18:41: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 18 | maps[i+1][j]=max(maps[i+1][j],maps[i][j]-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
s288845684
p00497
C++
#include <iostream> #include <cstdio> #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,a) FOR(i,0,a) using namespace std; short maps[5001][5001]; int main() { short N,M,x,y,size; cin >> N >> M; REP(i,M){ scanf("%d%d%d",&x,&y,&size); maps[x][y]=max(size+1,maps[x][y]); } short sum=0; REP(i,N+1) REP(j,i+1){ maps[i+1][j+1]=max(maps[i+1][j+1],maps[i][j]-1); maps[i+1][j]=max(maps[i+1][j],maps[i][j]-1); if(maps[i][j]) sum++; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:31: error: no matching function for call to 'max(int, short int&)' 12 | maps[x][y]=max(size+1,maps[x][y]); | ~~~^~~~~~~~~~~~~~~~~~~ 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:12:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'short int') 12 | maps[x][y]=max(size+1,maps[x][y]); | ~~~^~~~~~~~~~~~~~~~~~~ /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 a.cc:17:43: error: no matching function for call to 'max(short int&, int)' 17 | maps[i+1][j+1]=max(maps[i+1][j+1],maps[i][j]-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:17:43: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 17 | maps[i+1][j+1]=max(maps[i+1][j+1],maps[i][j]-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 a.cc:18:41: error: no matching function for call to 'max(short int&, int)' 18 | maps[i+1][j]=max(maps[i+1][j],maps[i][j]-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:18:41: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 18 | maps[i+1][j]=max(maps[i+1][j],maps[i][j]-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
s396284022
p00497
C++
#include <cstdio> #include <cstring> #include <cmath> #include <iostream> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <set> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define mp(a,b) make_pair(a,b) #define pb(a) push_back(a) #define dbg(x) cout<<#x"="<<x<<endl typedef long long ll; typedef pair<int, int> pii; typedef pair<pii, int> ppi; #define INF 1000000000 #define N_MAX 5000 #define M_MAX 500000 int nails[N_MAX+2][N_MAX+2]; int main(){ int n,m; cin >> n >> m; rep(i, n+2){ rep(j,i+2) nails[i][j]=0; } // imosu method (applying to triangle) int a,b,x; rep(i, m){ scanf("%d %d %d", &a, &b, &x); a--; b--; nails[a][b]++; nails[a][b+1]--; nails[a+x+1][b]--; nails[a+x+2][b+1]++; nails[a+x+2][b+x+2]--; nails[a+x+1][b+x+2]++; } int current=0; // from left to right rep(i, n){ current=0; rep(j, i+1){ current += nails[i][j]; nails[i][j] = current; } } // from upper-right to bottom-left rep(i,n){ current=0; rep(j,n-i){ current += nails[i+j][i];??? nails[i+j][i] = current; } } int res=0; // from upper-left to bottom-right rep(i,n){ current=0; rep(j, n-i){ current += nails[i+j][j]; nails[i+j][j] = current; if(current>0) res++; } } /* rep(i, n){ rep(j,i+1){ cout << nails[i][j]; } cout << endl; } */ cout << res << endl; }
a.cc: In function 'int main()': a.cc:62:32: error: expected primary-expression before '?' token 62 | current += nails[i+j][i];??? | ^ a.cc:62:33: error: expected primary-expression before '?' token 62 | current += nails[i+j][i];??? | ^ a.cc:62:34: error: expected primary-expression before '?' token 62 | current += nails[i+j][i];??? | ^ a.cc:63:30: error: expected ':' before ';' token 63 | nails[i+j][i] = current; | ^ | : a.cc:63:30: error: expected primary-expression before ';' token a.cc:63:30: error: expected ':' before ';' token 63 | nails[i+j][i] = current; | ^ | : a.cc:63:30: error: expected primary-expression before ';' token a.cc:63:30: error: expected ':' before ';' token 63 | nails[i+j][i] = current; | ^ | : a.cc:63:30: error: expected primary-expression before ';' token
s516226377
p00497
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; int m; cin >> n >> m; int y,x,offset; short data[5002][5002] = {0}; while(m--){ scanf("%d %d %d",&y,&x,&offset); data[y][x] = offset + 1; } int sum = 0; for(int i = 1;i <= n;i++){ for(int j = 1;j <= i;j++){ data[i][j] = max({data[i][j],data[i - 1][j - 1] - 1,data[i - 1][j] - 1}); if(data[i][j])sum++; } cout << endl; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:23: error: no matching function for call to 'max(<brace-enclosed initializer list>)' 16 | data[i][j] = max({data[i][j],data[i - 1][j - 1] - 1,data[i - 1][j] - 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: candidate expects 2 arguments, 1 provided /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, 1 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: template argument deduction/substitution failed: a.cc:16:23: note: deduced conflicting types for parameter '_Tp' ('short int' and 'int') 16 | data[i][j] = max({data[i][j],data[i - 1][j - 1] - 1,data[i - 1][j] - 1}); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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: candidate expects 2 arguments, 1 provided
s837614711
p00497
C++
#include <vector> #include <algorithm> #include <set> #include <map> #include <queue> #include <stack> #include <iostream> #include <cstdio> #include <cmath> #include <cstring> using namespace std; typedef long long ll; typedef pair<ll,ll> P; typedef double db; #define fr first #define sc second #define pb push_back #define rep(i,x) for(ll i=0;i<x;i++) #define rep1(i,x) for(ll i=1;i<=x;i++) #define rrep(i,x) for(ll i=x-1;i>=0;i--) #define rrep1(i,x) for(ll i=x;i>0;i--) ll N,M; ll a,b,x; ll imos[5002][5002]; int main() { scanf("%lld%lld",&N,&M); ll H=W=N; rep(i,M){ scanf("%lld%lld%lld",&a,&b,&x); a--; --b; x++; imos[a][b]++; imos[a][b+1]--; imos[a+x][b]--; imos[a+x+1][b+1]++; imos[a+x][b+x+1]++; imos[a+x+1][b+x+1]--; } rep(i,H+2) rep(j,W+2){ if(i>0&&j>0){ imos[i][j]+=imos[i-1][j-1]; } } rep(i,H+2) rep(j,W+2){ if(i>0){ imos[i][j]+=imos[i-1][j]; } } rep(i,H+2) rep(j,W+2){ if(j>0){ imos[i][j]+=imos[i][j-1]; } } ll ans=0; rep(i,H) rep(j,i+1) if(imos[i][j]>0) ans++; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:31:14: error: 'W' was not declared in this scope 31 | ll H=W=N; | ^
s519871603
p00497
C++
#include <iostream> #include <algorithm> using namespace std; short dp[5000][5000]; int main(){ int N,M; cin >> N >> M; for(int i = 0 ; i < M ; i++){ int x,y,c; cin >> y >> x >> c; dp[y-1][x-1] = c+1; } for(int i = 0 ; i < N ; i++){ for(int j = 0 ; j < N ; j++){ dp[i+1][j] = max(dp[i+1][j],dp[i][j]-1); dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]-1); } } int ans = 0; for(int i = 0 ; i < N ; i++){ for(int j = 0 ; j < N ; j++){ ans += !!dp[i][j]; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:16:41: error: no matching function for call to 'max(short int&, int)' 16 | dp[i+1][j] = max(dp[i+1][j],dp[i][j]-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ 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:16:41: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 16 | dp[i+1][j] = max(dp[i+1][j],dp[i][j]-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, from a.cc:2: /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:16:41: note: mismatched types 'std::initializer_list<_Tp>' and 'short int' 16 | dp[i+1][j] = max(dp[i+1][j],dp[i][j]-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:17:43: error: no matching function for call to 'max(short int&, int)' 17 | dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]-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:17:43: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 17 | dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]-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 /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:17:43: note: mismatched types 'std::initializer_list<_Tp>' and 'short int' 17 | dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
s593869034
p00497
C++
#include <cstdio> #include <iostream> #include <vector> #include <list> #include <cmath> #include <fstream> #include <algorithm> #include <string> #include <queue> #include <set> #include <map> #include <complex> #include <iterator> #include <cstdlib> #include <cstring> #include <sstream> using namespace std; const double EPS=(1e-10); typedef long long ll; typedef pair<int,int> pii; bool EQ(double a,double b){ return abs((a)-(b))<EPS; } void fast_stream(){ std::ios_base::sync_with_stdio(0); } short dp[5001][5001]; void dfs(int x,int y,int depth){ if(dp[y][x]>=depth)return; dp[y][x]=depth; if(depth==0)return; int ny=y+1; int nx=x+1; dfs(nx,ny,depth-1); ny=y; dfs(nx,ny,depth-1); } void solve(){ memset(dp,-1,sizeof(dp)); int n,m; cin>>n>>m; for(int i=0;i<m;i++){ int x,y,a; cin>>x>>y>>a; dfs(x,y,a); } int cnt=0; for(int i=0;i<=n;i++){ for(int j=0;j<=n;j++){ if(dp[j][i]>=0)cnt++; } } cout<<cnt<<endl; }
/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
s771232448
p00497
C++
#include <cstdio> #include <iostream> #include <vector> #include <list> #include <cmath> #include <fstream> #include <algorithm> #include <string> #include <queue> #include <set> #include <map> #include <complex> #include <iterator> #include <cstdlib> #include <cstring> #include <sstream> using namespace std; const double EPS=(1e-10); typedef long long ll; typedef pair<int,int> pii; bool EQ(double a,double b){ return abs((a)-(b))<EPS; } void fast_stream(){ std::ios_base::sync_with_stdio(0); } short dp[5001][5001]; void dfs(int x,int y,int depth){ if(dp[y][x]>=depth)return; dp[y][x]=depth; if(depth==0)return; int ny=y+1; int nx=x+1; dfs(nx,ny,depth-1); ny=y; dfs(nx,ny,depth-1); } void solve(){ memset(dp,-1,sizeof(dp)); int n,m; cin>>n>>m; for(int i=0;i<m;i++){ int x,y,a; cin>>x>>y>>a; dp[x][y]=a; //dfs(x,y,a); } for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ dp[i+1][j+1]=max(dp[i+1][j+1],(short)(dp[i][j]-1)); dp[i+1][j]=max(dp[i+1][j],(short)(dp[i][j]-1)); } } int cnt=0; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ if(dp[i][j]>=0)cnt++; } } cout<<cnt<<endl; }
/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
s581322935
p00497
C++
#include<cstdio> #include<vector> #include<algorithm> using namespace std; int n,m; const int Max = 5008; short data[Max][Max]; void debug(){ #if 0 for(int j=1;j<=n + 1;j++){ for(int i=1;i<=n + 1;i++){ printf("%+d ",data[i][j]); } puts(""); } puts(""); #endif } int main(){ exit(1); scanf("%d %d",&n,&m); int a,b,x; for(int i=0;i<m;i++){ scanf("%d %d %d",&b,&a,&x); //printf("%d %d %d\n",a,b,x); data[a][b] += 1; data[a+1][b] -= 1; data[a][b + x + 1] -= 1; data[a+1][b + x + 1 + 1] += 1; data[a + x + 2][b + x + 1] += 1; data[a + x + 2][b + x + 1 + 1] -= 1; if(a + x + 2 > max || b + x + 2 > max){ exit(1); } } debug(); //ツ可。ツづ可づづゥ for(int i=0;i<Max;i++){ int s = 0; for(int j=0;j<Max;j++){ s += data[j][i]; data[j][i] = s; } } debug(); //ツ縦ツづ可づづゥ for(int i=0;i<Max;i++){ int s = 0; for(int j=0;j<Max;j++){ s += data[i][j]; data[i][j] = s; } } debug(); //ツ偲篠づ淞づ可偲ヲツづゥ for(int i=-Max;i<Max;i++){ int s=0; for(int j=0;i+j<Max;j++){ //printf("%d,%d:%d\n",i,j,i+j); if(j < 0 || j + i < 0){ continue; } if(j >= Max || j + i >= Max){ break; } s += data[j][i+j]; data[j][i+j] = s; } } debug(); int ans = 0; for(int i=0;i<Max;i++){ for(int j=0;j<Max;j++){ if(data[i][j] > 0){ ans++; } } } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:32:17: error: reference to 'data' is ambiguous 32 | data[a][b] += 1; | ^~~~ In file included from /usr/include/c++/14/vector:69, from a.cc:2: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:11:7: note: 'short int data [5008][5008]' 11 | short data[Max][Max]; | ^~~~ a.cc:33:17: error: reference to 'data' is ambiguous 33 | data[a+1][b] -= 1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:11:7: note: 'short int data [5008][5008]' 11 | short data[Max][Max]; | ^~~~ a.cc:34:17: error: reference to 'data' is ambiguous 34 | data[a][b + x + 1] -= 1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:11:7: note: 'short int data [5008][5008]' 11 | short data[Max][Max]; | ^~~~ a.cc:35:17: error: reference to 'data' is ambiguous 35 | data[a+1][b + x + 1 + 1] += 1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:11:7: note: 'short int data [5008][5008]' 11 | short data[Max][Max]; | ^~~~ a.cc:36:17: error: reference to 'data' is ambiguous 36 | data[a + x + 2][b + x + 1] += 1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:11:7: note: 'short int data [5008][5008]' 11 | short data[Max][Max]; | ^~~~ a.cc:37:17: error: reference to 'data' is ambiguous 37 | data[a + x + 2][b + x + 1 + 1] -= 1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:11:7: note: 'short int data [5008][5008]' 11 | short data[Max][Max]; | ^~~~ a.cc:38:30: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>' 38 | if(a + x + 2 > max || b + x + 2 > max){ | ~~~~~~~~~~^~~~~ a.cc:38:49: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>' 38 | if(a + x + 2 > max || b + x + 2 > max){ | ~~~~~~~~~~^~~~~ a.cc:47:30: error: reference to 'data' is ambiguous 47 | s += data[j][i]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:11:7: note: 'short int data [5008][5008]' 11 | short data[Max][Max]; | ^~~~ a.cc:48:25: error: reference to 'data' is ambiguous 48 | data[j][i] = s; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:11:7: note: 'short int data [5008][5008]' 11 | short data[Max][Max]; | ^~~~ a.cc:56:30: error: reference to 'data' is ambiguous 56 | s += data[i][j]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class
s046114561
p00497
C++
#include<stdio.h> int main(){ int bool[5000][5000]={}; int n,m,a,b,c,x,y,z,t=0; scanf("%d %d",&n,&m); for(a=0;a<m;a++){ scanf("%d %d %d",&x,&y,&z); for(b=0;b<z+1;b++){ for(c=0;c<z+1;c++){ if(b>=c){nail[x+b-1][y+c-1]=1;} } } } for(a=0;a<n;a++){ for(b=0;b<n;b++){ if(nail[a][b]==1){t++;} } } printf("%d\n",t); return 0; }
a.cc: In function 'int main()': a.cc:3:18: error: expected identifier before numeric constant 3 | int bool[5000][5000]={}; | ^~~~ a.cc:3:18: error: expected ']' before numeric constant 3 | int bool[5000][5000]={}; | ^~~~ | ] a.cc:3:9: error: two or more data types in declaration of 'structured binding' 3 | int bool[5000][5000]={}; | ^~~ a.cc:3:17: error: empty structured binding declaration 3 | int bool[5000][5000]={}; | ^ a.cc:3:23: error: expected initializer before '[' token 3 | int bool[5000][5000]={}; | ^ a.cc:10:42: error: 'nail' was not declared in this scope 10 | if(b>=c){nail[x+b-1][y+c-1]=1;} | ^~~~ a.cc:16:28: error: 'nail' was not declared in this scope 16 | if(nail[a][b]==1){t++;} | ^~~~
s464364386
p00497
C++
#include <cstdio> int main() { int n, m; static int nail[5000][5000] = {0}; scanf("%d%d", &n, &m); for(int i = 0; i < m; ++i) { int a, b, x; scanf("%d%d%d", &a, &b, &x); a -= 1, b -= 1; nail[a][b] = x; } int ans = 0; for(int a = 0; a < n; ++a) { for(int b = 0; b < n; ++b) { int l = a > 0 && b > 0 ? nail[a - 1][b - 1] : 1; int r = a > 0 ? nail[a - 1][b] : 1; nail[a][b] = max(nail[a][b], max(l - 1, r - 1)); if(nail[a][b] > 0) ans += 1; } } printf("%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:19:30: error: 'max' was not declared in this scope 19 | nail[a][b] = max(nail[a][b], max(l - 1, r - 1)); | ^~~ a.cc:19:14: error: 'max' was not declared in this scope 19 | nail[a][b] = max(nail[a][b], max(l - 1, r - 1)); | ^~~
s076234879
p00497
C++
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> using namespace std; typedef pair<int,int> p; typedef pair<int,p> P; typedef pair<p,p> p2; #define pu push #define pb push_back #define mp make_pair short field[5005][5005]={}; int main(){ int n,m; scanf("%d %d",&n,&m); for(int i=0;i<m;i++){ int a,b,c; scanf("%d %d %d",&a,&b,&c); field[a][b]=c+1; } for(int i=1;i<n;i++){ for(int j=1;j<=n;j++){ if(field[i][j]>0){ field[i+1][j]=max(field[i+1][j],field[i][j]-1); if(j!=n){ field[i+1][j+1]=max(field[i+1][j+1],field[i][j]-1); } } } } int ans=0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(field[i][j]>0){ ans++; } } } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:31:50: error: no matching function for call to 'max(short int&, int)' 31 | field[i+1][j]=max(field[i+1][j],field[i][j]-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:4: /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:31:50: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 31 | field[i+1][j]=max(field[i+1][j],field[i][j]-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, from a.cc:6: /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:31:50: note: mismatched types 'std::initializer_list<_Tp>' and 'short int' 31 | field[i+1][j]=max(field[i+1][j],field[i][j]-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:33:60: error: no matching function for call to 'max(short int&, int)' 33 | field[i+1][j+1]=max(field[i+1][j+1],field[i][j]-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:33:60: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 33 | field[i+1][j+1]=max(field[i+1][j+1],field[i][j]-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 /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:33:60: note: mismatched types 'std::initializer_list<_Tp>' and 'short int' 33 | field[i+1][j+1]=max(field[i+1][j+1],field[i][j]-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s352256822
p00497
C++
#include<iostream> #include<algorithm> #include<cstdlib> using namespace std; int main(void){ int n,m,a,b,x; static int nails[5001][5001]; memset(nails,0,sizeof(nails)); cin >> n >> m; for(int i=0;i<m;i++){ cin >> a >> b >> x; nails[a][b]=x+1; } for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ nails[i][j]=max(nails[i][j],max(nails[i-1][j-1],nails[i-1][j])-1); } } int cnt=0; for(int i=1;i<=n;i++) for(int j=1;j<=i;j++) if(nails[i][j]>0)cnt++; cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:3: error: 'memset' was not declared in this scope 12 | memset(nails,0,sizeof(nails)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<cstdlib> +++ |+#include <cstring> 4 |
s236834730
p00497
C++
#include<iostream> #include<algorithm> using namespace std; short nails[5001][5001]; int main(void){ int n,m,a,b,x; cin >> n >> m; for(int i=0;i<m;i++){ cin >> a >> b >> x; nails[a][b]=x+1; } for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ nails[i][j]=(short)max((short)nails[i][j],(short)max((short)nails[i-1][j-1],(short)nails[i-1][j])-(short)1); } } int cnt=0; for(int i=1;i<=n;i++) for(int j=1;j<=i;j++) if(nails[i][j]>0)cnt++; cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:29: error: no matching function for call to 'max(short int, int)' 21 | nails[i][j]=(short)max((short)nails[i][j],(short)max((short)nails[i-1][j-1],(short)nails[i-1][j])-(short)1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:21:29: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 21 | nails[i][j]=(short)max((short)nails[i][j],(short)max((short)nails[i-1][j-1],(short)nails[i-1][j])-(short)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, from a.cc:2: /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:21:29: note: mismatched types 'std::initializer_list<_Tp>' and 'short int' 21 | nails[i][j]=(short)max((short)nails[i][j],(short)max((short)nails[i-1][j-1],(short)nails[i-1][j])-(short)1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s503527794
p00497
C++
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <complex> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> #include <map> #include <set> using namespace std; typedef pair<int,int> P; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; #define pu push #define pb push_back #define mp make_pair #define eps 1e-9 #define INF 2000000000 #define sz(x) ((int)(x).size()) #define fi first #define sec second #define EQ(a,b) (abs((a)-(b))<EPS) int bo[5010][5010]; int n,m; void cal(int p,int q;) { int i,j; i=p;j=q; for(int k=0;k<=n+1-i;k++) { bo[i][j]+=bo[i-1][j-1]; i++;j++; } return ; } int main() { ll ans=0; cin >> n >> m; for(int i=0;i<m;i++) { int a,b,x; cin >> a >> b >> x; bo[a][b]++; bo[a][b+1]--; bo[a+x+1][b]--; bo[a+x+1][b+x+2]++; bo[a+x+2][b+1]++; bo[a+x+2][b+x+2]--; } for(int i=1;i<n+2;i++) { for(int j=1;j<=i;j++) { bo[i][j]+=bo[i][j-1]; } } for(int i=1;i<n+2;i++) { for(int j=i;j<n+2;j++) { bo[j][i]+=bo[j-1][i]; } } for(int i=1;i<=n;i++) { cal(i,1); } for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { if(bo[i][j])ans++; } } for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { cout << bo[i][j] << ' '; } cout << endl; } cout << ans << endl; return 0; }
a.cc:32:21: error: expected ')' before ';' token 32 | void cal(int p,int q;) | ~ ^ | ) a.cc:32:22: error: expected unqualified-id before ')' token 32 | void cal(int p,int q;) | ^
s170670897
p00497
C++
#include <iostream> #include <algorithm> #include <map> #include <set> using namespace std; #define loop(i,a,b) for(int i=(a); i<int(b); i++) #define rep(i,b) loop(i,0,b) int dp[2][5010] = {}; int main(){ int n, m; cin >> n >> m; typedef pair<int, int> P; map<P, int> ps; rep(i, m){ int x, y, c; cin >> x >> y >> c; x--, y--, c++; ps[P(x, y)] = c; } int ans = 0; int* cur = dp[0]; int* prev = dp[1]; loop(i, 0, n){ memset(cur, 0, sizeof(cur)); rep(j, i + 1){ int t = ps[P(i, j)]; if (j - 1 >= 0) t = max(t, prev[j - 1] - 1); if (j < i + 1) t = max(t, prev[j] - 1); ans += t != 0; cur[j] = t; } swap(cur, prev); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:30:9: error: 'memset' was not declared in this scope 30 | memset(cur, 0, sizeof(cur)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <set> +++ |+#include <cstring> 5 |
s050619194
p00498
C++
#include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> typedef long long ll; using namespace std; struct TOWN{ vector<pair<int,int> > road; int df,ans; bool kaku; TOWN() :df(INT_MAX),kaku(false) {} }town[100001]; int main(){ int n,m,k,q,a,b,c; priority_queue<pair<int,int> > dij; scanf("%d%d%d%d",&n,&m,&k,&q); for(int i=0;i<m;i++){ scanf("%d%d%d",&a,&b,&c); town[a].road.push_back(make_pair(b,-c)); town[b].road.push_back(make_pair(a,-c)); } for(int i=0;i<k;i++){ scanf("%d",&a); town[a].df=0; dij.push(make_pair(0,a)); } while(!dij.empty()){ pair<int,int> p; p=dij.top(); dij.pop(); if(!town[p.second].kaku){ town[p.second].kaku=true; town[p.second].df=-p.first; for(int i=0;i<town[p.second].road.size();i++){ if(!town[town[p.second].road[i].first].kaku){ dij.push(make_pair(p.first+town[p.second].road[i].second,town[p.second].road[i].first)); } } } } for(int i=0;i<q;i++){ for(int j=1;j<=n;j++){ town[j].ans=0; town[j].kaku=false; } scanf("%d%d",&a,&b); dij.push(make_pair(town[a].df,a)); while(!dij.empty()){ pair<int,int> p; p=dij.top(); dij.pop(); if(p.second==b){ printf("%d\n",p.first); break; } if(!town[p.second].kaku){ town[p.second].kaku=true; town[p.second].ans=p.first; for(int i=0;i<town[p.second].road.size();i++){ if(!town[town[p.second].road[i].first].kaku){ dij.push(make_pair(min(p.first,town[town[p.second].road[i].first].df),town[p.second].road[i].first)); } } } } } return 0; }
a.cc: In constructor 'TOWN::TOWN()': a.cc:24:9: error: 'INT_MAX' was not declared in this scope 24 | :df(INT_MAX),kaku(false) | ^~~~~~~ a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 11 | #include <set> +++ |+#include <climits> 12 |
s195157496
p00498
C++
#include<iostream> #include<vector> #include<functional> #include<queue> using namespace std; long long N, M, K, Q, a, b, c, dist[151515], alldist[151515], Union[151515]; vector<pair<long long, long long>>vec[151515], X[151515], X_up[151515], X_down[151515]; vector<tuple<long long, long long, long long>>tup; vector<long long>group[151515], W; long long Before[151515][30], MinDist[151515][30], start[151515], goal[151515]; //-------------------------------Union Find-------------------------------- void unite(long long s, long long t) { long long W1 = Union[s], W2 = Union[t]; if (W1 == W2)return; if (group[W1].size() < group[W2].size()) { for (int i = 0; i < group[W1].size(); i++) { group[W2].push_back(group[W1][i]); Union[group[W1][i]] = W2; } group[W1].clear(); return; } if (group[W1].size() >= group[W2].size()) { for (int i = 0; i < group[W2].size(); i++) { group[W1].push_back(group[W2][i]); Union[group[W2][i]] = W1; } group[W2].clear(); return; } } bool same(int s, int t) { if (Union[s] == Union[t])return true; return false; } //--------------------------------Dijkstra--------------------------------- void dijkstra() { priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>>Q; for (int i = 0; i < 151515; i++) { dist[i] = 999999999999999LL; } for (int i = 0; i < W.size(); i++) { dist[W[i]] = 0; Q.push(make_pair(0, W[i])); } while (!Q.empty()) { int a1 = Q.top().first, a2 = Q.top().second; Q.pop(); for (int i = 0; i < vec[a2].size(); i++) { int to = vec[a2][i].first, cost = vec[a2][i].second; if (dist[to] > a1 + cost) { dist[to] = a1 + cost; Q.push(make_pair(dist[to], to)); } } } } //---------------------------BreadthFirstSearch---------------------------- void bfs() { queue<long long>Q; for (int i = 0; i < 151515; i++)dist[i] = 999999999999999LL; Q.push(1); dist[1] = 0; while (!Q.empty()) { int a1 = Q.front(); Q.pop(); for (int i = 0; i < X[a1].size(); i++) { int to = X[a1][i].first; if (dist[to] == 999999999999999LL) { dist[to] = dist[a1] + 1; Q.push(to); } } } } //----------------------------LCA,Construction----------------------------- void LCAConstruct() { for (int i = 0; i < 151515; i++) { for (int j = 0; j < 30; j++)Before[i][j] = -1; } for (int i = 1; i <= N; i++) { if (X_up[i].size() >= 1)Before[i][0] = X_up[i][0].first; } for (int i = 1; i < 30; i++) { for (int j = 1; j <= N; j++) { long long Before1 = Before[j][i - 1]; if (Before1 == -1)continue; Before[j][i] = Before[Before1][i - 1]; } } } void MinDistConstruct() { for (int i = 0; i < 151515; i++) { for (int j = 0; j < 30; j++)MinDist[i][j] = 999999999999999LL; } for (int i = 1; i <= N; i++) { if (X_up[i].size() >= 1) { MinDist[i][0] = X_up[i][0].second; } } for (int i = 1; i < 30; i++) { for (int j = 1; j <= N; j++) { long long Before1 = Before[j][i - 1]; if (Before1 == -1)continue; MinDist[j][i] = min(MinDist[j][i - 1], MinDist[Before1][i - 1]); } } } //--------------------------------Solvings--------------------------------- long long Before_solve(long long s, long long p) { int ret2 = s; for (int i = 0; i < 30; i++) { if ((p / (1LL << i)) % 2 == 1)ret2 = Before[ret2][i]; } return ret2; } long long lca(long long s, long long t) { long long L = 0, R = 1000000000, M; if (dist[s] < dist[t])t = Before_solve(t, dist[t] - dist[s]); if (dist[s] > dist[t])s = Before_solve(s, dist[s] - dist[t]); if (s == t)return s; while (true) { M = (L + R) / 2; long long A1 = Before_solve(s, M), A2 = Before_solve(s, M - 1); long long B1 = Before_solve(t, M), B2 = Before_solve(t, M - 1); if (A1 == B1 && A2 != B2)return A1; if (A1 != B1)L = M; if (A2 == B2)R = M; } } long long rmq(long long s, long long p) { if (p == 0)return alldist[s]; long long ret4 = 999999999999999LL, pos = s; for (int i = 0; i < 30; i++) { if ((p / (1 << i)) % 2 == 1) { ret4 = min(ret4, MinDist[pos][i]); pos = Before[pos][i]; } } return ret4; } long long solve(long long s, long long t) { long long lca2 = lca(s, t); long long dist1 = dist[s] - dist[lca2]; long long dist2 = dist[t] - dist[lca2]; long long rmq1 = rmq(s, dist1); long long rmq2 = rmq(t, dist2); return min(rmq1, rmq2); } //----------------------------------Main----------------------------------- int main() { for (int i = 0; i < 151515; i++) { group[i].push_back(i); Union[i] = i; } cin >> N >> M >> K >> Q; for (int i = 0; i < M; i++) { cin >> a >> b >> c; vec[a].push_back(make_pair(b, c)); vec[b].push_back(make_pair(a, c)); } for (int i = 0; i < K; i++) { cin >> a; W.push_back(a); } dijkstra(); for (int i = 1; i <= N; i++)alldist[i] = dist[i]; for (int i = 1; i <= N; i++) { for (int j = 0; j < vec[i].size(); j++) { tup.push_back(make_tuple(min(dist[i], dist[vec[i][j].first]), i, vec[i][j].first)); } } sort(tup.begin(), tup.end(), greater<tuple<long long, long long, long long>>()); for (int i = 0; i < tup.size(); i++) { long long a1 = get<1>(tup[i]), a2 = get<2>(tup[i]); if (same(a1, a2) == false) { unite(a1, a2); X[a1].push_back(make_pair(a2, get<0>(tup[i]))); X[a2].push_back(make_pair(a1, get<0>(tup[i]))); } } bfs(); for (int i = 1; i <= N; i++) { for (int j = 0; j < X[i].size(); j++) { if (dist[i] < dist[X[i][j].first]) { X_down[i].push_back(make_pair(X[i][j].first,X[i][j].second)); } if (dist[i] > dist[X[i][j].first]) { X_up[i].push_back(make_pair(X[i][j].first, X[i][j].second)); } } } LCAConstruct(); MinDistConstruct(); for (int i = 0; i < Q; i++) { cin >> start[i] >> goal[i]; cout << solve(start[i], goal[i]) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:158:9: error: 'sort' was not declared in this scope; did you mean 'short'? 158 | sort(tup.begin(), tup.end(), greater<tuple<long long, long long, long long>>()); | ^~~~ | short
s645363865
p00498
C++
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i,x) for(int i=0;i<x;++i) #define rrep(i,x) for(int i=x-1;i>=0;--i) #define rep1(i,x) for(int i=1;i<=x;++i) #define PB push_back #define PPB pop_back #define fst first #define scd second using vi = vector<int>; using vvi = vector<vi>; using pii = pair<int, int>; using vpii = vector<pii>; struct edge {int to, cost;}; using Graph = vector<edge>; const int inf = 3e18; struct UF { vi data; UF(int n) { data.resize(n, -1); } int root(int i) { return data[i] < 0 ? i : data[i] = root(data[i]); } int size(int x) { x = root(x); return -data[x]; } void unite(int x, int y) { x = root(x), y = root(y); if (x == y) return; if (size(x) < size(y)) swap(x, y); data[x] += data[y]; data[y] = x; } bool same(int x, int y) { x = root(x), y = root(y); return x == y; } }; Graph G[100010]; int d[100010]; int N, M, K, Q; int F[100010]; // LCA??¨ constexpr int max_log_n = log2(100010); vi tr[100010]; int parent[100010][max_log_n + 5]; int minimum[100010][max_log_n + 5]; int depth[100010]; void lca_dfs(int cur = 0, int par = -1, int dep = 0) { parent[cur][0] = par; minimum[cur][0] = min(d[cur], par == -1 ? inf : d[par]); depth[cur] = dep; for (int nx : tr[cur]) { if (nx == par) continue; lca_dfs(nx, cur, dep + 1); } } void lca_init() { lca_dfs(); rep(i, max_log_n) { rep(j, N) { if (~parent[j][i]) { parent[j][i + 1] = parent[parent[j][i]][i]; minimum[j][i + 1] = min(minimum[j][i], minimum[parent[j][i]][i]); } else { parent[j][i + 1] = -1; minimum[j][i + 1] = inf; } } } } int lca(int u, int v) { if (depth[u] > depth[v]) swap(u, v); int diff = depth[v] - depth[u]; rep(i, max_log_n + 1) { if (diff >> i & 1) v = parent[v][i]; } if (u == v) return u; rrep(i, max_log_n + 1) { if (parent[u][i] != parent[v][i]) { u = parent[u][i]; v = parent[v][i]; } } return parent[u][0]; } int calc2(int p, int c) { if (p == c) return d[p]; int dif = depth[c] - depth[p]; int mi = d[c]; rep(i, max_log_n+1) { if (dif & 1 << i) { mi = min(mi, minimum[c][i]); c = parent[c][i]; } } return mi; } int calc(int u, int v) { if (u == v) return d[u]; int l = lca(u, v); u = calc2(l, u), v = calc2(l, v); return min(u, v); } void dijkstra() { priority_queue<pii, vpii, greater<pii>> q; rep(i, K) { d[F[i]] = 0; q.push(pii(0, F[i])); } while (q.size()) { pii p = q.top(); q.pop(); int v = p.scd; if (d[v] < p.fst) continue; for (edge &e : G[v]) { if (d[e.to] > d[v] + e.cost) { d[e.to] = d[v] + e.cost; q.push(pii(d[e.to], e.to)); } } } } void build_tree() { using EdgeInfo = pair<int, pair<int, int>>; vector<EdgeInfo> E; rep(i, N) { for (edge& e : G[i]) { E.PB(EdgeInfo{pii(d[i], d[e.to]), pii(i, e.to)}); } } sort(begin(E), end(E), greater<EdgeInfo>()); UF uf(N); int n = E.size(); rep(i, n) { int from = E[i].scd.fst, to = E[i].scd.scd; if (uf.same(from, to)) continue; uf.unite(from, to); tr[from].PB(to); tr[to].PB(from); } } signed main() { cin >> N >> M >> K >> Q; rep(i, M) { int a, b, l; cin >> a >> b >> l; --a, --b; G[a].PB(edge{b, l}); G[b].PB(edge{a, l}); } rep(i, K) { cin >> F[i]; --F[i]; } fill_n(d, N + 1, inf); dijkstra(); build_tree(); lca_init(); rep(i, Q) { int s, t; cin >> s >> t; --s, --t; int v = calc(s, t); cout << v << endl; } //rep(i, N) { // cout << "d[" << i+1 << "] = " << d[i] << endl; //} //cout << "tree_debug:\n"; //rep(v, N) { // for (int u : tr[v]) { // if (v < u) { // cout << v+1 << " <-> " << u+1 << endl; // } // } //} }
a.cc: In function 'void build_tree()': a.cc:169:59: error: no matching function for call to 'std::pair<long long int, std::pair<long long int, long long int> >::pair(<brace-enclosed initializer list>)' 169 | E.PB(EdgeInfo{pii(d[i], d[e.to]), pii(i, e.to)}); | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<std::pair<long long int, long long int>, _U2>::value)), long long int, std::pair<long long int, long long int> >::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<std::pair<long long int, long long int>, _U2>::value)), long long int, std::pair<long long int, long long int> >::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = std::pair<long long int, long long int>]' 913 | explicit constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<std::pair<long long int, long long int>, _U2>::value)), long long int, std::pair<long long int, long long int> >::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<std::pair<long long int, long long int>, _U2>::value)), long long int, std::pair<long long int, long long int> >::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = std::pair<long long int, long long int>]' 902 | constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = std::pair<long long int, long long int>]' 891 | explicit constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:891:28: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:890:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 890 | bool>::type=false> | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = std::pair<long long int, long long int>]' 881 | constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:881:19: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:880:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 880 | bool>::type=true> | ^~~~ /usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<long long int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<std::pair<long long int, long long int>, _U2>, std::__not_<std::is_constructible<std::pair<long long int, long long int>, const _U1&> >, std::__not_<std::is_convertible<_U2, std::pair<long long int, long long int> > > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = std::pair<long long int, long long int>]' 869 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:869:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:866:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 866 | bool> = false> | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<long long int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<std::pair<long long int, long long int>, _U2>, std::__not_<std::is_constructible<std::pair<long long int, long long int>, const _U1&> >, std::is_convertible<_U2, std::pair<long long int, long long int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> = _U2; _T1 = long long int; _T2 = std::pair<long long int, long long int>]' 856 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:856:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:853:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 853 | bool> = true> | ^~~~ /usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<std::pair<long long int, long long int> >, std::is_constructible<long long int, _U1>, std::__not_<std::is_constructible<long long int, const _U1&> >, std::__not_<std::is_convertible<_U1, long long int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, __zero_as_null_pointer_constant, ...) [with typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U1, _T1> > >::value, bool>::type <anonymous> = _U1; _T1 = long long int; _T2 = std::pair<long long int, long long int>]' 843 | pair(_U1&& __x, __zero_as_null_pointer_constant, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:843:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:840:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 840 | bool> = false> | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:830:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<std::pair<long long int, long long int> >, std::is_constructible<long long int, _U1>, std::__not_<std::is_constructible<long long int, const _U1&> >, std::is_convertible<_U1, long long int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, __zero_as_null_pointer_constant, ...) [with typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U1, _T1> >::value, bool>::type <anonymous> = _U1; _T1 = long long int; _T2 = std::pair<long long int, long long int>]' 830 | pair(_U1&& __x, __zero_as_null_pointer_constant, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:830:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:827:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 827 | bool> = true> | ^~~~ /usr/include/c++/14/bits/stl_pair.h:789:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<long long int, _U1>::value) || (! std::is_same<st
s284206262
p00498
C++
#include<bits/stdc++.h> using namespace std; int N,M,K,a,b,c,d[200000],dist[200000]; vector<pair<int,int> >x[120000]; priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >Q; int main(){ cin>>N>>M>>K; for(int i=0;i<M;i++){ cin>>a>>b>>c;x[a].push_back(make_pair(b,c));x[b].push_back(make_pair(a,c)); } for(int i=0;i<K;i++){cin>>a;d[a]=1;} for(int i=1;i<=N;i++){dist[i]=999999999;if(d[i]==1){dist[i]=0;Q.push(make_pair(0,i));}} while(!Q.empty()){ int a1=Q.top().first,a2=Q.top().second;Q.pop(); for(int i=0;i<(int)x[a2].size();i++){ if(dist[x[a2][i].first]>a1+x[a2][i].second){ dist[x[a2][i].first]=a1+x[a2][i].second; Q.push(make_pair(dist[x[a2][i].first],x[a2][i].first)); } } } for(int i=1;i<=N;i++)d[i]=dist[i]; int Q;cin>>Q; for(int i=0;i<Q;i++){ cin>>a>>b;for(int j=1;j<=N;j++)dist[j]=0; dist[a]=d[a];Q.push(make_pair(-1*dist[a],a)); while(!Q.empty()){ int a1=-1*(Q.top().first); int a2=Q.top().second;Q.pop(); for(int j=0;j<(int)x[a2].size();j++){ int to=x[a2][j].first; int cost=min(a1,d[x[a2][j].first]); if(dist[to]<cost){ dist[to]=cost;Q.push(make_pair(-dist[to],to)); } } } cout<<dist[b]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:32: error: request for member 'push' in 'Q', which is of non-class type 'int' 26 | dist[a]=d[a];Q.push(make_pair(-1*dist[a],a)); | ^~~~ a.cc:27:26: error: request for member 'empty' in 'Q', which is of non-class type 'int' 27 | while(!Q.empty()){ | ^~~~~ a.cc:28:38: error: request for member 'top' in 'Q', which is of non-class type 'int' 28 | int a1=-1*(Q.top().first); | ^~~ a.cc:29:34: error: request for member 'top' in 'Q', which is of non-class type 'int' 29 | int a2=Q.top().second;Q.pop(); | ^~~ a.cc:29:49: error: request for member 'pop' in 'Q', which is of non-class type 'int' 29 | int a2=Q.top().second;Q.pop(); | ^~~ a.cc:34:57: error: request for member 'push' in 'Q', which is of non-class type 'int' 34 | dist[to]=cost;Q.push(make_pair(-dist[to],to)); | ^~~~
s235049359
p00498
C++
epth[x]; for(int l = 0; l < 20; l++)
a.cc:1:1: error: 'epth' does not name a type 1 | epth[x]; | ^~~~ a.cc:2:25: error: expected unqualified-id before 'for' 2 | for(int l = 0; l < 20; l++) | ^~~ a.cc:2:40: error: 'l' does not name a type 2 | for(int l = 0; l < 20; l++) | ^ a.cc:2:48: error: 'l' does not name a type 2 | for(int l = 0; l < 20; l++) | ^
s500259192
p00498
C++
#include <stdio.h> #include <string.h> #include <iostream> #include<string> #include<algorithm> #include<vector> #include<unordered_map> #include<unordered_set> #include<queue> #include<string.h> #include<functional> #define int long long #define P pair<int,int> using namespace std; int mincost[100000]; vector<P>rinsetu[100000]; struct E { int first, second, ID; }; struct F { int cost, v, u; }; bool operator <(E a, E b) { if (a.first != b.first)return a.first < b.first; return a.ID < b.ID; } int p[100000];//par int r[100000];//rank int find(int a) { if (p[a] == a)return a; return find(p[a]); } void unite(int a,int b) { int c = find(a), d = find(b); if (c == d)return; if (r[c] > r[d]) { p[d] = c; } else if (r[c] < r[d]) { p[c] = d; } else { r[c]++; p[d] = c; } } F c[200000];//??? int x[100000], y[100000], z[100000]; E n[100000];//????????¢?´¢???(S,G] signed main() { int M, Q;//????\???? int a, b; scanf("%lld%lld%lld%lld", &a, &b, &M, &Q); priority_queue<P, vector<P>, greater<P>>q; for (int d = 0; d < b; d++) { scanf("%lld%lld", &c[d].v, &c[d].u); int U; scanf("%lld", &U); c[d].v--; c[d].u--; rinsetu[c[d].v].push_back({ U,c[d].u }); rinsetu[c[d].u].push_back({ U,c[d].v }); } memset(mincost, 0x3f, sizeof(mincost)); for (int i = 0; i < M; i++) { int R; scanf("%lld", &R); R--; mincost[R] = 0; q.push({ 0,R }); } while (q.size()) { P t = q.top(); q.pop(); for (P i : rinsetu[t.second]) { if (mincost[i.second] > t.first + i.first) { mincost[i.second] = t.first + i.first; q.push({ mincost[i.second], i.second }); } } } int count = 0; for (int i = 0; i < a; i++) { for (P j : rinsetu[i]) { if (i < j.second) { c[count++] = { min(mincost[i],mincost[j.second]),i,j.second }; } } } sort(c, c + b, [](F a, F b) {if (a.cost != b.cost)return a.cost > b.cost; return a.v * 1000000 + a.u > b.v * 1000000 + b.u; }); for (int i = 0; i < count; i++) { cout << c[i].cost << " " << c[i].v << " " << c[i].u << endl; } for (int i = 0; i < Q; i++) { scanf("%lld%lld", &x[i], &y[i]); x[i]--; y[i]--; n[i] = { 0,INT_MAX,i }; } for (int i = 0; i < 100; i++) { for (int j = 0; j < a; j++) {//UF???????????? p[j] = j; r[j] = 0; } sort(n, n + Q, [](E a, E b) {if (a.first != b.first)return a.first > b.first; return a.ID < b.ID; }); int K = 0; for (int j = 0; j < Q; j++) { int T = (n[j].first + n[j].second) / 2; while (c[K].cost >= T&&K<b) { unite(c[K].u, c[K].v); K++; } if (find(x[n[j].ID])== find(y[n[j].ID])) { n[j].first = T; } else { n[j].second = T; } } } sort(n, n + Q, [](E a, E b) {return a.ID < b.ID; }); for (int i = 0; i < Q; i++) { printf("%lld\n", n[i].first); } }
a.cc: In function 'int main()': a.cc:93:28: error: 'INT_MAX' was not declared in this scope 93 | n[i] = { 0,INT_MAX,i }; | ^~~~~~~ a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 11 | #include<functional> +++ |+#include <climits> 12 | #define int long long a.cc:93:38: error: no match for 'operator=' (operand types are 'E' and '<brace-enclosed initializer list>') 93 | n[i] = { 0,INT_MAX,i }; | ^ a.cc:18:8: note: candidate: 'constexpr E& E::operator=(const E&)' 18 | struct E { | ^ a.cc:18:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const E&' a.cc:18:8: note: candidate: 'constexpr E& E::operator=(E&&)' a.cc:18:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'E&&'
s952040994
p00498
C++
#include<iostream> #include<vector> #include<queue> #include<algorithm> using namespace std; #define INF (1 << 29)#include<iostream> #include<vector> #include<queue> #include<algorithm> using namespace std; #define INF (1 << 29) typedef pair<long long , long long > EDGE; typedef pair<long long , EDGE> COST; vector<EDGE> edge[100100], edges; long long dist[100100]; long long parents[100100][29]; long long minimum[100100][29]; long long depth[100100]; long long u[100100]; long long k, f, n, m, a, b, l, s, t, q; void dijkstra(){//fill dist priority_queue<pair<long long, long long> ,vector<pair<long long, long long> >, greater<pair<long long, long long> > > pq; for(long long i = 0;i < k;i++){ cin >> f; dist[f] = 0; pq.push(make_pair(0, f)); } while(!pq.empty()){ pair<long long , long long> tmp = pq.top();pq.pop(); long long node = tmp.second; if(dist[node] < tmp.first)continue; for(long long i = 0;i < edge[node].size();i++){ if(dist[edge[node][i].first] > edge[node][i].second + dist[node]){ dist[edge[node][i].first] = edge[node][i].second + dist[node]; pq.push(make_pair(dist[edge[node][i].first], edge[node][i].first)); } } } } long long unin(long long x){ if(u[x] == x)return x; return u[x] = unin(u[x]); } void unite(long long a, long long b){ a = unin(a); b = unin(b); u[b] = a; } void ddfs(long long x, long long d, long long last){ depth[x] = d; parents[x][0] = last; if(last != -INF) minimum[x][0] = min(dist[x], dist[last]); else minimum[x][0] = -INF; for(long long i = 0;i < edge[x].size();i++){ if(edge[x][i].first == last)continue; ddfs(edge[x][i].first, d + 1, x); } } void make_tree(){ priority_queue<COST> pq; for(long long i = 0;i <= n;i++)edge[i].clear(); for(long long i = 0;i < edges.size();i++){ long long a = edges[i].first, b = edges[i].second; pq.push(COST(max(dist[a], dist[b]), edges[i])); } for(long long i = 1;i <= n;i++)u[i] = i; while(!pq.empty()){ COST tmp = pq.top();pq.pop(); long long a = tmp.second.first, b = tmp.second.second; if(unin(a) == unin(b))continue; edge[a].push_back(EDGE(b, tmp.first)); edge[b].push_back(EDGE(a, tmp.first)); unite(a, b); } ddfs(1, 0, -INF);//fill depth and parents[i][0] for(long long i = 1;i <= 30;i++){ for(long long j = 0;j <= n;j++){ if(parents[j][i - 1] != -INF){ parents[j][i] = parents[parents[j][i - 1]][i - 1]; minimum[j][i] = min(minimum[j][i - 1], minimum[parents[j][i - 1]][i - 1]); } else{ parents[j][i] = -INF; minimum[j][i] = -INF; } } } } long long above(long long x, long long d, long long r){ if(x == -INF)return -INF; if(d == 0)return x; while((1 << r) > d)r--; return above(parents[x][r], d - (1 << r), r); } long long mini(long long x, long long d, long long r){ if(d == 0)return dist[x]; while((1 << r) > d)r--; return min(minimum[x][r], mini(parents[x][r], d - (1 << r), r)); } long long solve(long long a, long long b){ long long res; if(depth[a] < depth[b])swap(a, b); res = mini(a, depth[a] - depth[b], 30); a = above(a, depth[a] - depth[b], 30); if(a == b)return res; long long top = 100100, bottom = 0; while(top - bottom > 1){ long long mid = (top + bottom) / 2; if(above(a, mid, 30) == above(b, mid, 30)) top = mid; else bottom = mid; } res = min(res, mini(a, top, 30)); res = min(res, mini(b, top, 30)); return res; } int main(){ fill(dist, dist + 105000, INF); cin >> n >> m >> k >> q; for(long long i = 0;i < m;i++){ cin >> a >> b >> l; edge[a].push_back(EDGE(b,l)); edge[b].push_back(EDGE(a,l)); edges.push_back(EDGE(a,b)); } dijkstra(); make_tree(); for(long long i = 0;i < q;i++){ cin >> s >> t; cout << solve(s, t) << endl; } return 0; } /* 9 0 5 7 0 10 0 5 10 7 0 9 */ typedef pair<long long , long long > EDGE; typedef pair<long long , EDGE> COST; vector<EDGE> edge[100100], edges; long long dist[100100]; long long parents[100100][31]; long long minimum[100100][31]; long long depth[100100]; long long u[100100]; long long k, f, n, m, a, b, l, s, t, q; void dijkstra(){//fill dist priority_queue<pair<long long, long long> ,vector<pair<long long, long long> >, greater<pair<long long, long long> > > pq; for(long long i = 0;i < k;i++){ cin >> f; dist[f] = 0; pq.push(make_pair(0, f)); } while(!pq.empty()){ pair<long long , long long> tmp = pq.top();pq.pop(); long long node = tmp.second; if(dist[node] < tmp.first)continue; for(long long i = 0;i < edge[node].size();i++){ if(dist[edge[node][i].first] > edge[node][i].second + dist[node]){ dist[edge[node][i].first] = edge[node][i].second + dist[node]; pq.push(make_pair(dist[edge[node][i].first], edge[node][i].first)); } } } } long long unin(long long x){ if(u[x] == x)return x; return u[x] = unin(u[x]); } void unite(long long a, long long b){ a = unin(a); b = unin(b); u[b] = a; } void ddfs(long long x, long long d, long long last){ depth[x] = d; parents[x][0] = last; if(last != -INF) minimum[x][0] = min(dist[x], dist[last]); else minimum[x][0] = -INF; for(long long i = 0;i < edge[x].size();i++){ if(edge[x][i].first == last)continue; ddfs(edge[x][i].first, d + 1, x); } } void make_tree(){ priority_queue<COST> pq; for(long long i = 0;i <= n;i++)edge[i].clear(); for(long long i = 0;i < edges.size();i++){ long long a = edges[i].first, b = edges[i].second; pq.push(COST(max(dist[a], dist[b]), edges[i])); } for(long long i = 1;i <= n;i++)u[i] = i; while(!pq.empty()){ COST tmp = pq.top();pq.pop(); long long a = tmp.second.first, b = tmp.second.second; if(unin(a) == unin(b))continue; edge[a].push_back(EDGE(b, tmp.first)); edge[b].push_back(EDGE(a, tmp.first)); unite(a, b); } ddfs(1, 0, -INF);//fill depth and parents[i][0] for(long long i = 1;i <= 30;i++){ for(long long j = 0;j <= n;j++){ if(parents[j][i - 1] != -INF){ parents[j][i] = parents[parents[j][i - 1]][i - 1]; minimum[j][i] = min(minimum[j][i - 1], minimum[parents[j][i - 1]][i - 1]); } else{ parents[j][i] = -INF; minimum[j][i] = -INF; } } } } long long above(long long x, long long d, long long r){ if(x == -INF)return -INF; if(d == 0)return x; while((1 << r) > d)r--; return above(parents[x][r], d - (1 << r), r); } long long mini(long long x, long long d, long long r){ if(d == 0)return dist[x]; while((1 << r) > d)r--; return min(minimum[x][r], mini(parents[x][r], d - (1 << r), r)); } long long solve(long long a, long long b){ long long res; if(depth[a] < depth[b])swap(a, b); res = mini(a, depth[a] - depth[b], 30); a = above(a, depth[a] - depth[b], 30); if(a == b)return res; long long top = 100100, bottom = 0; while(top - bottom > 1){ long long mid = (top + bottom) / 2; if(above(a, mid, 30) == above(b, mid, 30)) top = mid; else bottom = mid; } res = min(res, mini(a, top, 30)); res = min(res, mini(b, top, 30)); return res; } int main(){ fill(dist, dist + 105000, INF); cin >> n >> m >> k >> q; for(long long i = 0;i < m;i++){ cin >> a >> b >> l; edge[a].push_back(EDGE(b,l)); edge[b].push_back(EDGE(a,l)); edges.push_back(EDGE(a,b)); } dijkstra(); make_tree(); for(long long i = 0;i < q;i++){ cin >> s >> t; cout << solve(s, t) << endl; } return 0; } /* 9 0 5 7 0 10 0 5 10 7 0 9 */
a.cc:11:9: warning: "INF" redefined 11 | #define INF (1 << 29) | ^~~ a.cc:6:9: note: this is the location of the previous definition 6 | #define INF (1 << 29)#include<iostream> | ^~~ a.cc:168:14: error: redefinition of 'std::vector<std::pair<long long int, long long int> > edge [100100]' 168 | vector<EDGE> edge[100100], edges; | ^~~~ a.cc:15:14: note: 'std::vector<std::pair<long long int, long long int> > edge [100100]' previously declared here 15 | vector<EDGE> edge[100100], edges; | ^~~~ a.cc:168:28: error: redefinition of 'std::vector<std::pair<long long int, long long int> > edges' 168 | vector<EDGE> edge[100100], edges; | ^~~~~ a.cc:15:28: note: 'std::vector<std::pair<long long int, long long int> > edges' previously declared here 15 | vector<EDGE> edge[100100], edges; | ^~~~~ a.cc:169:12: error: redefinition of 'long long int dist [100100]' 169 | long long dist[100100]; | ^~~~ a.cc:16:12: note: 'long long int dist [100100]' previously declared here 16 | long long dist[100100]; | ^~~~ a.cc:170:12: error: conflicting declaration 'long long int parents [100100][31]' 170 | long long parents[100100][31]; | ^~~~~~~ a.cc:17:12: note: previous declaration as 'long long int parents [100100][29]' 17 | long long parents[100100][29]; | ^~~~~~~ a.cc:171:12: error: conflicting declaration 'long long int minimum [100100][31]' 171 | long long minimum[100100][31]; | ^~~~~~~ a.cc:18:12: note: previous declaration as 'long long int minimum [100100][29]' 18 | long long minimum[100100][29]; | ^~~~~~~ a.cc:172:12: error: redefinition of 'long long int depth [100100]' 172 | long long depth[100100]; | ^~~~~ a.cc:19:12: note: 'long long int depth [100100]' previously declared here 19 | long long depth[100100]; | ^~~~~ a.cc:173:12: error: redefinition of 'long long int u [100100]' 173 | long long u[100100]; | ^ a.cc:20:12: note: 'long long int u [100100]' previously declared here 20 | long long u[100100]; | ^ a.cc:174:12: error: redefinition of 'long long int k' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:12: note: 'long long int k' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:15: error: redefinition of 'long long int f' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:15: note: 'long long int f' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:18: error: redefinition of 'long long int n' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:18: note: 'long long int n' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:21: error: redefinition of 'long long int m' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:21: note: 'long long int m' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:24: error: redefinition of 'long long int a' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:24: note: 'long long int a' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:27: error: redefinition of 'long long int b' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:27: note: 'long long int b' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:30: error: redefinition of 'long long int l' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:30: note: 'long long int l' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:33: error: redefinition of 'long long int s' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:33: note: 'long long int s' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:36: error: redefinition of 'long long int t' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:36: note: 'long long int t' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:174:39: error: redefinition of 'long long int q' 174 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:21:39: note: 'long long int q' previously declared here 21 | long long k, f, n, m, a, b, l, s, t, q; | ^ a.cc:175:6: error: redefinition of 'void dijkstra()' 175 | void dijkstra(){//fill dist | ^~~~~~~~ a.cc:22:6: note: 'void dijkstra()' previously defined here 22 | void dijkstra(){//fill dist | ^~~~~~~~ a.cc:197:12: error: redefinition of 'long long int unin(long long int)' 197 | long long unin(long long x){ | ^~~~ a.cc:44:12: note: 'long long int unin(long long int)' previously defined here 44 | long long unin(long long x){ | ^~~~ a.cc:202:6: error: redefinition of 'void unite(long long int, long long int)' 202 | void unite(long long a, long long b){ | ^~~~~ a.cc:49:6: note: 'void unite(long long int, long long int)' previously defined here 49 | void unite(long long a, long long b){ | ^~~~~ a.cc:208:6: error: redefinition of 'void ddfs(long long int, long long int, long long int)' 208 | void ddfs(long long x, long long d, long long last){ | ^~~~ a.cc:55:6: note: 'void ddfs(long long int, long long int, long long int)' previously defined here 55 | void ddfs(long long x, long long d, long long last){ | ^~~~ a.cc:219:6: error: redefinition of 'void make_tree()' 219 | void make_tree(){ | ^~~~~~~~~ a.cc:66:6: note: 'void make_tree()' previously defined here 66 | void make_tree(){ | ^~~~~~~~~ a.cc:250:12: error: redefinition of 'long long int above(long long int, long long int, long long int)' 250 | long long above(long long x, long long d, long long r){ | ^~~~~ a.cc:97:12: note: 'long long int above(long long int, long long int, long long int)' previously defined here 97 | long long above(long long x, long long d, long long r){ | ^~~~~ a.cc:257:12: error: redefinition of 'long long int mini(long long int, long long int, long long int)' 257 | long long mini(long long x, long long d, long long r){ | ^~~~ a.cc:104:12: note: 'long long int mini(long long int, long long int, long long int)' previously defined here 104 | long long mini(long long x, long long d, long long r){ | ^~~~ a.cc:263:12: error: redefinition of 'long long int solve(long long int, long long int)' 263 | long long solve(long long a, long long b){ | ^~~~~ a.cc:110:12: note: 'long long int solve(long long int, long long int)' previously defined here 110 | long long solve(long long a, long long b){ | ^~~~~ a.cc:283:6: error: redefinition of 'int main()' 283 | int main(){ | ^~~~ a.cc:130:6: note: 'int main()' previously defined here 130 | int main(){ | ^~~~
s454566406
p00498
C++
//Bokan ga bokka--nn!! //Daily Lunch Special Tanoshii !! #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> #include <map> #include <set> #include <cassert> using namespace std; typedef pair<int,int> P; typedef pair<int,P> P1; typedef pair<P,P> P2; typedef long long ll; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 500000000 #define s(x) scanf("%d",&x) #define rep(i,x) for(int i=0;i<x;i++) int d[100005]; priority_queue<P,vector<P>,greater<P> >que; vector<P>edge[100005]; int par[100005],ran[100005]; vector<P1>all; void init() { for(int i=0;i<100005;i++) { par[i]=i; ran[i]=0;} } int find(int x) { if(par[x]==x) return x; else return par[x]=find(par[x]); } void unite(int x,int y) { x=find(x); y=find(y); if(x==y) return; if(ran[x]<ran[y]) { par[x]=y; } else { par[y]=x; if(ran[x]==ran[y]) ran[x]++; } } bool same(int x,int y) { return find(x)==find(y); } vector<int>next[100005]; int parent[20][100005][2]; int dep[100005]; void dfs(int v,int p,int d) { parent[0][v][0]=p; if(parent[0][v][0]!=-1) parent[0][v][1]=min(d[p],d[v]); else parent[0][v][1]=INF; depth[v]=d; for(int i=0;i<next[v].size();i++) { if(next[v][i]!=p) { dfs(next[v][i],v,d+1); } } } void init2() { dfs(1,0,-1); for(int k=0;k+1<20;k++) { for(int v=1;v<=n;v++) { if(parent[k][v][0]<0) { parent[k+1][v][0]=-1; parent[k+1][v][1]=INF;} else{ parent[k+1][v][0]=parent[k][parent[k][v][0]][0]; parent[k+1][v][1]=min(parent[k][v][1],parent[k][parent[k][v][0]][1]); } } } } int lca(int u,int v) { int val=INF; if(depth[u]>depth[v]) swap(u,v); for(int k=0;k<20;k++) { if((depth[v]-depth[u])>>k & 1) { val=min(val,parent[k][v][1]); v=parent[k][v][0]; } } if(u==v) return val; for(int k=19;k>=0;k--) { if(parent[k][u][0]!=parent[k][v][0]) { val=min(val,min(parent[k][v][1],parent[k][u][1])); u=parent[k][u][0]; v=parent[k][v][0]; } } return val; } int main() { int n,m,k,q; scanf("%d %d %d %d",&n,&m,&k,&q); for(int i=1;i<=m;i++) { int a,b,l; scanf("%d %d %d",&a,&b,&l); edge[a].pb(mp(b,l)); edge[b].pb(mp(a,l)); } fill(d,d+100005,INF); for(int i=1;i<=k;i++) { int v; scanf("%d",&v); d[v]=0; que.push(mp(d[v],v)); } while(!que.empty()) { P p=que.top(); que.pop(); if(p.first!=d[p.second]) continue; for(int i=0;i<edge[p.second].size();i++) { if(d[edge[p.second][i].first]>p.first+edge[p.second][i].second) { d[edge[p.second][i].first]=p.first+edge[p.second][i].second; que.push(mp(d[edge[p.second][i].first],edge[p.second][i].first)); } } } for(int i=1;i<=n;i++) { for(int j=0;j<edge[i].size();j++) { all.pb(mp(min(d[i],d[edge[i][j].first]),mp(i,edge[i][j].first))); } } sort(all.begin(),all.end(),greater<P1>()); init(); int s=0; for(int i=0;i<all.size();i++) { P1 p=all[i]; int x=p.second.first; int y=p.second.second; if(same(x,y)) continue; unite(x,y); next[x].pb(y); next[y].pb(x); //root=x; //s++; //printf("%d\n",i); } //assert(s==n-1); //int f=0; for(int i=0;i<131072*4;i++) segment[i][0]=segment[i][1]=INF; fill(dist,dist+300005,INF); //dfs(1,-1,0,f); init2(); /*for(int i=0;i<131072*2;i++) { //if(dist[i]!=INF) printf("%d %d %d\n",i,dist[i],id[i]); update(i,depth[i]); }*/ //dfs2(1,-1,0); for(int i=0;i<q;i++) { int a,b; scanf("%d %d",&a,&b); printf("%d\n",lca(a,b)); } }
a.cc: In function 'void dfs(int, int, int)': a.cc:69:54: error: invalid types 'int[int]' for array subscript 69 | if(parent[0][v][0]!=-1) parent[0][v][1]=min(d[p],d[v]); | ^ a.cc:69:59: error: invalid types 'int[int]' for array subscript 69 | if(parent[0][v][0]!=-1) parent[0][v][1]=min(d[p],d[v]); | ^ a.cc:71:9: error: 'depth' was not declared in this scope; did you mean 'dep'? 71 | depth[v]=d; | ^~~~~ | dep a.cc:72:23: error: reference to 'next' is ambiguous 72 | for(int i=0;i<next[v].size();i++) | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:6: /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:63:12: note: 'std::vector<int> next [100005]' 63 | vector<int>next[100005]; | ^~~~ a.cc:74:20: error: reference to 'next' is ambiguous 74 | if(next[v][i]!=p) | ^~~~ /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:63:12: note: 'std::vector<int> next [100005]' 63 | vector<int>next[100005]; | ^~~~ a.cc:76:29: error: reference to 'next' is ambiguous 76 | dfs(next[v][i],v,d+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:63:12: note: 'std::vector<int> next [100005]' 63 | vector<int>next[100005]; | ^~~~ a.cc: In function 'void init2()': a.cc:85:32: error: 'n' was not declared in this scope 85 | for(int v=1;v<=n;v++) | ^ a.cc: In function 'int lca(int, int)': a.cc:98:12: error: 'depth' was not declared in this scope; did you mean 'dep'? 98 | if(depth[u]>depth[v]) swap(u,v); | ^~~~~ | dep a.cc:101:21: error: 'depth' was not declared in this scope; did you mean 'dep'? 101 | if((depth[v]-depth[u])>>k & 1) | ^~~~~ | dep a.cc: In function 'int main()': a.cc:167:17: error: reference to 'next' is ambiguous 167 | next[x].pb(y); | ^~~~ /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:63:12: note: 'std::vector<int> next [100005]' 63 | vector<int>next[100005]; | ^~~~ a.cc:168:17: error: reference to 'next' is ambiguous 168 | next[y].pb(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:63:12: note: 'std::vector<int> next [100005]' 63 | vector<int>next[100005]; | ^~~~ a.cc:175:37: error: 'segment' was not declared in this scope 175 | for(int i=0;i<131072*4;i++) segment[i][0]=segment[i][1]=INF; | ^~~~~~~ a.cc:176:14: error: 'dist' was not declared in this scope 176 | fill(dist,dist+300005,INF); | ^~~~
s140127022
p00499
Java
import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.PriorityQueue; import java.math.BigInteger; public class Main{ static final InputStream in=System.in; static final PrintWriter out=new PrintWriter(System.out); static final int INF=Integer.MAX_VALUE/2; static final long LINF=Long.MAX_VALUE/2; static int L,A,B,C,D; public static void main(String[] args) throws IOException{ InputReader ir=new InputReader(in); L=ir.nextInt(); A=ir.nextInt(); B=ir.nextInt(); C=ir.nextInt(); D=ir.nextInt(); A=(A%C==0)?A/C:A/C+1; B=(B%D==0)?B/D:B/D+1; out.println(L-Math.max(A,B)); out.flush(); } public static boolean isPalindrome(int s,int e){ for(int i=0;i<=(e-s)/2;i++) if(str.charAt(s+i)!=str.charAt(e-i)) return false; return true; } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in;} public int readByte() { if(lenbuf==-1) throw new InputMismatchException(); if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return -1; } return buffer[curbuf++]; } public boolean isSpaceChar(int c){return !(c>=33&&c<=126);} private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;} public String next() { int b=skip(); StringBuilder sb=new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public int[] toIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } } }
Main.java:38: error: cannot find symbol for(int i=0;i<=(e-s)/2;i++) if(str.charAt(s+i)!=str.charAt(e-i)) return false; ^ symbol: variable str location: class Main Main.java:38: error: cannot find symbol for(int i=0;i<=(e-s)/2;i++) if(str.charAt(s+i)!=str.charAt(e-i)) return false; ^ symbol: variable str location: class Main 2 errors
s881054983
p00499
Java
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int r; if(a/c+1>=b/d+1) r = l-(a/c+1); else r = l-(b/d+1); System.out.println(r); }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) 1 error
s218684564
p00499
Java
package aoj0576; import java.util.Scanner; public class Homework { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int k_cnt = 0, s_cnt = 0, answer; while(a > 0) { a = a - c; k_cnt = k_cnt + 1; } while(b > 0) { b = b - d; s_cnt = s_cnt + 1; } if(k_cnt > s_cnt) { answer = l - k_cnt; } else { answer = l - s_cnt; } System.out.println(answer); } }
Main.java:5: error: class Homework is public, should be declared in a file named Homework.java public class Homework { ^ 1 error
s753685085
p00499
Java
public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int k_cnt = 0, s_cnt = 0, answer; while(a > 0) { a = a - c; k_cnt = k_cnt + 1; } while(b > 0) { b = b - d; s_cnt = s_cnt + 1; } if(k_cnt > s_cnt) { answer = l - k_cnt; } else { answer = l - s_cnt; } System.out.println(answer); }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) 1 error
s773240344
p00499
Java
public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int L = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int Japa , Math; if(A % C == 0){ Japa = A / C; }else{ Japa = A / C + 1; } if(B % D == 0){ Math = B / D; }else{ Math = B / D + 1; } int Bigone = Japa; if(Japa < Math){ Bigone = Math; } System.out.println(L - Bigone); } }
Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s940822525
p00499
Java
public class Homework { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int k_cnt = 0, s_cnt = 0, answer; while(a > 0) { a = a - c; k_cnt = k_cnt + 1; } while(b > 0) { b = b - d; s_cnt = s_cnt + 1; } if(k_cnt > s_cnt) { answer = l - k_cnt; } else { answer = l - s_cnt; } System.out.println(answer); } }
Main.java:1: error: class Homework is public, should be declared in a file named Homework.java public class Homework { ^ Main.java:5: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Homework Main.java:5: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Homework 3 errors
s119312381
p00499
Java
import java.util.Scanner; public class Homework { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int k_cnt = 0, s_cnt = 0, answer; while(a > 0) { a = a - c; k_cnt = k_cnt + 1; } while(b > 0) { b = b - d; s_cnt = s_cnt + 1; } if(k_cnt > s_cnt) { answer = l - k_cnt; } else { answer = l - s_cnt; } System.out.println(answer); } }
Main.java:3: error: class Homework is public, should be declared in a file named Homework.java public class Homework { ^ 1 error
s062745659
p00499
Java
import java.util.Scanner; public class Homework { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int k_cnt = 0, s_cnt = 0, answer; while(a > 0) { a = a - c; k_cnt = k_cnt + 1; } while(b > 0) { b = b - d; s_cnt = s_cnt + 1; } if(k_cnt > s_cnt) { answer = l - k_cnt; } else { answer = l - s_cnt; } System.out.println(answer); } }
Main.java:3: error: class Homework is public, should be declared in a file named Homework.java public class Homework { ^ 1 error
s095231007
p00499
Java
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int r; if(a/c+1>=b/d+1) r = l-(a/c+1); else r = l-(b/d+1); System.out.println(r); } }
Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s816071812
p00499
Java
import java.util.Scanner; public class homework { private int page; private int max; private boolean flg = true; public homework(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page <= 0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); homework ko = new homework(a,c); homework su = new homework(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:2: error: class homework is public, should be declared in a file named homework.java public class homework { ^ 1 error
s657574646
p00499
Java
public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner cs = new Scanner(System.in); int L = cs.nextInt(); int A = cs.nextInt(); int B = cs.nextInt(); int C = cs.nextInt(); int D = cs.nextInt(); int ans, japan, math; japan = A / C; if(A % C !=0){ japan = japan + 1; } math = B / D; if(B % D != 0){ math =math + 1; } if(japan < math){ ans = L - math; }else{ ans = L - japan; } System.out.println(ans); }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) 1 error
s549671732
p00499
Java
import java.util.Scanner; public class main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner cs = new Scanner(System.in); int L = cs.nextInt(); int A = cs.nextInt(); int B = cs.nextInt(); int C = cs.nextInt(); int D = cs.nextInt(); int ans, japan, math; japan = A / C; if(A % C !=0){ japan = japan + 1; } math = B / D; if(B % D != 0){ math =math + 1; } if(japan < math){ ans = L - math; }else{ ans = L - japan; } System.out.println(ans); } }
Main.java:3: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s469001031
p00499
Java
public class main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner cs = new Scanner(System.in); int L = cs.nextInt(); int A = cs.nextInt(); int B = cs.nextInt(); int C = cs.nextInt(); int D = cs.nextInt(); int ans, japan, math; japan = A / C; if(A % C !=0){ japan = japan + 1; } math = B / D; if(B % D != 0){ math =math + 1; } if(japan < math){ ans = L - math; }else{ ans = L - japan; } System.out.println(ans); } }
Main.java:3: error: class main is public, should be declared in a file named main.java public class main { ^ Main.java:6: error: cannot find symbol Scanner cs = new Scanner(System.in); ^ symbol: class Scanner location: class main Main.java:6: error: cannot find symbol Scanner cs = new Scanner(System.in); ^ symbol: class Scanner location: class main 3 errors
s245522667
p00499
Java
public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner cs = new Scanner(System.in); int L = cs.nextInt(); int A = cs.nextInt(); int B = cs.nextInt(); int C = cs.nextInt(); int D = cs.nextInt(); int ans, japan, math; japan = A / C; if(A % C !=0){ japan = japan + 1; } math = B / D; if(B % D != 0){ math =math + 1; } if(japan < math){ ans = L - math; }else{ ans = L - japan; } System.out.println(ans); } }
Main.java:4: error: cannot find symbol Scanner cs = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner cs = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s065155100
p00499
Java
public class MAIN { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner cs = new Scanner(System.in); int L = cs.nextInt(); int A = cs.nextInt(); int B = cs.nextInt(); int C = cs.nextInt(); int D = cs.nextInt(); int ans, japan, math; japan = A / C; if(A % C !=0){ japan = japan + 1; } math = B / D; if(B % D != 0){ math =math + 1; } if(japan < math){ ans = L - math; }else{ ans = L - japan; } System.out.println(ans); } }
Main.java:1: error: class MAIN is public, should be declared in a file named MAIN.java public class MAIN { ^ Main.java:4: error: cannot find symbol Scanner cs = new Scanner(System.in); ^ symbol: class Scanner location: class MAIN Main.java:4: error: cannot find symbol Scanner cs = new Scanner(System.in); ^ symbol: class Scanner location: class MAIN 3 errors
s089416287
p00499
Java
public class main{ public class homework { private int page; private int max; private boolean flg = true; public homework(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page < 0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); homework ko = new homework(a,c); homework su = new homework(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } } }
Main.java:1: error: class main is public, should be declared in a file named main.java public class main{ ^ Main.java:18: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class main.homework Main.java:18: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class main.homework Main.java:25: error: non-static variable this cannot be referenced from a static context homework ko = new homework(a,c); ^ Main.java:26: error: non-static variable this cannot be referenced from a static context homework su = new homework(b,d); ^ 5 errors
s204921757
p00499
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int L = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int x; int y; int z; x = A % C; y = B % D; if(x == 0)x = x; else x = x + 1; if(y == 0)y = y; else y = y + 1; z = L - x - y; System.out.println(z);
Main.java:22: error: reached end of file while parsing System.out.println(z); ^ 1 error
s246727496
p00499
Java
public class main { private int page; private int max; boolean flg = true; public main(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page < 0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); main ko = new main(a,c); main su = new main(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:1: error: class main is public, should be declared in a file named main.java public class main { ^ Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class main Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class main 3 errors
s261406812
p00499
Java
public class main { private int page; private int max; boolean flg = true; public main(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page <=0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); main ko = new main(a,c); main su = new main(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:1: error: class main is public, should be declared in a file named main.java public class main { ^ Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class main Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class main 3 errors
s650418889
p00499
Java
import java.util.Scanner; public class main { private int page; private int max; boolean flg = true; public main(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page <=0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); main ko = new main(a,c); main su = new main(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:2: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s152409641
p00499
Java
public class Main { private int page; private int max; boolean flg = true; public main(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page <=0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); main ko = new main(a,c); main su = new main(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:5: error: invalid method declaration; return type required public main(int a,int b){ ^ 1 error
s119591291
p00499
Java
public class Main { private int page; private int max; boolean flg = true; public Main(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page <=0){ this.page = 0; this.flg = false; } } public static void Main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); Main ko = new Main(a,c); Main su = new Main(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s041909371
p00499
Java
import java.util.Scanner; public class main { private int page; private int max; boolean flg = true; public main(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page <=0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); main ko = new main(a,c); main su = new main(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:2: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s084040469
p00499
Java
public class Main { private int page; private int max; boolean flg = true; public Main(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page <=0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); Main ko = new Main(a,c); Main su = new Main(b,d); while(ko.flg && su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s042885816
p00499
Java
public class Main{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int L = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int y = 0; int i = 0; for(i = 0;i<=L;i++){ A = A - C; B = B - D; y++; if(A<=0&&B<=0){ L = L - y; System.out.println(L); break; } } } }
Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s249701980
p00499
Java
public class Main { public static void main(String[]args){ Scanner sc = new Scanner(System.in); int L = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int y = 0; int i = 0; for(i = 0;i<=L;i++){ A = A - C; B = B - D; y++; if(A<=0&&B<=0){ L = L - y; System.out.println(L); break; } } } }
Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s602745901
p00499
Java
public class Main { private int page; private int max; boolean flg = true; public Main(int a,int b){ page = a; max = b; } public void study(){ this.page -= this.max; if(this.page <=0){ this.page = 0; this.flg = false; } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int l,a,b,c,d,ans = 0; l = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); Main ko = new Main(a,c); Main su = new Main(b,d); while(ko.flg || su.flg){ ko.study(); su.study(); ans ++; } System.out.println(l - (ans)); } }
Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:17: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s522453595
p00499
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int l; int a, b, c, d; int dayJ = 0, dayM = 0; l = scan.nextInt(); a = scan.nextInt(); b = scan.nextInt(); c = scan.nextInt(); d = scan.nextInt(); if(a%c == 0)dayJ = a / c + 1; else dayJ = a / c; System.out.println(dayJ); if(b%d == 0)dayM = b / d + 1; else dayM = b / d; System.out.println(dayM); System.out.println((l - (dayJ + dayM))); }
Main.java:26: error: reached end of file while parsing } ^ 1 error
s591508336
p00499
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class AOJ_0576 { public static void main(String[] args) throws Exception { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); int i; int[] in = new int[5]; for(i=0; i<in.length; i++){ in[i] = Integer.valueOf(r.readLine()); } // START // for(i=0; in[1]>0 || in[2]>0; in[1]-=in[3], in[2]-=in[4], i++); System.out.println(in[0] - i); // E N D // } }
Main.java:4: error: class AOJ_0576 is public, should be declared in a file named AOJ_0576.java public class AOJ_0576 { ^ 1 error
s847031986
p00499
Java
class Main { public static void main(String[] args) throws Exception { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); int i; int[] in = new int[5]; for(i=0; i<in.length; i++){ in[i] = Integer.valueOf(r.readLine()); } // START // for(i=0; in[1]>0 || in[2]>0; in[1]-=in[3], in[2]-=in[4], i++); System.out.println(in[0] - i); // E N D // } }
Main.java:3: error: cannot find symbol BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:3: error: cannot find symbol BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:3: error: cannot find symbol BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 3 errors
s510586041
p00499
C
#include <stdio.h> int main(void) { int L, A, B, C, D; int i; int count1; scanf("%d", %L); scanf("%d", %A); scanf("%d", %B); scanf("%d", %C); scanf("%d", %D); for (i = 0; A < C && B < D; i++){ A -= C; B -= D; count++; } printf("%d\n", L - count); // your code goes here return 0; }
main.c: In function 'main': main.c:8:21: error: expected expression before '%' token 8 | scanf("%d", %L); scanf("%d", %A); scanf("%d", %B); scanf("%d", %C); scanf("%d", %D); | ^ main.c:8:38: error: expected expression before '%' token 8 | scanf("%d", %L); scanf("%d", %A); scanf("%d", %B); scanf("%d", %C); scanf("%d", %D); | ^ main.c:8:55: error: expected expression before '%' token 8 | scanf("%d", %L); scanf("%d", %A); scanf("%d", %B); scanf("%d", %C); scanf("%d", %D); | ^ main.c:8:72: error: expected expression before '%' token 8 | scanf("%d", %L); scanf("%d", %A); scanf("%d", %B); scanf("%d", %C); scanf("%d", %D); | ^ main.c:8:89: error: expected expression before '%' token 8 | scanf("%d", %L); scanf("%d", %A); scanf("%d", %B); scanf("%d", %C); scanf("%d", %D); | ^ main.c:12:17: error: 'count' undeclared (first use in this function); did you mean 'count1'? 12 | count++; | ^~~~~ | count1 main.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
s117607077
p00499
C
#include <stdio.h> int main(void) { int L, A, B, C, D; int i; int count1; scanf("%d", L); scanf("%d", A); scanf("%d", B); scanf("%d", C); scanf("%d", D); for (i = 0; A < C && B < D; i++){ A -= C; B -= D; count++; } printf("%d\n", L - count); // your code goes here return 0; }
main.c: In function 'main': main.c:12:17: error: 'count' undeclared (first use in this function); did you mean 'count1'? 12 | count++; | ^~~~~ | count1 main.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
s785996577
p00499
C
#include <stdio.h> int main(void) { int L, A, B, C, D; int i; int count1; scanf("%d", &L); scanf("%d", &A); scanf("%d", &B); scanf("%d", &C); scanf("%d", &D); for (i = 0; A < C && B < D; i++){ A -= C; B -= D; count++; } printf("%d\n", L - count); // your code goes here return 0; }
main.c: In function 'main': main.c:12:17: error: 'count' undeclared (first use in this function); did you mean 'count1'? 12 | count++; | ^~~~~ | count1 main.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
s696292183
p00499
C
#include <stdio.h> int main(void) { int L, A, B, C, D; int i; scanf("%d", &L); scanf("%d", &A); scanf("%d", &B); scanf("%d", &C); scanf("%d", &D); for (i = 0; A > C && B > D; i++){ A -= C; B -= D; } if (A == C || B == D){ } else { count++; } printf("%d\n", L - i); // your code goes here return 0; }
main.c: In function 'main': main.c:16:17: error: 'count' undeclared (first use in this function) 16 | count++; | ^~~~~ main.c:16:17: note: each undeclared identifier is reported only once for each function it appears in
s599855591
p00499
C
#include <stdio.h> float main(void) { float l,a,b,c,d,e,f,v,w,x,y,z; l,a,b,c,d,e,f,v,w,x,y,z=0; scanf("%f",&l); scanf("%f",&a); scanf("%f",&b); scanf("%f",&c); scanf("%f",&d); if(a%c=0){v=l-a/c}; if(b%d=0){w=l-b/d}; if(a%c!=0){x=l-1-a/c}; if(b%d!=0){y=l-1-b/d}; if(v<w){w=z}; if(w<v){v=z}; if(x<y){y=z}; if(y<x){x=z}; printf("%f\n",&z); return 0; }
main.c: In function 'main': main.c:15:13: error: invalid operands to binary % (have 'float' and 'float') 15 | if(a%c=0){v=l-a/c}; | ^ main.c:15:26: error: expected ';' before '}' token 15 | if(a%c=0){v=l-a/c}; | ^ | ; main.c:16:13: error: invalid operands to binary % (have 'float' and 'float') 16 | if(b%d=0){w=l-b/d}; | ^ main.c:16:26: error: expected ';' before '}' token 16 | if(b%d=0){w=l-b/d}; | ^ | ; main.c:17:13: error: invalid operands to binary % (have 'float' and 'float') 17 | if(a%c!=0){x=l-1-a/c}; | ^ main.c:17:29: error: expected ';' before '}' token 17 | if(a%c!=0){x=l-1-a/c}; | ^ | ; main.c:18:13: error: invalid operands to binary % (have 'float' and 'float') 18 | if(b%d!=0){y=l-1-b/d}; | ^ main.c:18:29: error: expected ';' before '}' token 18 | if(b%d!=0){y=l-1-b/d}; | ^ | ; main.c:20:16: error: expected ';' before '}' token 20 | if(v<w){w=z}; | ^ | ; main.c:21:16: error: expected ';' before '}' token 21 | if(w<v){v=z}; | ^ | ; main.c:22:16: error: expected ';' before '}' token 22 | if(x<y){y=z}; | ^ | ; main.c:23:16: error: expected ';' before '}' token 23 | if(y<x){x=z}; | ^ | ;
s304332137
p00499
C
#include <stdio.h> float main(void) { float l,a,b,c,d,e,f,v,w,x,y,z; l,a,b,c,d,e,f,v,w,x,y,z=0; scanf("%f",&l); scanf("%f",&a); scanf("%f",&b); scanf("%f",&c); scanf("%f",&d); if(a%c=0){v=l-a/c}; if(b%d=0){w=l-b/d}; if(a%c!=0){x=l-1-a/c}; if(b%d!=0){y=l-1-b/d}; if(v<w){w=z}; if(w<v){v=z}; if(x<y){y=z}; if(y<x){x=z}; printf("%f\n",&z); return 0; }
main.c: In function 'main': main.c:14:13: error: invalid operands to binary % (have 'float' and 'float') 14 | if(a%c=0){v=l-a/c}; | ^ main.c:14:26: error: expected ';' before '}' token 14 | if(a%c=0){v=l-a/c}; | ^ | ; main.c:15:13: error: invalid operands to binary % (have 'float' and 'float') 15 | if(b%d=0){w=l-b/d}; | ^ main.c:15:26: error: expected ';' before '}' token 15 | if(b%d=0){w=l-b/d}; | ^ | ; main.c:16:13: error: invalid operands to binary % (have 'float' and 'float') 16 | if(a%c!=0){x=l-1-a/c}; | ^ main.c:16:29: error: expected ';' before '}' token 16 | if(a%c!=0){x=l-1-a/c}; | ^ | ; main.c:17:13: error: invalid operands to binary % (have 'float' and 'float') 17 | if(b%d!=0){y=l-1-b/d}; | ^ main.c:17:29: error: expected ';' before '}' token 17 | if(b%d!=0){y=l-1-b/d}; | ^ | ; main.c:19:16: error: expected ';' before '}' token 19 | if(v<w){w=z}; | ^ | ; main.c:20:16: error: expected ';' before '}' token 20 | if(w<v){v=z}; | ^ | ; main.c:21:16: error: expected ';' before '}' token 21 | if(x<y){y=z}; | ^ | ; main.c:22:16: error: expected ';' before '}' token 22 | if(y<x){x=z}; | ^ | ;
s535758137
p00499
C
#include <stdio.h> int main(void) { int l,a,b,c,d,e,f,g,h,i,j,k,z; scanf("%d",&l); scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); scanf("%d",&d); e=a/c; f=a%c; if(f=0){g=e}; if(f>0){g=e-f+1}; h=b/d; i=b%d; if(i=0){k=j}; if(i>0){k=h-i+1}; if(g<k){z=l-k}; if(g>k){z=l-g}; if(g=k){z=l-g}; printf("%d",&z); return 0; }
main.c: In function 'main': main.c:15:20: error: expected ';' before '}' token 15 | if(f=0){g=e}; | ^ | ; main.c:16:24: error: expected ';' before '}' token 16 | if(f>0){g=e-f+1}; | ^ | ; main.c:20:20: error: expected ';' before '}' token 20 | if(i=0){k=j}; | ^ | ; main.c:21:24: error: expected ';' before '}' token 21 | if(i>0){k=h-i+1}; | ^ | ; main.c:23:22: error: expected ';' before '}' token 23 | if(g<k){z=l-k}; | ^ | ; main.c:24:22: error: expected ';' before '}' token 24 | if(g>k){z=l-g}; | ^ | ; main.c:25:22: error: expected ';' before '}' token 25 | if(g=k){z=l-g}; | ^ | ;
s078426010
p00499
C
#include <stdio.h> int main(void) { int l,a,b,c,d,e,f,g,h,i,j,k,z; scanf("%d",&l); scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); scanf("%d",&d); e=a/c; f=a%c; if(f=0){g=e} if(f>0){g=e-f+1} h=b/d; i=b%d; if(i=0){k=j} if(i>0){k=h-i+1} if(g<k){z=l-k} if(g>k){z=l-g} if(g=k){z=l-g} printf("%d",&z); return 0; }
main.c: In function 'main': main.c:15:20: error: expected ';' before '}' token 15 | if(f=0){g=e} | ^ | ; main.c:16:24: error: expected ';' before '}' token 16 | if(f>0){g=e-f+1} | ^ | ; main.c:20:20: error: expected ';' before '}' token 20 | if(i=0){k=j} | ^ | ; main.c:21:24: error: expected ';' before '}' token 21 | if(i>0){k=h-i+1} | ^ | ; main.c:23:22: error: expected ';' before '}' token 23 | if(g<k){z=l-k} | ^ | ; main.c:24:22: error: expected ';' before '}' token 24 | if(g>k){z=l-g} | ^ | ; main.c:25:22: error: expected ';' before '}' token 25 | if(g=k){z=l-g} | ^ | ;
s710637542
p00499
C
#include <stdio.h> int main(void) { int l,a,b,c,d,e,f,g,h,i,j,k,z; scanf("%d",&l); scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); scanf("%d",&d); e=a/c; f=a%c; if(f=0){g=e} if(f>0){g=e-f+1} h=b/d; i=b%d; if(i=0){k=j} if(i>0){k=h-i+1} if(g<k){z=l-k} if(g>k){z=l-g} if(g=k){z=l-g} printf("%d",&z); return 0; }
main.c: In function 'main': main.c:15:20: error: expected ';' before '}' token 15 | if(f=0){g=e} | ^ | ; main.c:16:24: error: expected ';' before '}' token 16 | if(f>0){g=e-f+1} | ^ | ; main.c:20:20: error: expected ';' before '}' token 20 | if(i=0){k=j} | ^ | ; main.c:21:24: error: expected ';' before '}' token 21 | if(i>0){k=h-i+1} | ^ | ; main.c:23:22: error: expected ';' before '}' token 23 | if(g<k){z=l-k} | ^ | ; main.c:24:22: error: expected ';' before '}' token 24 | if(g>k){z=l-g} | ^ | ; main.c:25:22: error: expected ';' before '}' token 25 | if(g=k){z=l-g} | ^ | ;
s987358903
p00499
C
#include <stdio.h> int main(void) { int l,a,b,c,d,e,f,g,h,i,j,k,z; scanf("%d",&l); scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); scanf("%d",&d); e=a/c; f=a%c if(f=0){g=e;} if(f>0){g=e-f+1;} h=b/d; i=b%d; if(i=0){k=j;} if(i>0){k=h-i+1;} if(g<k){z=l-k;} if(g>k){z=l-g;} if(g=k){z=l-g;} printf("%d\n",&z); return 0; }
main.c: In function 'main': main.c:14:14: error: expected ';' before 'if' 14 | f=a%c | ^ | ; 15 | if(f=0){g=e;} | ~~
s291215738
p00499
C
#include <stdio.h> int main(void) { int l, a, b, c, d, japanese, math, homework,play; scanf("%d %d %d %d %d",&l,&a,&b,&c,&d); if(a % c = 0) japanese = a / c; else japanese = a / c + 1; if(b % d = 0) math = b / d; else math = b / d + 1; if(japanese <= math) homework = math; else homework =japanese; play = l - homework; printf("%d\n",play); return 0; }
main.c: In function 'main': main.c:5:18: error: lvalue required as left operand of assignment 5 | if(a % c = 0) | ^ main.c:9:18: error: lvalue required as left operand of assignment 9 | if(b % d = 0) | ^
s037887365
p00499
C
#include <stdio.h> int main(void) { int l, a, b, c, d, japanese, math, homework,play; scanf("%d %d %d %d %d",&l,&a,&b,&c,&d); if(a % c = 0) japanese = a / c; else japanese = a / c + 1; if(b % d = 0) math = b / d; else math = b / d + 1; if(japanese <= math) homework = math; else homework =japanese; play = l - homework; printf("%d\n",play); return 0; }
main.c: In function 'main': main.c:5:18: error: lvalue required as left operand of assignment 5 | if(a % c = 0) | ^ main.c:9:18: error: lvalue required as left operand of assignment 9 | if(b % d = 0) | ^
s672244782
p00499
C
#include <stdio.h> int main(void) { int l, a, b, c, d, japanese, math, homework,play; scanf("%d %d %d %d %d",&l,&a,&b,&c,&d); if(a % c = 0) japanese = a / c; else japanese = a / c + 1; if(b % d = 0) math = b / d; else math = b / d + 1; if(japanese <= math) homework = math; else homework =japanese; play = l - homework; printf("%d\n",play); return 0; }
main.c: In function 'main': main.c:5:18: error: lvalue required as left operand of assignment 5 | if(a % c = 0) | ^ main.c:10:18: error: lvalue required as left operand of assignment 10 | if(b % d = 0) | ^
s805988523
p00499
C
#include <stdio.h> int main(void) { int l, a, b, c, d, japanese, math, homework,play; scanf("%d %d %d %d %d",&l,&a,&b,&c,&d); if(a % c = 0) japanese = a / c; else japanese = a / c + 1; if(b % d = 0) math = b / d; else math = b / d + 1; if(japanese <= math) homework = math; else homework =japanese; play = l - homework; printf("%d\n",play); return 0; }
main.c: In function 'main': main.c:5:18: error: lvalue required as left operand of assignment 5 | if(a % c = 0) | ^ main.c:10:18: error: lvalue required as left operand of assignment 10 | if(b % d = 0) | ^
s274971274
p00499
C
#include <stdio.h> int main(void) { int l, a, b, c, d, japanese, math, homework, play; scanf("%d %d %d %d %d",&l,&a,&b,&c,&d); if(a % c = 0) japanese = a / c; else japanese = a / c + 1; if(b % d = 0) math = b / d; else math = b / d + 1; if(japanese <= math) homework = math; else homework =japanese; play = l - homework; printf("%d\n",play); return 0; }
main.c: In function 'main': main.c:5:18: error: lvalue required as left operand of assignment 5 | if(a % c = 0) | ^ main.c:10:18: error: lvalue required as left operand of assignment 10 | if(b % d = 0) | ^
s959620967
p00499
C
#include <stdio.h> int main() { int l,a,b,c,d,result,aa,bb; scanf("%d %d %d %d %d", &l, &a, &b, &c, %d); aa = a / c; if( a % c != 0 ) aa++; bb = b / d; if( b % d != 0 ) bb++; if( aa > bb ) aa = bb; printf("%d\n", l - aa); return 0; }
main.c: In function 'main': main.c:5:49: error: expected expression before '%' token 5 | scanf("%d %d %d %d %d", &l, &a, &b, &c, %d); | ^
s452445894
p00499
C
#include <stdio.h> int main() { int l,a,b,c,d,aa,bb,result = 1; scanf("%d %d %d %d %d", &l, &a, &b, &c, %d); aa = a / c; if( a % c != 0 ) aa++; bb = b / d; if( b % d != 0 ) bb++; if( aa > bb ) aa = bb; if( l - aa > 1 ) result = l - aa; printf("%d\n", result); return 0; }
main.c: In function 'main': main.c:5:49: error: expected expression before '%' token 5 | scanf("%d %d %d %d %d", &l, &a, &b, &c, %d); | ^
s058173358
p00499
C
#include<stdio.h> #include<math.h> int main() { int a, b, c, d, l, n, x, z; scanf("%d\n%d\n%d\n%d\n%d", &l, &a, &b, &c, &d); n = ceil(a / c); x = ceil(b / d); if(n >= x); z = l - n; }else{ z = l - x; } printf("%d\n", z); return 0; }
main.c:10:4: error: expected identifier or '(' before 'else' 10 | }else{ | ^~~~ main.c:13:10: error: expected declaration specifiers or '...' before string constant 13 | printf("%d\n", z); | ^~~~~~ main.c:13:18: error: unknown type name 'z' 13 | printf("%d\n", z); | ^ main.c:14:3: error: expected identifier or '(' before 'return' 14 | return 0; | ^~~~~~ main.c:15:1: error: expected identifier or '(' before '}' token 15 | } | ^
s071622421
p00499
C
#include<stdio.h> #include<math.h> int main() { int a, b, c, d, l, n, x, z; scanf("%d %d %d %d %d", &l, &a, &b, &c, &d); n = double ceil(a / c); x = double ceil(b / d); if(n >= x) { z = l - n; }else{ z = l - x; } printf("%d\n", z); return 0; }
main.c: In function 'main': main.c:6:7: error: expected expression before 'double' 6 | n = double ceil(a / c); | ^~~~~~ main.c:7:7: error: expected expression before 'double' 7 | x = double ceil(b / d); | ^~~~~~
s873830666
p00499
C
#include <stdio.h> int main() { int A,A,B,C,D,x,y; scanf("%d",&L); scanf("%d",&A); scanf("%d",&B); scanf("%d",&C); scanf("%d",&D); x = L - A/C; y = L - B/D; if(x>y) { printf("%d\n",x); }else { printf("%d\n",y); } return 0; }
main.c: In function 'main': main.c:3:7: error: redeclaration of 'A' with no linkage 3 | int A,A,B,C,D,x,y; | ^ main.c:3:5: note: previous declaration of 'A' with type 'int' 3 | int A,A,B,C,D,x,y; | ^ main.c:4:17: error: 'L' undeclared (first use in this function) 4 | scanf("%d",&L); | ^ main.c:4:17: note: each undeclared identifier is reported only once for each function it appears in
s853678289
p00499
C
#include <stdio.h> int main() { int L,A,B,C,D; scanf("%d",&L); scanf("%d",&A); scanf("%d",&B); scanf("%d",&C); scanf("%d",&D); prinf("%d\n",L-A/C); return 0; }
main.c: In function 'main': main.c:9:5: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration] 9 | prinf("%d\n",L-A/C); | ^~~~~ | printf
s475690168
p00499
C
#include<stdio.h> int main() { int a, b, c, d, japan=0, math=0, i, off; scanf("%d", &l); scanf("%d", &a); scanf("%d", &b); scanf("%d", &c); scanf("%d", &d); for(i=0; i<b; i+D){ japan=math+1; } if(japan<=math){ off=L-math; }else{ off=l-japan; } printf("%d\n",off); return 0; }
main.c: In function 'main': main.c:4:19: error: 'l' undeclared (first use in this function) 4 | scanf("%d", &l); | ^ main.c:4:19: note: each undeclared identifier is reported only once for each function it appears in main.c:9:22: error: 'D' undeclared (first use in this function) 9 | for(i=0; i<b; i+D){ | ^ main.c:13:15: error: 'L' undeclared (first use in this function) 13 | off=L-math; | ^
s514581401
p00499
C
#include<stdio.h> int main(){ int l,a,b,c,d,jap,mat; scanf("%d\n%d\n%d\n%d\n%d",%l,&a,&b,&c,&d); jap = a/c; if(a%c!=0)jap++; mat = b/d; if(b%d!=0)mat++; if(jap>=mat)l=l-jap;else l=l-mat; printf("%d\n",l); return 0; }
main.c: In function 'main': main.c:4:28: error: expected expression before '%' token 4 | scanf("%d\n%d\n%d\n%d\n%d",%l,&a,&b,&c,&d); | ^
s282741178
p00499
C
#include<stdio.h> int main(){ int l,a,b,c,d,jap,mat; scanf("%d\n%d\n%d\n%d\n%d",%l,&a,&b,&c,&d); jap = a/c; if((a%c)!=0)jap++; mat = b/d; if((b%d)!=0)mat++; if(jap>=mat)l=l-jap;else l=l-mat; printf("%d\n",l); return 0; }
main.c: In function 'main': main.c:4:28: error: expected expression before '%' token 4 | scanf("%d\n%d\n%d\n%d\n%d",%l,&a,&b,&c,&d); | ^
s176652798
p00499
C
#include<stdio.h> int main(){ int l,a,b,c,d,jap,mat,m,n; scanf("%d\n%d\n%d\n%d\n%d",%l,&a,&b,&c,&d); jap = a/c; m = a%c; if(m!=0)jap++; mat = b/d; n = b%d; if(n!=0)mat++; if(jap>=mat)l=l-jap;else l=l-mat; printf("%d\n",l); return 0; }
main.c: In function 'main': main.c:4:28: error: expected expression before '%' token 4 | scanf("%d\n%d\n%d\n%d\n%d",%l,&a,&b,&c,&d); | ^
s555977105
p00499
C
#include<stdio.h> int main(){ int l,a,b,c,d,i; scanf("%d%d%d%d%d",&l,&a,&b,&c,&d); while(l--,a-=c,b-=d,a>0||b>0);printf("%d\n",l);exit;}
main.c: In function 'main': main.c:8:52: error: 'exit' undeclared (first use in this function) 8 | while(l--,a-=c,b-=d,a>0||b>0);printf("%d\n",l);exit;} | ^~~~ main.c:2:1: note: 'exit' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>' 1 | #include<stdio.h> +++ |+#include <stdlib.h> 2 | main.c:8:52: note: each undeclared identifier is reported only once for each function it appears in 8 | while(l--,a-=c,b-=d,a>0||b>0);printf("%d\n",l);exit;} | ^~~~
s544127517
p00499
C
#include <iostream> using namespace std; int main(){ int a,b,c,d,l,sum=0,e,f; cin >> l >> a >> b >> c >> d ; while(1){ if(a<c){ f=1; } if(f==1){ break; } c+=c; sum++; } while(1){ if(b<d){ e=1; } if(e==1){ break; } d+=d; sum++; } printf("%d\n",l-sum); return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s336657807
p00499
C
#include<stdio.h> int main(void) { int A, B, C, D, L=0,a,b; scanf("%d", &L); scanf("%d %d", &A, &B); scanf("%d %d", &C, &D); A = A / C; a = A%C; if (a != 0) { A = A+1; } B = B / D; b = B%D; if (b != 0) { B = B; } if (A > B) { L = L - A; } else { L = L - B; } if (L <=0) { L = 1; } printf("%d\n", L); } retrun 0;
main.c:29:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant 29 | retrun 0; | ^
s088583218
p00499
C
#include<stdio.h> int main(void) { int A, B, C, D, L=0,a,b; scanf("%d", &L); scanf("%d %d", &A, &B); scanf("%d %d", &C, &D); A = A / C; a = A%C; if (a != 0) { A = A+1; } B = B / D; b = B%D; if (b != 0) { B = B; } if (A > B) { L = L - A; } else { L = L - B; } if (L <=0) { L = 1; } printf("%d\n", L); } retrun 0; ]
main.c:29:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant 29 | retrun 0; | ^ main.c:31:4: error: expected identifier or '(' before ']' token 31 | ] | ^
s713287789
p00499
C
#include<stdio.h> int main(void){ int l,a,b,c,d; scanf("%d",&l); scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); scanf("%d",&d); if((a-1)/c>(b-1)/d) printf("%d",l-(a-1)/c); else printf("%d",l-(b-1)/d) return 0; }
main.c: In function 'main': main.c:14:29: error: expected ';' before 'return' 14 | else printf("%d",l-(b-1)/d) | ^ | ; 15 | 16 | return 0; | ~~~~~~
s397032115
p00499
C
#include<stdio.h> int main(void) { int l, a, b, c, d,flag1=0,flag2=0; scanf("%d",&l),scanf("%d", &a),scanf("%d", &b),scanf("%d", &c),scanf"%d", &d); while (1) { if (a - c >= 0)a -= c; else flag1 = 1; if (b - d >= 0) b -= d; else flag2 = 1; if (flag1 && flag2) { if (a || b)l--; break; } l--; } printf("%d\n",l); return 0; }
main.c: In function 'main': main.c:5:77: error: expected ';' before string constant 5 | scanf("%d",&l),scanf("%d", &a),scanf("%d", &b),scanf("%d", &c),scanf"%d", &d); | ^~~~ | ; main.c:5:85: error: expected statement before ')' token 5 | scanf("%d",&l),scanf("%d", &a),scanf("%d", &b),scanf("%d", &c),scanf"%d", &d); | ^
s055797012
p00499
C
#include <stdio.h> #define max(a, b) {((a)>(b)) ? (a) : (b)} int main() { int a, b, c, d, l; scanf("%d %d %d %d %d", &l, &a, &b, &c, &d); printf("%d\n", l - max(a/c+1, b/d+1)); return 0; }
main.c: In function 'main': main.c:3:19: error: expected expression before '{' token 3 | #define max(a, b) {((a)>(b)) ? (a) : (b)} | ^ main.c:10:22: note: in expansion of macro 'max' 10 | printf("%d\n", l - max(a/c+1, b/d+1)); | ^~~
s711004847
p00499
C
#include <stdio.h> #define max(a, b) ((a)>(b) ? a : b) #define foo(a, b) ((a)/(b) + ((a)%(b) ? 1 : 0)) int main() { int a, b, c, d, l; scanf("%d %d %d %d %d", &l, &a, &b, &c, &d); printf("%d\n", l - max(foo(a, c), foo(b, d)); return 0; }
main.c: In function 'main': main.c:11:47: error: expected ')' before ';' token 11 | printf("%d\n", l - max(foo(a, c), foo(b, d)); | ~ ^ main.c:12:12: error: expected ';' before '}' token 12 | return 0; | ^ | ; 13 | } | ~
s541257435
p00499
C
#include <stdio.h> int max(int a,int b) { int max; max = (a>b) ? a : b); return max; } int main(void) { int l,a,b,c,d,f; scanf("%d",&l); scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); scanf("%d",&d); f = max((a/c),(b/d)); if ((max == a/c && a%c!=0) || (max == b/d && b%d!=0) printf("%d",l-f-1); else printf("%d",l-f); } return 0; }
main.c: In function 'max': main.c:5:22: error: expected ';' before ')' token 5 | max = (a>b) ? a : b); | ^ | ; main.c:5:22: error: expected statement before ')' token main.c: In function 'main': main.c:18:10: warning: comparison between pointer and integer 18 | if ((max == a/c && a%c!=0) || (max == b/d && b%d!=0) | ^~ main.c:18:36: warning: comparison between pointer and integer 18 | if ((max == a/c && a%c!=0) || (max == b/d && b%d!=0) | ^~ main.c:18:53: error: expected ')' before 'printf' 18 | if ((max == a/c && a%c!=0) || (max == b/d && b%d!=0) | ~ ^ | ) 19 | printf("%d",l-f-1); | ~~~~~~ main.c:21:1: error: expected expression before '}' token 21 | } | ^ main.c: At top level: main.c:22:1: error: expected identifier or '(' before 'return' 22 | return 0; | ^~~~~~ main.c:23:1: error: expected identifier or '(' before '}' token 23 | } | ^
s057474764
p00499
C
#include <stdio.h> int max(int a,int b) { int max; max = (a>b) ? a : b; return max; } int main(void) { int l,a,b,c,d; int cnt1,cnt2; scanf("%d",&l); scanf("%d",&a); scanf("%d",&b); scanf("%d",&c); scanf("%d",&d); while(a>0){ a -= c; cnt1 ++; } while(b>0){ b -= d; cnt2 ++; } printf("%d\n",l-max(cnt1,cnt2); return 0; }
main.c: In function 'main': main.c:26:33: error: expected ')' before ';' token 26 | printf("%d\n",l-max(cnt1,cnt2); | ~ ^ | ) main.c:27:10: error: expected ';' before '}' token 27 | return 0; | ^ | ; 28 | } | ~
s148943873
p00499
C
#include <stdio.h> main(){ int hi,koku,suu,kokud,suud; int n=0,m=0; scanf("%d",&hi); scanf("%d",&koku); scanf("%d",&suu); scanf("%d",&kokud); scanf("%d",&suud); printf("\n"); while(koku>0){ koku-=kokud; n++; return 0; } while(suu>0){ suu-=suud; m++; return 0; } if(n>m){ hi-=n; printf("%d",hi) return 0; } else if(m>n){ hi-=m; printf("%d".hi) return 0; } return 0; }
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int] 3 | main(){ | ^~~~ main.c: In function 'main': main.c:30:16: error: expected ';' before 'return' 30 | printf("%d",hi) | ^ | ; 31 | return 0; | ~~~~~~ main.c:36:12: error: request for member 'hi' in something not a structure or union 36 | printf("%d".hi) | ^ main.c:36:16: error: expected ';' before 'return' 36 | printf("%d".hi) | ^ | ; 37 | return 0; | ~~~~~~
s703285594
p00499
C
#include <stdio.h> main(){ int hi,koku,suu,kokud,suud; int n=0,m=0; scanf("%d",&hi); scanf("%d",&koku); scanf("%d",&suu); scanf("%d",&kokud); scanf("%d",&suud); printf("\n"); while(koku>0){ koku-=kokud; n++; return 0; } while(suu>0){ suu-=suud; m++; return 0; } if(n>m){ hi-=n; printf("%d",hi); return 0; } else if(m>n){ hi-=m; printf("%d".hi); return 0; } return 0; }
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int] 3 | main(){ | ^~~~ main.c: In function 'main': main.c:35:12: error: request for member 'hi' in something not a structure or union 35 | printf("%d".hi); | ^