submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s132633701
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
const int MaxN = 10005;
int n, m;
const double eps = 1e-7;
int dcmp(double x) {
return x < -eps ? -1 : x > eps;
}
struct Point {
double x, y;
Point(){}
Point(double x, double y)
: x(x), y(y) {}
double operator * (const Point &b) {
return x * b.y - y * b.x;
}
Point operator - (const Point &b) {
return Point(x - b.x, y - b.y);
}
bool operator < (const Point &b) const {
if (dcmp(y - b.y) != 0) return dcmp(y - b.y) < 0;
return dcmp(x - b.x) < 0;
}
void init() {
scanf("%lf%lf", &x, &y);
}
Point operator + (const Point &b) {
return Point(x + b.x, y + b.y);
}
Point operator / (const double &b) {
return Point(x / b, y / b);
}
Point operator * (const double &b) {
return Point(x * b, y * b);
}
} p[MaxN], q[MaxN], a[MaxN];
Point get(double d, Point a, Point b) {
return (b - a) * (d / (b.y - a.y)) + a;
}
double getarea(Point a, Point b, Point c) {
return fabs((a - b) * (a - c)) / 2;
}
bool check(double d, double nowarea, Point G, int l, int r) {
double dl = d - p[l].y;
Point t1 = get(dl, p[l], p[l+1]);
double dr = d - q[r].y;
Point t2 = get(dr, q[r], q[r+1]);
G = G + (q[r] + p[l] + t2) / 3 * getarea(q[r], p[l], t2);
G = G + (p[l] + t1 + t2) / 3 * getarea(p[l], t1, t2);
nowarea += getarea(q[r], p[l], t2) + getarea(p[l], t1, t2);
G = G / nowarea;
if (dcmp(G.x - p[0].x) < 0 || dcmp(G.x - q[0].x) > 0) return 0;
return 1;
}
int main() {
//freopen("I.in","r",stdin);
int cases; scanf("%d", &cases);
while (cases--) {
scanf("%d%d", &m,&n);
int tot = n + m;
for (int i = 0; i < m; ++i) {
p[i].init();
}
for (int i = 0; i < n; ++i) {
q[i].init();
}
int l = 0, r = 0;
double ans = 0;
double nowarea = 0;
Point G = Point(0, 0);
for (int i = 2; i < tot; ++i) {
double L, R;
if (r == n - 1 || (l < m && p[l+1].y < q[r+1].y)) {
++l;
L = p[l].y;
Point tG = (p[l] + p[l-1] + q[r]) / 3;
double area = getarea(p[l], p[l-1], q[r]);
G = G + tG * area;
nowarea += area;
} else {
++r;
L = q[r].y;
Point tG = (q[r] + q[r-1] + p[l]) / 3;
double area = getarea(q[r], q[r-1], p[l]);
G = G + tG * area;
nowarea += area;
}
if (!check(L, nowarea, G, l, r)) continue;
if (l == m - 1 && r == m - 1) {
ans = L;
continue;
}
R = min(p[l+1].y, p[r+1].y);
for (int j = 0; j < 60; ++j) {
double mid = (L + R) * 0.5;
if (check(mid, nowarea, G, l, r)) L = mid; else R = mid;
}
ans = max(ans, L);
}
printf("%.3f\n", ans);
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s739056189
|
p00000
|
C
|
#include<stdio.h>
int main(){
int i,j;
for(i=1;j<10;j++){
printf("%dx%d=%d\n",i,j);
}
}
return 0;
}
|
main.c:9:5: error: expected identifier or '(' before 'return'
9 | return 0;
| ^~~~~~
main.c:10:1: error: expected identifier or '(' before '}' token
10 | }
| ^
|
s682516970
|
p00000
|
C
|
#include<stdio.h>
int main(){
int i,j;
for(i=1;j<10;j++){
printf("%dx%d=%d\n",i,j);
}
}
return 0;
}
|
main.c:9:5: error: expected identifier or '(' before 'return'
9 | return 0;
| ^~~~~~
main.c:10:1: error: expected identifier or '(' before '}' token
10 | }
| ^
|
s018912694
|
p00000
|
C
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#define fr(i,t,n) for(int i = t ; i <= n ; i++)
#define ft(i,t,n) for(int i = t ; i >= n ; i--)
#define sc scanf
#define pr printf
#define re return
#define ct continue
#define br break
#define me(a,i) memset(a,i,sizeof(a))
#define LL long long
using namespace std;
const int maxn = 220;
const int maxm = 1100;
struct node
{
int online[maxm],sever,down,start;
}tes[maxn];
int n , T , num,v,id[maxm],times[maxm];
bool maps[maxn][maxm];
int trans[maxn][maxn],m;
void readin()
{
sc("%d%d",&n,&T);
sc("%d%d",&num,&v);//num 蠑?ァ区怏蜃?クェ莠コ?計邉サ扈滓枚莉カ螟ァ蟆? int x;
fr(i,1,n)tes[i].sever = 0;
fr(i,1,num)
{
sc("%d",&x);
tes[x].sever=1;
}
fr(i,1,n)
fr(j,1,n)sc("%d",&trans[i][j]);
fr(i,1,n)
{
sc("%d",&x);
fr(j,0,T)tes[i].online[j] = 0;
fr(j,1,x)
{
int a, b;
sc("%d%d",&a,&b);
fr(k,a,b)tes[i].online[k]=1;
}
}
// fr(i,1,n)
// fr(j,0,T)pr("%d %d %d\n",i,j,tes[i].online[j]);
me(maps,0);
sc("%d",&m);
fr(i,1,m)
{
int a , b;
sc("%d%d",&a,&b);
maps[b][a] = 1;
}
}
bool falg[maxn];
void solve()
{
fr(i,1,n)tes[i].down = 0;
fr(i,1,n)tes[i].start = 0;
fr(i,0,T)
{
// pr("%d\n",i);
fr(j,1,n)
if(tes[j].start && tes[j].online[i] && !tes[j].sever)
{
fr(k,1,n)
if(tes[k].online[i] && tes[k].sever)
tes[j].down += trans[k][j];
if(tes[j].down >= v)tes[j].sever = 1;
}
//fr(j,1,n)if(!tes[j].online[i])tes[j].start = 0;
fr(j,1,n)
if(maps[j][i])tes[j].start = 1;
pr("now = %d ",i);
fr(j,1,n)pr("%d ",tes[j].down);
puts("");
//fr(j,1,n)
// pr("T = %d i = %d start ? %d online? %d\n",i,j,tes[j].start,tes[j].online[i]);
}
fr(i,1,n)
if(tes[i].sever)pr("100%%\n");
else
{
double res = 1.0*tes[i].down / v;
double pp = res * 1000/10;
pr("%.0lf%%\n",pp);
}
}
int main()
{
int test;
freopen("C.in","r",stdin);
freopen("C.out","w",stdout);
sc("%d",&test);
while(test--)
{
readin();
//while(1);
solve();
}
re 0;
}
|
main.c:5:9: fatal error: iostream: No such file or directory
5 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s147301978
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int map[10][10];
int que[100],num;
int main()
{
int i,j,n,sum,maxx,step,astep,asum;
while(scanf("%d",&n))
{
if(n==0) break;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&map[i][j]);
}
}
asum=0; astep=0;
if(3<=n){
num=0; sum=0; maxx=-1;
for(j=0;j<=i;j++)
{
que[num++]=map[0][j];
}
for(j=1;j<=i;j++)
{
que[num++]=map[j][i];
}
for(j=i-1;j>=0;j--)
{
que[num++]=map[i][j];
}
for(j=i-1;j>=0;j--)
{
que[num++]=map[j][0];
}
for(j=0;j<3*4;j++)
printf("%d ",que[j]);
puts("");
for(j=0;j<i;j++)
{
sum=que[j]+que[j+i]+que[j+i*2]+que[j+i*3];
if(maxx<sum){
maxx=sum;
step=j;
}
}
asum+=maxx;
astep+=step;
}
else if(5<=n)
{
}
asum+=map[n/2][n/2];
printf("%d %d\n",asum,astep);
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s581518632
|
p00000
|
C
|
//#include<iostream>
#include<stdio.>
//using namespace std;
int main()
{
int i,j;
for(i=1;i<10;i++)
{
for(j=1;j<10;j++)
printf("%dx%d=%d\n",i,j,i*j);
}
return 0;
}
|
main.c:2:9: fatal error: stdio.: No such file or directory
2 | #include<stdio.>
| ^~~~~~~~
compilation terminated.
|
s650269048
|
p00000
|
C
|
#include<stdio.h>
int main(){
int i, j;
for(i =; i < 10; j++){
printf("%2dl",i*j);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:12: error: expected expression before ';' token
5 | for(i =; i < 10; j++){
| ^
|
s627257418
|
p00000
|
C
|
#include<stdio.h>
int main(void)
{
int i, j;
for(j =1; j< 10 j++){
printf("%2d",i*j);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:20: error: expected ';' before 'j'
5 | for(j =1; j< 10 j++){
| ^~
| ;
|
s210235106
|
p00000
|
C
|
#include<stdio.h>
int main(void)
{
int i, j;
for(j =1; j< 10 j++){
printf("%2dl",i*j);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:20: error: expected ';' before 'j'
5 | for(j =1; j< 10 j++){
| ^~
| ;
|
s549958083
|
p00000
|
C
|
#include<stdio.h>
int main(void)
{
int i, j;
for(j =1; j< 10 j++){
printf("%2dl",i*j);
}
printf("\n");
}
return 0;
}
|
main.c: In function 'main':
main.c:5:20: error: expected ';' before 'j'
5 | for(j =1; j< 10 j++){
| ^~
| ;
main.c: At top level:
main.c:10:5: error: expected identifier or '(' before 'return'
10 | return 0;
| ^~~~~~
main.c:11:1: error: expected identifier or '(' before '}' token
11 | }
| ^
|
s151858607
|
p00000
|
C
|
#include "StdAfx.h"
#include<iostream>
using namespace std;
int main()
{
for(int m=1;m<=9;m++)
{
cout<<m<<"x"<<m<<"="<<m*m<<endl;
}
system("pause");
return 0;
}
|
main.c:1:10: fatal error: StdAfx.h: No such file or directory
1 | #include "StdAfx.h"
| ^~~~~~~~~~
compilation terminated.
|
s567256315
|
p00000
|
C
|
include<stdio.h>
int main(){
int i,j;
for(i=1;i<=9;i++)
for(i=1;i<=9;i++)
printf("%dd=%d\n",i,j,i*j);
return 0;}
|
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s031856970
|
p00000
|
C
|
#include"stdio.h"
int main(){
for(i=1;i<=9;i++)
for(j=1;j<=9;j++)
printf("%dd=%d\n",i,j,i*j);
return 0;}
|
main.c: In function 'main':
main.c:3:5: error: 'i' undeclared (first use in this function)
3 | for(i=1;i<=9;i++)
| ^
main.c:3:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:5: error: 'j' undeclared (first use in this function)
4 | for(j=1;j<=9;j++)
| ^
|
s965485354
|
p00000
|
C
|
include"stdio.h"
int main(){
int i,j;
for(i=1;i<=9;i++)
for(j=1;j<=9;j++)
printf("%dd=%d\n",i,j,i*j);
return 0;
}
|
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before string constant
1 | include"stdio.h"
| ^~~~~~~~~
|
s074794200
|
p00000
|
C
|
include"stdio.h"
int main(){
for(i=1;i<=9;i++)
for(j=1;j<=9;j++)
printf("%dd=%d\n"i,j,i*j);
return 0;
}
|
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before string constant
1 | include"stdio.h"
| ^~~~~~~~~
|
s822029143
|
p00000
|
C
|
i=9,t;main(){i<90&&main(printf("%dx%d=%d\n",i++/9,t,i/9*t))t=i%9+1;}
|
main.c:1:1: warning: data definition has no type or storage class
1 | i=9,t;main(){i<90&&main(printf("%dx%d=%d\n",i++/9,t,i/9*t))t=i%9+1;}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:1:5: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
1 | i=9,t;main(){i<90&&main(printf("%dx%d=%d\n",i++/9,t,i/9*t))t=i%9+1;}
| ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
1 | i=9,t;main(){i<90&&main(printf("%dx%d=%d\n",i++/9,t,i/9*t))t=i%9+1;}
| ^~~~
main.c: In function 'main':
main.c:1:25: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | i=9,t;main(){i<90&&main(printf("%dx%d=%d\n",i++/9,t,i/9*t))t=i%9+1;}
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | i=9,t;main(){i<90&&main(printf("%dx%d=%d\n",i++/9,t,i/9*t))t=i%9+1;}
main.c:1:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
1 | i=9,t;main(){i<90&&main(printf("%dx%d=%d\n",i++/9,t,i/9*t))t=i%9+1;}
| ^~~~~~
main.c:1:25: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:60: error: expected ';' before 't'
1 | i=9,t;main(){i<90&&main(printf("%dx%d=%d\n",i++/9,t,i/9*t))t=i%9+1;}
| ^
| ;
|
s503738297
|
p00000
|
C
|
#include<stdio.h>
#include<conio.h>
void main()
{int i,j;
{for(i=1;i<=9;i++)
{for(j=1;j<=9;j++)
{printf("%d * %d =%d ",i,j,i*j);
printf("\n");
}
}
getch();
}}
|
main.c:2:9: fatal error: conio.h: No such file or directory
2 | #include<conio.h>
| ^~~~~~~~~
compilation terminated.
|
s268296861
|
p00000
|
C
|
#include<string.h>
#include<stdio.h>
char str[1200];
bool check(char *str) {
int len = strlen(str);
if (len < 4)
return true;
if (strcmp(str + len - 4, "desu") == 0)
return false;
return true;
}
int main() {
int t, cas = 1;
scanf(" %d", &t);
while (t--) {
scanf(" %s", str);
int len = strlen(str);
if (check(str)) {
printf("Case #%d: %s%s\n", cas++, str, "nanodesu");
} else {
str[len - 3] = 0;
printf("Case #%d: %s%s\n", cas++, str, "nanodesu");
}
}
return 0;
}
|
main.c:4:1: error: unknown type name 'bool'
4 | bool check(char *str) {
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<stdio.h>
+++ |+#include <stdbool.h>
3 | char str[1200];
main.c: In function 'check':
main.c:7:24: error: 'true' undeclared (first use in this function)
7 | return true;
| ^~~~
main.c:7:24: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:7:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:24: error: 'false' undeclared (first use in this function)
9 | return false;
| ^~~~~
main.c:9:24: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s832568237
|
p00000
|
C
|
1,1:
0
2,1:
01
3,2:
001
4,2:
0011
5,3:
00010
6,3:
000101
7,3:
0001011
8,3:
00010111
9,4:
000010110
10,4:
0000101100
11,4:
00001011000
12,4:
000010110000
13,4:
0000101100101
14,4:
00001011001011
15,4:
000010110010110
16,4:
0000101100101100
17,4:
00001011001011000
18,4:
000010110010110000
19,4:
0000101100101100101
20,4:
00001011001011001011
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 1,1:
| ^
|
s102250138
|
p00000
|
C
|
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int pow[15],num[15];
int f[11][11][5100];
int g[11][11][5100];
int pre(int l,int k,int sum)
{
if(l==-1)return k==0;
if(f[l][k][sum]!=-1)return f[l][k][sum];
int u=9,res=0;
for(int i=0;i<=u;i++)
if(sum-pow[l]*i>=0)
res+=pre(l-1,i,sum-pow[l]*i);
return f[l][k][sum]=res;
}
int dfs(int l,int k,int sum,int e)
{
if(l==-1)return 1;
if(!e) return g[l][k][sum];
int u=num[l],res=0;
for(int i=0;i<=u;i++)
if(sum-pow[l]*i>=0)
res+=dfs(l-1,i,sum-pow[l]*i,e && i==u);
return res;
}
int solve(int x,int lim)
{
int l=0;
while(x!=0)
{
num[l++]=x%10;
x=x/10;
}
return dfs(l-1,0,lim,1);
}
int cal(int x)
{
int p=1;
int ans=0;
while(x!=0)
{
ans=ans+(x%10)*p;
p*=2;
x/=10;
}
return ans;
}
int main()
{
int sec;
for(int i=0;i<=10;i++)
pow[i]=1<<i;
scanf("%d",&sec);
memset(f,-1,sizeof(f));
memset(g,0,sizeof(g));
//pre
for(int l=10;l>=0;l--)
for(int k=10;k>=0;k--)
for(int sum=5000;sum>=0;sum--)
if(f[l][k][sum]==-1)
pre(l,k,sum);
for(int l=0;l<=10;l++)
for(int k=0;k<=10;k++)
for(int sum=0;sum<=5000;sum++)
{
if(sum==0)g[l][k][sum]=f[l][k][sum];
else
g[l][k][sum]=g[l][k][sum-1]+f[l][k][sum];
}
for(int z=1;z<=sec;z++)
{
int a,b;
scanf("%d%d",&a,&b);
int lim=cal(a);
int ans=solve(b,lim);
printf("Case #%d: %d\n",z,ans);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s454670379
|
p00000
|
C
|
/*
* Author: chlxyd
* Created Time: 2013-9-14 12:44:02
* File Name: 1007.cpp
*/
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
typedef long long lint;
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((int)(v).size())
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repf(i, a, b) for (int i = (a); i <= (b); ++i)
#define repd(i, a, b) for (int i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
const int maxMark = 2000 + 10;
struct node {
int num, res, ty;
node (int num = 0, int res = 0, int ty = 0) : num(num), res(res), ty(ty) {
}
};
int lim[20];
int aa[20], bb[20];
int lenA, lenB;
int a, b, top[4];
int ans;
int dp[4][maxMark][3];
int ten[20], dit[20], n, m;
int F(int w, int len) {
int res = 0;
repd (i, len - 1, 0) {
res = res * 2 + w / ten[i];
w %= ten[i];
}
return res;
}
void init() { //int64
lenA = 0;
lenB = 0;
int na = a, nb = b;
clr(aa);
clr(bb);
while (na != 0) {
aa[lenA++] = na % 10;
na /= 10;
}
if (lenA == 0)
aa[lenA++] = 0;
while (nb != 0) {
bb[lenB++] = nb % 10;
nb /= 10;
}
if (lenB == 0)
bb[lenB++] = 0;
ten[0] = 1;
repf (i, 1, 13)
ten[i] = ten[i - 1] * 10;
dit[0] = bb[0];
repf (i, 1, 13)
dit[i] = dit[i - 1] * 10 + bb[i];
}
int getF(int *aa, int r, int l) {
int res = 0;
repd (i, r, l)
res = res * 2 + aa[i];
return res;
}
int getD(int *aa, int r, int l) {
int res = 0;
repd (i, r, l)
res = res * 10 + aa[i];
return res;
}
int getRes(int len, int ty) {
if (len == -1) return 1;
if (ty == 0) {
return ten[len + 1];
}
else return dit[len];
}
int main(){
int T, ca = 1;
scanf("%d", &T);
while (T--) {
scanf("%d%d", &n, &m);
a = n, b = m;
init();
ans = 0;
int st = 0;
clr(dp[st]);
dp[st][0][1] = 1;
//printf("%d\n", lenA);
//repd (i, lenA, 0)
//printf("%d", aa[i]);
//printf("\n");
repd (i, max(lenB, lenA) - 1, 0) {
clr(dp[!st]);
int ha = getF(aa, i + 3, i);
int hb = getD(bb, i + 3, i);
repf (z, 0, 1) repf (k, 0, 999) {
int x = k;
int y = dp[st][x][z];
if (y == 0) continue;
int now = F(x, 3) * 2;
rep (j, 10) {
int nx = x * 10 + j;
if (z && nx > hb) break;
int nnow = now + j;
if (nnow < ha) {
//printf("%d\n", ans);
if (nx == hb && z)
ans += getRes(i - 1, 1);
else ans += getRes(i - 1, 0);
//printf("%d\n======\n", ans);
}
else if (nnow == ha) {
int nz = 0;
if (nx == hb && z)
nz = 1;
dp[!st][(x % 100) * 10 + j][nz] += y;
}
}
}
st = !st;
}
repf (k, 0, 999)
repf (ty, 0, 1)
ans += dp[st][k][ty];
printf("Case #%d: ", ca++);
printf("%d\n", ans);
}
return 0;
}
|
main.c:6:9: fatal error: iostream: No such file or directory
6 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s377715067
|
p00000
|
C
|
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char s[1010];
char lib[12][1010];
int len[12];
bool pa(int i,int j)
{
if(i<0)
return 0;
while(i<j)
{
if(s[i]!=s[j])
return 0;
i++;
j--;
}
return 1;
}
void solve(int n)
{
int i,j,cnt=0;
for(i=0;;i++)
{
if(!i)
{
cnt=1;
s[i]='a';
continue;
}
s[i]='a';
if(pa(i-n+1,i) || pa(i-n,i))
{
s[i]='b';
if( pa(i-n+1,i) || pa(i-n,i))
{
break;
}
}
}
s[i]='\0';
strcpy(lib[n],s);
len[n]=strlen(s);
}
int gao(int l) {
int p = (l-6)/8, q = (l-6)%8;
int s = p*3+2;
s+=(q>1)+(q>4);
return s;
}
int bin(int m) {
int l(11),r(m),mid;
while(l!=r) {
mid = (l+r)/2;
int s = mid+ (mid-1)/2+(mid-2)/4+gao(mid)+3;
if(s>=m) r = mid;
else l = mid+1;
}
return l;
}
int main()
{
int t,i,j,n,m;
for(i=1;i<=10;i++)
{
solve(i);
}
cin>>t;
int cas=0;
while(t--)
{
cas++;
scanf("%d%d",&n,&m);
printf("Case #%d: ",cas);
if(n==1)
{
for(i=0;i<m;i++)
printf("a");
printf("\n");
}
else if(n==2)
{
bool ok=0;
for(i=1;i<=10;i++)
if(len[i]>=m)
{
ok=1;
for(int j=0;j<m;++j)
putchar(lib[i][j]);
break;
}
if(!ok)
{
int l = bin(m);
int a = l, b = (l-1)/2,c = (l-2)/4;
int d = gao(l),sum(0);
for(int i=0;i<a && sum<m;++i,++sum)
putchar('a');
if(sum<m) putchar('b'),++sum;
for(int i=0;i<b && sum <m;++i,++sum)
putchar('a');
if(sum<m) putchar('b'),++sum;
for(int i=0;i<c && sum<m;++i,++sum)
putchar('a');
if(sum<m) putchar('b'),++sum;
for(int i=0;i<d && sum<m;++i,++sum)
putchar('a');
}
puts("");
}
else
{
int a=m/3,b=m%3;
for(i=0;i<a;i++)
printf("abc");
for(i=0;i<b;i++)
{
printf("%c",'a'+i);
}
printf("\n");
}
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s660695732
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int maxn=100010;
int num_cnt[40];
long long num[maxn];
int n, m;
long long sum;
int l[5*maxn], r[5*maxn], nn;
long long cnt;
long long CC (long long x)
{
if(x<=0) return 0;
return x*(x-1)/2+x;
}
void addcnt (int x)
{
sum|=x;
for(int i=0; i<=31; i++){
if(x&(1<<i)) num_cnt[i]++;
}
}
void subcnt (int x)
{
sum=0;
for(int i=0; i<=31; i++){
if(x&(1<<i)) num_cnt[i]--;
if(num_cnt[i]) sum|=(1<<i);
}
//printf("sum %d\n", sum);
}
void addint (int b, int f)
{
l[nn]=b;
r[nn]=f;
//printf("l %d r %d\n", b, f);
nn++;
}
int main()
{
//freopen("dout.txt", "r+", stdin);
int T;
scanf("%d", &T);
for(int kase=1; kase<=T; kase++){
scanf("%d %d", &n, &m);
memset(num_cnt, 0, sizeof(num_cnt));
for(int i=1; i<=n; i++){
scanf("%I64d", &num[i]);
//printf("%lld\n", num[i]);
}
int b, f;
b=-1;
for(int i=1; i<=n; i++){
if(num[i]<m){ b=i; f=b+1; break;}
}
if(b==-1){ printf("Case #%d: 0\n", kase); continue;}
addcnt(num[b]); nn=0;
while(f<=n){
//printf("f %d sum %d\n", f, sum);
if((sum|num[f])<m){
addcnt(num[f]);
f++;
}
else{
//cnt+=CC(f-b)+f-b;
addint(b, f-1);
if(num[f]<m){
addcnt(num[f]);
while(sum>=m){
subcnt(num[b]);
b++;
}
f++;
}
else{
memset(num_cnt, 0, sizeof(num_cnt));
b=f+1;
while(b<=n && num[b]>=m) b++;
if(b>n) break;
addcnt(num[b]);
f=b+1;
}
}
}
if(b<=n && b<f && f==n+1) addint(b, f-1);
cnt=CC(r[0]-l[0]+1);
//printf("cnt %lld\n", cnt);
for(int i=1; i<nn; i++){
if(r[i]<=r[i-1]){ r[i]=r[i-1]; continue;}
if(r[i-1]<l[i]) cnt+=CC(r[i]-l[i]+1);
else{
cnt+=CC(r[i]-l[i]+1);
cnt-=CC(r[i-1]-l[i]+1);
}
}
printf("Case #%d: %I64d\n", kase, cnt);
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s595092056
|
p00000
|
C
|
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<assert.h>
using namespace std;
const int N = 20;
int M;
char s1[100],s2[100];
int opt[10][N],a,b,num[20];
inline int dfs(int h,int g,bool bound)
{
// cout<<h<<" "<<g<<" "<<bound<<endl;
if(g<=1) return 0;
if(g>=19){
return num[h]+1;
// if(h==9) return 1;
// int t;
//// cout<<"h="<<h<<endl;
// sscanf(s2+h,"%d",&t);
// return t+1;
}
if(!bound&&opt[h][g]!=-1) return opt[h][g];
if(h==9&&g>=10) return 1;
int digit=(bound?(s2[h]-'0'):9);
int &ret=opt[h][g];
ret=0;
for(int i=0;i<=digit;++i)
{
int t=(g-10)*2;
t+=(s1[h]-'0'-i);
ret+=dfs(h+1,t+10,bound&&(i==digit));
}
return ret;
}
inline void read(int &x)
{
char c;
while(c=getchar(),c<'0'||c>'9') ;
x=c-'0';
while(c=getchar(),c>='0'&&c<='9') x=x*10+c-'0';
}
inline int maxx(int x,int y){
return x>y?x:y;
}
int main()
{
// freopen("1.in","r",stdin);
int T;
scanf("%d",&T);
for(int cas=1;cas<=T;++cas)
{
// scanf("%d%d",&a,&b);
read(a); read(b);
if(a>=(int)1e9) assert(0);
// sprintf(s1,"%d",a);
// sprintf(s2,"%d",b);
// M=maxx(strlen(s1),strlen(s2));
sprintf(s1,"%09d",a);
sprintf(s2,"%09d",b);
// int base=1;
// num[9]=0;
// for(int i=8;i>=0;--i,base*=10)
// num[i]=num[i+1]+(s2[i]-'0')*base;
memset(opt,-1,sizeof opt);
int ans=dfs(0,10,1);
printf("Case #%d: %d\n",cas,ans);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s775974568
|
p00000
|
C
|
/*
* Author: chlxyd
* Created Time: 2013-9-14 12:44:02
* File Name: 1007.cpp
*/
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
typedef long long lint;
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((int)(v).size())
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repf(i, a, b) for (int i = (a); i <= (b); ++i)
#define repd(i, a, b) for (int i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
const int maxMark = 1000 + 10;
const int maxlim = 5120 + 10;
//struct node {
//int num, res, ty;
//node (int num = 0, int res = 0, int ty = 0) : num(num), res(res), ty(ty) {
//}
//};
int n, m, a, b;
int f[20][maxlim], g[20][maxlim + 20];
int two(int x) {
return 1 << x;
}
int F(int w, int len) {
int res = 0;
repd (i, len - 1, 0) {
res = res * 2 + w / ten[i];
w %= ten[i];
}
return res;
}
void init() { //int64
lenA = 0;
lenB = 0;
int na = a, nb = b;
clr(aa);
clr(bb);
while (na != 0) {
aa[lenA++] = na % 10;
na /= 10;
}
if (lenA == 0)
aa[lenA++] = 0;
while (nb != 0) {
bb[lenB++] = nb % 10;
nb /= 10;
}
if (lenB == 0)
bb[lenB++] = 0;
ten[0] = 1;
repf (i, 1, 13)
ten[i] = ten[i - 1] * 10;
dit[0] = bb[0];
repf (i, 1, 13)
dit[i] = dit[i - 1] * 10 + bb[i];
}
void init2() {
clr(f);
clr(g);
rep (k, 10)
f[0][k] = 1;
rep (k, 10) {
g[0][k] = f[0][k];
if (k != 0)
g[0][k] += g[0][k - 1];
}
repf (i, 1, 10) {
repd (j, 5120 - k * two(i), 0) {
rep (k, 10) {
f[i][j + k * two(i)] += f[i - 1][j];
}
}
repd (j, maxlim, 0) {
f[i][j] += f[i - 1][j];
g[i][j] = f[i][j];
if (j != 0)
g[i][j] += g[i][j - 1];
}
}
}
void gao(int a, int b) {
int lenb = 0, lena;
int bb[20];
while (b != 0) {
bb[lenb] = b % 10;
b /= 10;
lenb++;
}
int ans = 0;
if (lenb == 1) {
rep (i, b)
if (b <= a)
ans++;
return ans;
}
int head = bb[lenb - 1];
rep (i, head - 1)
rep (j, len - 1) {
}
}
int main(){
int T, ca = 1;
scanf("%d", &T);
init2();
while (T--) {
scanf("%d%d", &n, &m);
a = n, b = m;
init();
gao(n, m);
}
return 0;
}
|
main.c:6:9: fatal error: iostream: No such file or directory
6 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s719620733
|
p00000
|
C
|
#pragma comment(linker,"/STACK:102400000,102400000")
#include<stdio.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<math.h>
#include<string.h>
using namespace std;
struct Edge {
int to, v;
Edge() {
}
Edge(int to, int v) :
to(to), v(v) {
}
};
#define M 2000100
#define N 2001
struct Tarjan {
vector<Edge> g[N];
int index, map_p;
stack<int> stk;
static const int INF = 0x3f3f3f3f;
int firv[N], min_index[N], tp[N];
bool in[N];
bool cmp(const Edge &a, const Edge &b) {
return a.to < b.to;
}
void init() {
memset(in, 0, sizeof(in));
memset(firv, -1, sizeof(firv));
for (int i = 0; i < N; i++)
g[i].clear();
memset(tp, -1, sizeof(tp));
memset(min_index, -1, sizeof(min_index));
while (!stk.empty()) {
stk.pop();
}
index = map_p = 0;
}
void add_edge(int st, int ed, int v) {
g[st].push_back(Edge(ed, v));
}
void tarjan(int st, int f) {
stk.push(st);
firv[st] = min_index[st] = index++;
in[st] = true;
for (int i = 0; i < (int) g[st].size(); i++) {
int to = g[st][i].to;
int c = 1;
while (i + 1 < (int) g[st].size() && g[st][i].to == g[st][i + 1].to) {
c++;
i++;
}
if (f == to && c == 1)
continue;
if (to == st)
continue;
if (firv[to] == -1) {
tarjan(to, st);
min_index[st] = min(min_index[to], min_index[st]);
} else if (in[to]) {
min_index[st] = min(min_index[to], min_index[st]);
}
}
if (min_index[st] == firv[st]) {
int k;
do {
k = stk.top();
stk.pop();
tp[k] = map_p;
in[k] = false;
} while (k != st);
map_p++;
}
}
void dfs(int st) {
in[st] = true;
for (int i = 0; i < (int) g[st].size(); i++) {
int to = g[st][i].to;
if (!in[to])
dfs(to);
}
}
bool con(int n) {
memset(in, 0, sizeof(in));
dfs(1);
for (int i = 1; i <= n; i++) {
if (!in[i]) {
memset(in, 0, sizeof(in));
return false;
}
}
memset(in, 0, sizeof(in));
return true;
}
int solve(int n) {
int ans = INF;
for (int i = 1; i <= n; i++) {
for (int j = 0; j < (int) g[i].size(); j++) {
int to = g[i][j].to, v = g[i][j].v;
if (tp[i] != tp[to]) {
ans = min(ans, v);
}
}
}
return ans;
}
};
bool cmp(const Edge &a, const Edge &b) {
return a.to < b.to;
}
Tarjan tar;
int main() {
int n, m;
while (scanf(" %d %d", &n, &m) == 2 && n | m) {
tar.init();
for (int i = 0; i < m; i++) {
int x, y, v;
scanf(" %d %d %d", &x, &y, &v);
tar.add_edge(x, y, v);
tar.add_edge(y, x, v);
}
for (int i = 1; i <= n; i++) {
sort(tar.g[i].begin(), tar.g[i].end(), cmp);
}
tar.tarjan(1, -1);
if (!tar.con(n)) {
puts("0");
continue;
}
int ans = tar.solve(n);
if (ans == tar.INF)
ans = -1;
printf("%d\n", ans);
}
return 0;
}
|
main.c:3:9: fatal error: algorithm: No such file or directory
3 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s421022862
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
struct point {
double x, y, z;
point(){}
point(double x, double y, double z):x(x),y(y),z(z){}
point operator + (const point &b) const {
return point(x + b.x, y + b.y, z + b.z);
}
point operator - (const point &b) const {
return point(x - b.x, y - b.y, z - b.z);
}
point operator * (const double &b) const {
return point(x * b, y * b, z * b);
}
point operator / (const double &b) const {
return point(x / b, y / b, z / b);
}
double len() {
return sqrt(x * x + y * y + z * z);
}
void input() {
scanf("%lf%lf%lf", &x, &y, &z);
}
void out() {
printf( "%.6lf %.6lf %.6lf\n", x, y, z );
}
};
double dot(point a, point b) {
return a.x * b.x + a.y * b.y + a.z * b.z;
}
point cross( point a, point b ) {
point res;
res.x = a.y * b.z - b.y * a.z;
res.y = a.z * b.x - b.z * a.x;
res.z = a.x * b.y - b.x * a.y;
return res;
}
double dis( point a, point b, point c, point d ) {
point n = cross(a - b, c - d);
return fabs(dot(a - c, n)) / n.len();
}
point pto( point p, point p0, point n ) {
return p - n * dot(p - p0, n);
}
point LineCross( point u1, point u2, point v1, point v2 ) {
point res = u1;
double t = ((u1.x - v1.x) * (v1.y - v2.y) - (u1.y - v1.y) * (v1.x - v2.x)) /
((u1.x - u2.x) * (v1.y - v2.y) - (u1.y - u2.y) * (v1.x - v2.x));
cout << "fuck " << ((u1.x - u2.x) * (v1.y - v2.y) - (u1.y - u2.y) * (v1.x - v2.x)) << endl;
u1.out(); u2.out(); v1.out(); v2.out();
res.x += (u2.x - u1.x) * t;
res.y += (u2.y - u1.y) * t;
res.z += (u2.z - u1.z) * t;
return res;
}
void solve( point a, point b, point c, point d, point &res1, point &res2 ) {
point n = cross(a - b, c - d);
n = n / n.len();
point aa = pto(a, a, n);
point bb = pto(b, a, n);
point cc = pto(c, a, n);
point dd = pto(d, a, n);
point k = LineCross(aa, bb, cc, dd);
k.out();
aa.out(); bb.out(); cc.out(); dd.out();
n.out();
cout << "hehe " << (cross(n, c - d)).len() << endl;
res1 = LineCross(k, k + n, a, b);
res2 = LineCross(k, k + n, c, d);
}
int main()
{
int t;
point a, b, c, d, res1, res2;
scanf( "%d", &t );
while( t-- ) {
a.input(); b.input(); c.input(); d.input();
double ans = dis(a, b, c, d);
printf( "%.6lf\n", ans );
solve(a, b, c, d, res1, res2);
printf( "%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n", res1.x, res1.y, res1.z, res2.x, res2.y, res2.z );
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s573524458
|
p00000
|
C
|
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
typedef long long lint;
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((int)(v).size())
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repf(i, a, b) for (int i = (a); i <= (b); ++i)
#define repd(i, a, b) for (int i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
const int maxMark = 1000 + 10;
//struct node {
//int num, res, ty;
//node (int num = 0, int res = 0, int ty = 0) : num(num), res(res), ty(ty) {
//}
//};
int lim[20];
int aa[20], bb[20];
int lenA, lenB;
int a, b, top[4], n, m;
int ans;
int dp[4][maxMark][3];
lint ten[20], dit[20];
set<pair<int, int> > ss[3];
int two(int x) {
return 1 << x;
}
int F(int w, int len) {
int res = 0;
repd (i, len - 1, 0) {
res = res * 2 + w / ten[i];
w %= ten[i];
}
return res;
}
void init() { //int64
lenA = 0;
lenB = 0;
int na = a, nb = b;
clr(aa);
clr(bb);
while (na != 0) {
aa[lenA++] = na % 10;
na /= 10;
}
if (lenA == 0)
aa[lenA++] = 0;
while (nb != 0) {
bb[lenB++] = nb % 10;
nb /= 10;
}
if (lenB == 0)
bb[lenB++] = 0;
ten[0] = 1;
repf (i, 1, 13)
ten[i] = ten[i - 1] * 10;
dit[0] = bb[0];
repf (i, 1, 13)
dit[i] = dit[i - 1] * 10 + bb[i];
}
int getF(int *aa, int r, int l) {
int res = 0;
repd (i, r, l)
res = res * 2 + aa[i];
return res;
}
int getD(int *aa, int r, int l) {
int res = 0;
repd (i, r, l)
res = res * 10 + aa[i];
return res;
}
int getRes(const int& len, const int& ty) {
if (len == -1) return 1;
if (ty == 0) {
return ten[len + 1];
}
else return dit[len];
}
int main(){
int T, ca = 1;
scanf("%d", &T);
while (T--) {
scanf("%d%d", &n, &m);
a = n, b = m;
init();
//printf("%d\n", F(1000000000, 9));
ans = 0;
int st = 0;
clr(dp);
ss[st].clear();
dp[st][0][1] = 1;
ss[st].insert(make_pair(0, 1));
//printf("%d\n", lenA);
//repd (i, lenA, 0)
//printf("%d", aa[i]);
//printf("\n");
repd (i, max(lenB, lenA) - 1, 0) {
//clr(dp[!st]);
ss[!st].clear();
int ha = getF(aa, i + 3, i) / two(3);
int hb = getD(bb, i + 3, i);
for (set<pair<int, int> >::iterator it = ss[st].begin(); it != ss[st].end(); it++) {
//repf (z, 0, 1) repf (k, 0, 999) {
int x = it->first;
int z = it->second;
int y = dp[st][x][z];
if (y == 0) continue;
int now = F(x, 3) * 2;
rep (j, 10) {
int nx = x * 10 + j;
if (z && nx > hb) break;
int nnow = (now + j) / two(3);
if (nnow < ha) {
//printf("%d\n", ans);
if (nx == hb && z)
ans += getRes(i - 1, 1);
else ans += getRes(i - 1, 0);
//printf("%d\n======\n", ans);
}
else if (nnow == ha) {
int nz = 0;
int nnx = (x % 100) * 10 + j;
if (nx == hb && z)
nz = 1;
dp[!st][nnx][nz] += y;
ss[!st].insert(make_pair(nnx, nz));
}
else break;
}
}
for (set<pair<int, int> >::iterator it = ss[st].begin(); it != ss[st].end(); it++) {
int x = it->first;
int z = it->second;
dp[st][x][z] = 0;
}
printf("%d\n", sz(ss[st]));
st = !st;
}
for (set<pair<int, int> >::iterator it = ss[st].begin(); it != ss[st].end(); it++) {
//repf (k, 0, 999)
//repf (ty, 0, 1)
int k = it->first;
int ty = it->second;
if (dp[st][k][ty] != 0){
int ha = getF(aa, 2, 0);
int now = F(k, 3);
if (now <= ha) {
ans += dp[st][k][ty];
//printf("%d %d\n", k, ty);
}
}
}
printf("Case #%d: ", ca++);
printf("%d\n", ans);
}
return 0;
}
|
main.c:2:9: fatal error: iostream: No such file or directory
2 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s185028381
|
p00000
|
C
|
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int N=1010;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0},n;
bool flag1[N][N],flag2[N][N];
bool judge(int x,int y,int t)
{
int x1=x+dx[t],y1=y+dy[t];
if(x1>=0&&x1<n&&y1>=0&&y1<n)
return 1;
return 0;
}
int main()
{
while(scanf("%d",&n)&&n)
{
int x1,y1,x2,y2,t1,t2,ans1=-1,ans2=-1;
memset(flag1,0,sizeof(flag1));
memset(flag2,0,sizeof(flag2));
bool f1=1,f2=1;
scanf("%d%d%d",&x1,&y1,&t1);
scanf("%d%d%d",&x2,&y2,&t2);
if(x1==x2&&y1==y2)
{
printf("%d %d\n",x1,y1);
continue;
}
flag1[x1][y1]=1; flag2[x2][y2]=1;
while(f1||f2)
{
if(f1)
{
if(judge(x1,y1,t1)&&!flag1[x1+dx[t1]][y1+dy[t1]])
{
x1+=dx[t1]; y1+=dy[t1]; flag1[x1][y1]=1;
}
else
{
t1=(t1+1)%4;
if(!judge(x1,y1,t1))
f1=0;
else if(flag1[x1+dx[t1]][y1+dy[t1]])
f1=0;
}
}
if(f2)
{
if(judge(x2,y2,t2)&&!flag2[x2+dx[t2]][y2+dy[t2]])
{
x2+=dx[t2]; y2+=dy[t2]; flag2[x2][y2]=1;
}
else
{
t2=(t2+3)%4;
if(!judge(x2,y2,t2))
f2=0;
else if(flag2[x2+dx[t2]][y2+dy[t2]])
f2=0;
}
}
if(x1==x2&&y1==y2)
{
ans1=x1; ans2=y1; break;
}
}
if(ans1!=-1)
printf("%d %d\n",ans1,ans2);
else
printf("-1\n");
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s702318408
|
p00000
|
C
|
#include<cstdio>
#include<algorithm>
const int N = (int) (1e3);
int n, ax, ay, ad, bx, by, bd;
bool flag[2][N][N];
bool in(int x, int y) {
return 0 <= x && x < n && 0 <= y && y < n;
}
const int dx[4] = { 0, 1, 0, -1 };
const int dy[4] = { 1, 0, -1, 0 };
bool go(int &x, int &y, int &d, int f) {
if (in(x + dx[d], y + dy[d]) && !flag[f][x + dx[d]][y + dy[d]]) {
x += dx[d];
y += dy[d];
return true;
}
return false;
}
void turnright(int &d) {
d = (d + 1) % 4;
}
void turnleft(int &d) {
d = (d + 3) % 4;
}
bool move(int &x, int &y, int &d, int f) {
if (go(x, y, d, f)) {
return true;
}
for (int i = 0; i < 3; ++i) {
if (f == 0) {
turnright(d);
} else {
turnleft(d);
}
if (go(x, y, d, f)) {
return true;
}
}
return false;
}
int main() {
while (scanf("%d", &n) == 1 && n) {
scanf("%d%d%d%d%d%d", &ax, &ay, &ad, &bx, &by, &bd);
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < n; ++j) {
std::fill(flag[i][j], flag[i][j] + n, false);
}
}
while (true) {
if (ax == bx && ay == by) {
break;
}
flag[0][ax][ay] = flag[1][bx][by] = true;
bool go1 = move(ax, ay, ad, 0);
bool go2 = move(bx, by, bd, 1);
if (!go1 && !go2) {
break;
}
}
if (ax == bx && ay == by) {
printf("%d %d\n", ax, ay);
} else {
puts("-1");
}
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s759585545
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std ;
const int MAXN = 5010 ;
const int MAXM = 20010 ;
int id[MAXN] , end[MAXM] , cnt , g[MAXN] , next[MAXM] ;
bool deleted[MAXM] ;
int visit[MAXN];
int n , m , low[MAXN] , dfn[MAXN] , root;
int Belong[MAXN] ;
int step ;
int Cnt ;
int fu[MAXM] , fv[MAXM] , sz , ind[MAXN];
void AddEdge(int u , int v)
{
cnt++ ; next[cnt]=g[u];g[u]=cnt;end[cnt]=v;
}
void tarjan(int u,int fa)
{
low[u]=dfn[u]=++step;
bool flag=true; visit[u]=1;
for (int mark = g[u] ; mark > 0 ; mark = next[mark]){
int v = end[mark];
if (v==fa&&flag){
flag=false;
continue ;
}
if (!visit[v]){
tarjan(v,u);
low[u]=min(low[u],low[v]);
if (dfn[u]<low[v])
{
deleted[mark]=true;
if (mark&1)
deleted[mark+1]=true;
else
deleted[mark-1]=true;
}
}else if (visit[v]==1)
low[u]=min(low[u],dfn[v]);
}
visit[u]=2;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s644831761
|
p00000
|
C
|
#include<iostream>
using namespace std;
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};
void t_right(int &di){
di++;
di%=4;
}
void t_left(int &di){
di--;
di=(di+4)%4;
}
const int N = 1001;
bool acc0[N][N], acc1[N][N];
int n;
#define x first
#define y second
typedef pair<int,int> pii;
#define mp make_pair
bool sc;
bool st[2];
pii d,t;
int dd, dt;
pii _go(pii loc, int di){
return mp(loc.x+dx[di], loc.y+dy[di]);
}
bool test(pii a, bool acc[][N]){
if(a.x<0 || a.x>n-1 || a.y<0 || a.y>n-1)return false;
if(acc[a.x][a.y]) return false;
return true;
}
int gao(){
// cout<<d.x<<' '<<d.y<<' '<<t.x<<' '<<t.y<<endl;
// cout<<dd<<' '<<dt<<endl;
if(d.x == t.x && d.y == t.y){sc = true;
return 0;
}
pii next;
if(!st[0]){
next = _go(d, dd);
if(test(next, acc0)){
d = next;acc0[d.x][d.y]=true;
}
else{
t_right(dd);
next = _go(d,dd);
if(test(next,acc0)){
d = next;acc0[d.x][d.y]=true;
}else{
st[0]=true;
}
}
}
if(!st[1]){
next = _go(t, dt);
if(test(next,acc1)){
t = next;
}
else{
t_left(dt);
next = _go(t, dt);
if(test(next, acc1)){
t = next;
}
else st[1]=true;
}
acc1[t.x][t.y]=true;
}
if(st[0] && st[1]) return 0;
return 1;
}
int main()
{
while(cin>>n){
if(n==0)break;
sc = false;
st[0]=st[1]=false;
for(int i=0;i<n;i++)for(int j=0;j<n;j++){
acc0[i][j]=acc1[i][j]=false;
}
// pii d, t;
// int dd, dt;
cin>>d.x>>d.y>>dd;
cin>>t.x>>t.y>>dt;
while(gao());
if(sc){
cout<<d.x<<' '<<d.y<<endl;
}else{
cout<<-1<<endl;
}
}
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s935784674
|
p00000
|
C
|
const int MAXN=10000000;
int cprime[MAXN],used=0;
int p[MAXN];
void prime_(){
memset(p,0,sizeof p);
for(int i=2;i<MAXN;i++){
if(!p[i]) {
cprime[used]=i,used++;
p[i] = i;
}
for(int j=0;j<used;j++){
if(cprime[j]>= MAXN/i) break;
p[i*cprime[j]]=cprime[j];
if(i%cprime[j]==0)break;
}
}
miu[1] = 1;
for (int i = 2; i < MAXN; ++i){
if (i % (((long long)p[i]) * p[i]) == 0) miu[i] = 0;
else miu[i] = - miu[i / p[i]];
}
}
|
main.c:2:5: error: variably modified 'cprime' at file scope
2 | int cprime[MAXN],used=0;
| ^~~~~~
main.c:3:5: error: variably modified 'p' at file scope
3 | int p[MAXN];
| ^
main.c: In function 'prime_':
main.c:5:4: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
5 | memset(p,0,sizeof p);
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
+++ |+#include <string.h>
1 | const int MAXN=10000000;
main.c:5:4: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
5 | memset(p,0,sizeof p);
| ^~~~~~
main.c:5:4: note: include '<string.h>' or provide a declaration of 'memset'
main.c:17:3: error: 'miu' undeclared (first use in this function)
17 | miu[1] = 1;
| ^~~
main.c:17:3: note: each undeclared identifier is reported only once for each function it appears in
|
s773082500
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define MAXN 1010
#define MAXM 1000010
using namespace std;
struct node {
int x, y;
double val;
};
node g[MAXM];
node p[MAXN];
int first[MAXN], next[MAXN << 2], v[MAXN << 2];
double cost[MAXN << 2];
int e;
double dp[MAXN];
bool vis[MAXN];
inline void addEdge(int x, int y, double val) {
v[e] = y;
next[e] = first[x];
cost[e] = val;
first[x] = e++;
}
double dist(node a, node b) {
double x = a.x - b.x;
double y = a.y - b.y;
return sqrt(x * x + y * y);
}
int father[MAXN];
void makeSet(int n) {
for (int i = 0; i <= n; i++) {
father[i] = i;
}
}
int findSet(int x) {
if (x != father[x]) {
father[x] = findSet(father[x]);
}
return father[x];
}
bool myUnion(int x, int y) {
x = findSet(x);
y = findSet(y);
if (x != y) {
father[x] = y;
return true;
} else {
return false;
}
}
bool cmp(node a, node b) {
return a.val < b.val;
}
double ans;
int root;
void dfs(int x, int pre) {
vis[x] = true;
if (pre != -1) {
ans = max(ans, (p[x].val + p[root].val) / dp[x]);
}
for (int i = first[x]; i != -1; i = next[i]) {
int y = v[i];
if (!vis[y]) {
dp[y] = max(dp[x], cost[i]);
dfs(y, x);
}
}
}
int main() {
int T;
int n;
int cnt;
int i, j;
scanf("%d", &T);
while (T--) {
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d%d%lf", &p[i].x, &p[i].y, &p[i].val);
}
cnt = 0;
for (i = 0; i < n; i++) {
for (j = i + 1; j < n; j++) {
g[cnt].x = i;
g[cnt].y = j;
g[cnt++].val = dist(p[i], p[j]);
}
}
sort(g, g + cnt, cmp);
makeSet(n);
e = 0;
memset(first, -1, sizeof(first));
for (i = 0; i < cnt; i++) {
if (myUnion(g[i].x, g[i].y)) {
addEdge(g[i].x, g[i].y, g[i].val);
}
}
ans = 0;
for (i = 0; i < n; i++) {
memset(dp, 0, sizeof(dp));
memset(vis, false, sizeof(vis));
root = i;
dfs(i, -1);
}
printf("%.2lf\n", ans);
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s969992906
|
p00000
|
C
|
#include<cstdio>
#include<algorithm>
int testCount;
struct P {
int x, y;
} a[3], b[3], c[4];
struct T {
int e[3];
} aa, bb;
#define SQR(X) ((X)*(X))
int D(P a, P b) {
return SQR(a.x-b.x) + SQR(a.y-b.y);
}
void change(P *a, T &aa) {
for (int i = 0; i < 3; ++i) {
aa.e[i] = D(a[i], a[(i + 1) % 3]);
}
std::sort(aa.e, aa.e + 3);
}
void read(P *a, T &aa) {
for (int i = 0; i < 3; ++i) {
scanf("%d%d", &a[i].x, &a[i].y);
}
change(a, aa);
}
bool equal_2(T &a, T &b) {
for (int i = 0; i < 3; ++i) {
if (a.e[i] != b.e[i]) {
return false;
}
}
return true;
}
bool equal_1(T &a1, T &a2, T &b1, T &b2) {
return (equal_2(a1, b1) && equal_2(a2, b2))
|| (equal_2(a1, b2) && equal_2(a1, b2));
}
bool check() {
P c1[3], c2[3];
T c11, c22;
/*case 1*/
c1[0] = c[0];
c1[1] = c[2];
c1[2] = c[1];
change(c1, c11);
c2[0] = c[0];
c2[1] = c[2];
c2[2] = c[3];
change(c2, c22);
if (equal_1(c11, c22, aa, bb)) {
return true;
}
/*case 2*/
c1[0] = c[1];
c1[1] = c[3];
c1[2] = c[0];
change(c1, c11);
c2[0] = c[1];
c2[1] = c[3];
c2[2] = c[2];
change(c2, c22);
if (equal_1(c11, c22, aa, bb)) {
return true;
}
return false;
}
int main() {
scanf("%d", &testCount);
for (int test = 1; test <= testCount; ++test) {
read(a, aa), read(b, bb);
for (int i = 0; i < 4; ++i) {
scanf("%d%d", &c[i].x, &c[i].y);
}
printf("Case #%d: %s\n", test, check() ? "Yes" : "No");
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s619031681
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<cstring>
#include<string>
using namespace std;
//extended kmp
//nxt[] & ext[] should be clarify out of the function
void ExtendKmp(char s[],int ls,char t[],int lt)
{
int i,j,k;
int Len,L;
j=0;
while(t[j+1]==t[j]&&j+1<lt) j++;
nxt[1]=j,k=1;
for(i=2;i<lt;i++){
Len=k+nxt[k],L=nxt[i-k];
if(Len>L+i) nxt[i]=L;
else{
j=Len-i>0?Len-i:0;
while(t[i+j]==t[j]&&i+j<lt) j++;
nxt[i]=j,k=i;
}
}
j=0;
while(s[j]==t[j]&&j<lt&&j<ls) j++;
ext[0]=j,k=0;
for(i=1;i<ls;i++){
Len=k+ext[k],L=nxt[i-k];
if(Len>L+i) ext[i]=L;
else{
j=Len-i>0?Len-i:0;
while(s[i+j]==t[j]&&i+j<ls&&j<lt) j++;
ext[i]=j,k=i;
}
}
}
//kmp
void get_ne(char* p,int *nex)
{
int i=0;int j=-1;
nex[0]=-1;
int L=strlen(p);
while(i<L)
{
if(j==-1||p[i]==p[j])
{
i++;j++;
nex[i]=j;
}
else
j=nex[j];
}
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s576177304
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
const int sigma=26;
const int maxn=200010;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int ch[maxn][sigma];
int val[maxn];
int sz,n,m,k;
void init(){sz=1;memset(ch[0],0,sizeof(ch[0]));}
void insert(int* s)
{
int u=0;
for(int i=0;i<m;i++)
{
int c=s[i];
if(!ch[u][c])
{
memset(ch[sz],0,sizeof(ch[sz]));
val[sz]=0;
ch[u][c]=sz++;
}
u=ch[u][c];
}
val[u]=1;
}
int f[maxn],vis[maxn];
void getfail()
{
queue<int> q;
f[0]=0;
for(int c=0;c<sigma;c++)
{
int u=ch[0][c];
if(u)
{
f[u]=0;q.push(u);
}
}
while(!q.empty())
{
int r=q.front();q.pop();
for(int c=0;c<sigma;c++)
{
int u=ch[r][c];
if(!u) continue;
q.push(u);
int v=f[r];
while(v && !ch[v][c]) v=f[v];
f[u]=ch[v][c];
//last[u]=val[f[u]]?f[u]:last[f[u]];
}
}
}
void find(int* T)
{
int j=0;
for(int i=0;i<n;i++)
{
int c=T[i];
while(j && !ch[j][c]) j=f[j];
j=ch[j][c];
if(val[j]) vis[i-m+1]=1;
}
}
int x[maxn],a[maxn],t[maxn];
int dp[maxn],v[maxn];
int dfs(int u)
{
if(u==n) return 0;
if(v[u]) return dp[u];
v[u]=1;
dp[u]=dfs(u+1);
if(vis[u] && u+m<=n) dp[u]=max(dp[u],dfs(u+m)+1);
return dp[u];
}
int main()
{
freopen("data","r",stdin);
while(scanf("%d%d%d",&n,&m,&k)!=EOF)
{
for(int i=0;i<n;i++) scanf("%d",&x[i]);
int g=0;
for(int i=0;i<m;i++)
{
scanf("%d",&a[i]);
g=gcd(a[i],g);
}
for(int i=1;;i++)
{
int flag=1;
for(int j=0;j<m;j++)
{
t[j]=i*a[j]/g;
if(t[j]>k)
{
flag=0;break;
}
}
if(flag) insert(t);
else break;
}
getfail();
memset(vis,0,sizeof(vis));
find(x);
memset(v,0,sizeof(v));
printf("%d\n",dfs(0));
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s321052310
|
p00000
|
C
|
//const int N=205,M=205*205+5;
//int n,gra[N][N],eid;
//int dfn[N],low[N],sta[N];
//int now,id,top,gid[N],ins[N];
//int head[N],ed[M],nxt[M];
//
//void addedge(int s,int e){
// ed[eid]=e;nxt[eid]=head[s];head[s]=eid++;
//}
//
//void tarjan(int s){
// dfn[s]=low[s]=++id;
// ins[s]=1;sta[top++]=s;
// for(int i=head[s];~i;i=nxt[i]){
// int e=ed[i];
// if(!dfn[e]){
// tarjan(e);
// low[s]=min(low[s],low[e]);
// }else if(ins[e])
// low[s]=min(low[s],dfn[e]);
// }
// if(low[s]==dfn[s]){
// id++;
// while(top){
// int k=sta[--top];
// ins[k]=0;
// gid[k]=id;
// if(k==s)return ;
// }
// }
//}
//
//int main(){
//// freopen("/home/axorb/in","r",stdin);
// while(~scanf("%d",&n)){
// clr(gra,0);clr(head,-1);eid=0;
// for(int i=1;i<=n;i++){
// while(1){
// int a;scanf("%d",&a);
// if(a==0)break;
// gra[i][a]=1;
// }
// }
// for(int i=1;i<=n;i++)
// for(int j=1;j<=n;j++)
// if(i!=j&&gra[i][j]==0){
// addedge(i*2-1,j*2);
// addedge(i*2,j*2-1);
// }
// clr(ins,0);clr(dfn,0);
// now=id=top=0;
// for(int i=1;i<=n*2;i++)
// if(!dfn[i])
// tarjan(i);
// int f=0;
// for(int i=1;i<=n*2;i+=2){
// if(gid[i]==gid[i+1]){f=1;break;}
// }
// puts(f?"NO":"YES");
// }
//}
|
/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
|
s842915273
|
p00000
|
C
|
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int v[20], f[20][20], N;
int dp[1<<13];
struct edge {
int u, v;
}e[20];
void init() {
N = 0;
for( int i = 1; i <= 16; ++i ) {
int u = i, v = i + 1;
if( u % 4 && v <= 16 && !f[u][v] ) {
e[N].u = u; e[N].v = v; N++;
f[u][v] = f[v][u] = 1;
}
v = i + 4;
if( v <= 16 && !f[u][v] ) {
e[N].u = u; e[N].v = v; N++;
f[u][v] = f[v][u] = 1;
}
}
memset( dp, -1, sizeof(dp) );
}
int cal( int st, int tot ) {
if( dp[st] != -1 ) return dp[st];
int k = 0;
for( int i = 0; i < N; ++i ) if(!(st>>i&1)) {
int uu = e[i].u, vv = e[i].v, d = 0;
if( v[uu] ) d += uu; if( v[vv] ) d += vv;
++v[uu]; ++v[vv];
k = max(k, tot - cal(st | (1 << i), tot - d));
--v[uu]; --v[vv];
}
return dp[st] = k;
}
int main()
{
int t, n, a, b, va, vb, cas = 0;
cin >> t;
while( t-- ) {
cin >> n;
memset( v, 0, sizeof(v) ); va = vb = 0;
memset( f, 0, sizeof(f) );
for( int i = 1; i <= n; ++i ) {
cin >> a >> b;
if( i & 1 ) {
if(v[a]) va+=a;
if(v[b]) va+=b;
}
else {
if(v[a]) vb+=a;
if(v[b]) vb+=b;
}
++v[a]; ++v[b]; f[a][b] = f[b][a] = 1;
}
cout << va << " " << vb << endl;
init();
cout << N << endl;
for( int i = 0; i < N; ++i ) cout << e[i].u << " " << e[i].v << endl;
if( n & 1 ) vb += cal(0,272 - va - vb), va = 272 - vb;
else va += cal(0, 272 - va - vb), vb = 272 - va;
cout << va << " " << vb << endl;
printf("Case #%d: ", ++cas);
if(va > vb) puts("Tom200");
else puts("Jerry404");
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s005457050
|
p00000
|
C
|
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn=110;
int F[maxn][maxn], G[maxn][maxn];
int p[maxn];
int n;
bool vis[maxn], ans;
void dfs (int x, int to)
{
if(p[x]!=-1 && p[x]!=to){
ans=false;
return ;
}
if(vis[x]) return ;
p[x]=to; vis[x]=true;
for(int i=1; i<=n; i++){
if(i!=x && G[x][i]==1){
dfs(i, !to);
}
}
}
int main()
{
while(scanf("%d", &n)==1 && n){
for(int i=1; i<=n; i++){
vis[i]=false;
p[i]=-1;
for(int j=1; j<=n; j++){
F[i][j]=G[i][j]=1;
}
}
for(int i=1; i<=n; i++){
int x;
while(scanf("%d", &x)==1 && x){
F[i][x]=1;
}
}
ans=false;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
if(F[i][j]==0 || F[j][i]==0){
G[i][j]=G[j][i]=1;
ans=true;
}
}
}
if(!ans){ printf("YES\n"); continue;}
ans=true;
for(int i=1; i<=n; i++){
if(!vis[i]){
dfs(vis[i], 0);
}
}
if(ans){
printf("YES\n");
}
else{
printf("NO\n");
}
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s262242339
|
p00000
|
C
|
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
const int mod=(int)1e9+7;
const int N = 101;
const int M = 41;
int n,m,opt[N][N][M][M],next1[N],next2[N],l1,l2;
char s1[N],s2[N];
struct state
{
int a,b,c,d;
state(){}
state(int aa,int bb,int cc,int dd):a(aa),b(bb),c(cc),d(dd){}
inline int &get(){ return opt[a][b][c][d]; }
// inline void print(){
// printf("state: %d %d %d %d\n",a,b,c,d);
// }
};
inline void get_next(char *s,int *next)
{
int i=0,j=-1;
next[0]=-1;
while(s[i])
{
// cout<<i<<" "<<j<<" "<<s[i]<<" "<<s[j]<<endl;
if(j==-1||s[i]==s[j]) {
// cout<<i+1<<" "<<j+1<<endl;
next[++i]=++j;
// cout<<next[i]<<" "<<j<<endl;
}
else j=next[j];
}
// cout<<s<<endl;
// for(i=0;s[i];++i)
// {
// cout<<i<<" "<<next[i]<<endl;
// }
// cout<<i<<" "<<next[i]<<endl;
}
inline int get(char *s,int *next,int l,int j,char c)
{
// cout<<j<<" "<<l<<endl;
if(j==l) return j;
// cout<<s[j]<<" "<<c<<endl;
while(j!=-1&&s[j]!=c) j=next[j];
return j+1;
}
int dfs(state s)
{
// s.print();
if(s.c<0||s.d<0) return 0;
if(s.c+s.d==0)
{
// cout<<l1<<" "<<l2<<" "<<s.a<<" "<<s.b<<endl;
return (s.a==l1&&s.b==l2)?1:0;
}
int &ret=opt[s.a][s.b][s.c][s.d];
if(ret!=-1) return ret;
ret=0;
state ns=s;
ns.a=get(s1,next1,l1,s.a,'R');
ns.b=get(s2,next2,l2,s.b,'R');
--ns.c;
ret=dfs(ns);
ns=s;
ns.b=get(s2,next2,l2,s.b,'D');
ns.a=get(s1,next1,l1,s.a,'D');
--ns.d;
// if(s.a==1&&s.b==0){
// puts("-------");
// s.print(); ns.print();
// puts("-------");
// }
ret=(ret+dfs(ns))%mod;
return ret;
}
int main()
{
int T;
// freopen("1.in","r",stdin);
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&m);
scanf("%s%s",s1,s2);
l1=strlen(s1);
l2=strlen(s2);
get_next(s1,next1);
get_next(s2,next2);
memset(opt,-1,sizeof opt);
// cout<<get(s1,next1,l1,1,'D')<<endl;
printf("%d\n",dfs(state(0,0,n,m)));
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s734347124
|
p00000
|
C
|
2????????1??3??7??9??3??9??1??7??1??3??7??3??9??1??7??1??3??9??3??9??7
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 2????????1??3??7??9??3??9??1??7??1??3??7??3??9??1??7??1??3??9??3??9??7
| ^
|
s477502837
|
p00000
|
C
|
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
string t;
string s;
while(cin>>t)
{
cin>>s;
if(s=="RGB")
{
int r,g,b;
cin>>r>>g>>b;
//get h
double h=0;
int maxx=max(max(r,g),b);
int minx=min(min(r,g),b);
if(maxx==minx)
{
h=0;
}
else if(maxx==r && g>=b)
{
h=60*(g-b)/(double)(maxx-minx);
}
else if(maxx==r && g<b)
{
h=360.0+60*(g-b)/(double)(maxx-minx);
}
else if(maxx==g)
{
h=120.0+60*(b-r)/(double)(maxx-minx);
}
else if(maxx==b)
{
h=240.0+60*(r-g)/(double)(maxx-minx);
}
//hsl
if(t=="HSL")
{
int l2=maxx+minx;
double s=0;
if(l2==0 || maxx==minx)s=0;
else if(0<l2<=1)s=(max-min)/(double)l2;
else if(l2>1)s=(max-min)/(double)(2.0-l2);
printf("HSL %.0f% %.0f% %.0f%",round(h),round(s*100),round(l2/0.5));
}
else
if(t=="HSV")
{
double s=0;
double v=maxx;
if(maxx!=0)s=1.0-minx/(double)maxx;
printf("HSV %.0f% %.0f% %.0f%",round(h),round(s*100),round(v));//?
}
else if(t=="RGB")
{
printf("RGB %d %d %d",r,g,b);
}
}
else if(s=="HSV")
{
}
else if(s=="HSL")
{
}
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s266156536
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
const int maxn = 105500;
const int maxe = 1e6+100;
const int INF = 0x3f3f3f3f;
int dp1[maxn];
int dp2[maxn];
int prime[maxn];
int cnt = 1;
bool is_prime(int temp)
{
int factor;
bool flag=true;
if(temp==2)
flag=true;
else if(temp==1||temp%2==0)
flag=false;
else
{
int m=(int)(sqrt((double)temp)+0.5);
for(factor=3;factor<=m;factor+=2)
{
if(temp%factor==0)
{
flag=false;
break;
}
}
}
return flag;
}
int main()
{
// freopen("E:\\acm\\output.txt","w",stdout);
memset(dp1,0,sizeof(dp1));
memset(dp2,0,sizeof(dp2));
for(int i=2;i<=80000;i++){
if(is_prime(i))
prime[cnt++] = i;
}
int ans = 0;
for(int i=2;i<=80000;i++)
{
ans = 0;
if(is_prime(i)) ans++;
for(int k=1;k<cnt;k++){
if(prime[k] > i) break;
for(int j=k;j<cnt;j++){
if(prime[j]> i ) break;
if(prime[k] + prime[j] == i) ans++;
if(prime[k] * prime[j] == i) ans++;
}
}
for(int k=1;k<cnt;k++){
if(prime[k]>i) break;
for(int j=k;j<cnt;j++){
if(prime[j]>i || prime[k]+prime[j]>i) break;
for(int m=j;m<cnt;m++){
if(prime[m]>i || prime[m]+prime[k]>i || prime[m]+prime[j]>i) break;
if(prime[k] + prime[j] + prime[m] == i) ans++;
if(prime[k] * prime[j] * prime[m] == i) ans++;
if(prime[k] == prime[j] && prime[j] == prime[m]){
if(prime[k] * prime[j] + prime[m] == i) ans++;
continue;
}
if(prime[k] == prime[j]){
if(prime[k] * prime[j] + prime[m] == i) ans++;
if(prime[k] * prime[m] + prime[j] == i) ans++;
continue;
}
if(prime[k] == prime[m]){
if(prime[k] * prime[j] + prime[m] == i) ans++;
if(prime[k] * prime[m] + prime[j] == i) ans++;
continue;
}
if(prime[m] == prime[j]){
if(prime[m] * prime[j] + prime[k] == i) ans++;
if(prime[k] * prime[m] + prime[j] == i) ans++;
continue;
}
if(prime[k] * prime[j] + prime[m] == i) ans++;
if(prime[k] * prime[m] + prime[j] == i) ans++;
if(prime[m] * prime[j] + prime[k] == i) ans++;
}
}
}
printf("%d,",ans);
}
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s220060276
|
p00000
|
C
|
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
int next[100];
void getnext(char *t)
{
next[0]=-1;
int j=0,k=-1;
while(j<strlen(t))
{
if((k==-1)||(t[j]==t[k]))
{
j++;k++;
next[j]=k;
}
else
k=next[k];
}
}
int kmp(char *t,char *p)
{
int i=0,j=0,l1=strlen(t),l2=strlen(p);
while(i<l1&&j<l2)
{
if(j==-1||t[i]==p[j])
{
i++;
j++;
}
else
j=next[j];
}
if(j>=l2)
return i-l2;
else
return -1;
}
int main()
{
char a[100],c[100];
int i,j;
cin>>a>>c;
getnext(c);
for(i=0;i<strlen(c)+1;i++)
cout<<next[i]<<" ";
cout<<endl;
//cout<<kmp(a,c)<<endl;
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s299390136
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
const double eps = 1e-9;
const double D = 42.5;
const double R1 = 10.0;
const double R2 = 6.0;
const double pi = acos(-1.0);
inline int sig(double x) { return (x>eps)-(x<-eps) ;}
double x, t;
void deal()
{
x = x/180 * pi;
double ps;
double k = tan(x);
double s = D/k;
t *= 100;
int pp = t/s;
double lls;
lls = (pp&1)? (t-(pp-1)*s) : (t-pp*s);
if(16 > lls + eps)
{
puts("yes");
return ;
}
double y1 = 0.0;
int tt = pp;
tt >>= 1;
if(tt & 1)
{
k = -k;
if(pp&1) y1 = -42.5;
}
else
{
if(pp&1) y1 = 42.5;
}
double dd = lls * sin(x);
double sd = y1 - k*lls;
double fx = -sd / (k + 1.0/ k);
if(fx-eps < 0) ps = sd;
else ps = dd;
if(ps-eps < 16) puts("yes");
else puts("no");
}
int main()
{
int n;
freopen("in1.txt", "r", stdin);
scanf("%d", &n);
while(n--)
{
scanf("%lf %lf", &t, &x);
deal();
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s329552107
|
p00000
|
C
|
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
const int N = 550000;
char a[N],s1[N],s2[N],nx[N];
int ans[N],l,next[N];
inline void get_next(char *s)
{
next[0]=-1;
int i=0,j=-1;
while(s[i])
{
if(j==-1||s[i]==s[j]) next[++i]=++j;
else j=next[j];
}
}
inline int kmp()
{
int ret=0;
get_next(s1);
for(int i=0,j=0;s2[i];++i)
{
if(j==-1||s2[i]==s1[j]) ++i,++j;
else j=next[j];
if(!s1[j])
{
++ret;
j=0;
}
}
return ret;
}
bool judge()
{
int ret=kmp();
return ret==1;
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%s%s%s",a,s1,s2);
int len=strlen(a);
for(int i=0;i<len;++i)
nx[a[i]]=a[(i+1)%len];
l=0;
cout<<len<<endl;
for(int i=0;i<len;++i)
{
cout<<"s1="<<s1<<endl;
cout<<"s2="<<s2<<endl;
if(judge()) ans[l++]=i;
for(int j=0;j<s1[j];++j)
s1[j]=nx[s1[j]];
}
if(l==0) puts("no solution");
else if(l==1) printf("unique: %d\n",ans[0]);
else{
printf("ambiguous:");
for(int i=0;i<l;++i)
printf(" %d",ans[i]);
puts("");
}
}
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s766593772
|
p00000
|
C
|
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<bitset>
using namespace std;
const int N = 500;
int dir[4][2]={-1,0,0,1,1,0,0,-1};
int vis[N][N],d[N][N],n,m;
char s[N][N];
bitset<N> bt;
bool ys;
bool judge(int x,int y)
{
return x>=0&&y>=0&&x<n&&y<m;
}
void dfs(int x,int y,int &l)
{
// cout<<x<<" "<<y<<endl;
vis[x][y]=1;
bt.set(s[x][y]-'0');
++l;
for(int i=0;i<4;++i)
{
if(d[x][y]&(1<<i))
{
int nx=x+dir[i][0];
int ny=y+dir[i][1];
if(!judge(x,y)) ys=0;
if(judge(x,y)&&!vis[nx][ny])
dfs(nx,ny,l);
}
}
}
int main()
{
int T;
// freopen("1.in","r",stdin);
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&m);
for(int i=0;i<n;++i)
scanf("%s",s[i]);
for(int i=0;i<n;++i)
for(int j=0;j<m;++j)
scanf("%d",&d[i][j]),vis[i][j]=0;
ys=1;
for(int x=0;x<n&&ys;++x)
for(int y=0;y<m&&ys;++y)
for(int k=0;k<4&&ys;++k)
if(d[x][y]&(1<<k))
{
int nx=x+dir[k][0];
int ny=y+dir[k][1];
if(!judge(nx,ny)) ys=0;
else{
int nk=(k+2)%4;
if(!(d[nx][ny]&(1<<nk))) ys=0;
}
}
for(int x=0;x<n;++x)
for(int y=0;y<m;++y)
for(int nx=x+1;nx<n;++nx){
if(s[x][y]==s[nx][y]&&(s[x][y]-'0')>nx-x)
ys=0;
}
for(int x=0;x<n;++x)
for(int y=0;y<m;++y)
for(int ny=y+1;ny<m;++ny){
if(s[x][y]==s[x][ny]&&(s[x][y]-'0')>ny-y)
ys=0;
}
for(int i=0;i<n&&ys;++i)
for(int j=0;j<m&&ys;++j)
{
if(!vis[i][j])
{
int l=0;
bt.reset();
dfs(i,j,l);
// puts("--------");
for(int i=l;i>0;--i)
{
if(bt[i]) --l;
}
if(l>0)
ys=0;
}
}
if(ys) puts("valid");
else puts("invalid");
}
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s981239533
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
using namespace std;
//31,37,41,43,47
const int N = 1000;
const int mod = 5;
int f[N][N];
int bell[N];
int main()
{
freopen("out.txt","w",stdout);
f[0][0]=1;
for(int i=1;i<N;i++){
for(int k=1;k<=i;k++){
f[i][k] =( k * f[i-1][k] + f[i-1][k-1])%mod;;
}
}
for(int i=0;i<10;i++){
for(int j=0;j<=i;j++)cout<<f[i][j]<<' ';cout<<endl;
}
bell[0]=1;
for(int i=1;i<N;i++){
for(int j=0;j<=i;j++){
bell[i] = (bell[i]+f[i][j])%mod;
}
}
for(int i=0;i<100;i++)cout<<bell[i]<<endl;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s609776556
|
p00000
|
C
|
BELL[1] = 1
BELL[2] = 2
BELL[3] = 5
BELL[4] = 15
BELL[5] = 52
BELL[6] = 203
BELL[7] = 877
BELL[8] = 4140
BELL[9] = 21147
BELL[10] = 115975
BELL[11] = 678570
BELL[12] = 4213597
BELL[13] = 27644437
BELL[14] = 816188
BELL[15] = 52376607
BELL[16] = 25569777
BELL[17] = 83664947
BELL[18] = 58521367
BELL[19] = 41238267
BELL[20] = 66393230
BELL[21] = 44010570
BELL[22] = 24269368
BELL[23] = 65243549
BELL[24] = 30593854
BELL[25] = 76037701
BELL[26] = 88240771
BELL[27] = 38218614
BELL[28] = 38251537
BELL[29] = 16003483
BELL[30] = 94585219
BELL[31] = 88100886
BELL[32] = 46712942
BELL[33] = 80811365
BELL[34] = 30515924
BELL[35] = 35376864
BELL[36] = 21292729
BELL[37] = 82094381
BELL[38] = 61344190
BELL[39] = 19952738
BELL[40] = 78396064
BELL[41] = 60872948
BELL[42] = 36180002
BELL[43] = 6647501
BELL[44] = 56411961
BELL[45] = 29448686
BELL[46] = 76937985
BELL[47] = 65229046
BELL[48] = 92952796
BELL[49] = 33003924
BELL[50] = 5069299
|
main.c:1:1: warning: data definition has no type or storage class
1 | BELL[1] = 1
| ^~~~
main.c:1:1: error: type defaults to 'int' in declaration of 'BELL' [-Wimplicit-int]
main.c:1:11: error: invalid initializer
1 | BELL[1] = 1
| ^
main.c:2:1: error: expected ',' or ';' before 'BELL'
2 | BELL[2] = 2
| ^~~~
|
s256398956
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
const int maxn = 1055000;
char a[maxn];
int len;
bool Judge(int n)
{
for(int i=1;i<=n;i++){
if(a[i] != a[len-n+i]) return false;
}
for(int i=n+1; i<=len-n; i++)
{
if(len-n-i+1<n) return false;
bool flag = true;
for(int j=1;j<=n;j++){
if(a[j] != a[i+j-1]){
flag = false;
break;
}
}
if(flag) return true;
}
}
int main()
{
freopen("E:\\acm\\input.txt","r",stdin);
int T;
cin>>T;
while(T--)
{
scanf("%s",a+1);
len = strlen(a+1);
int l = 0;
int r = len/3;
int mid;
while(l < r)
{
mid =l + (r - l + 1)/2;
if(Judge(mid)) l = mid;
else r = mid - 1;
}
printf("%d\n",l);
}
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s310925281
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
const int maxn=20010;
int A[maxn], B[maxn], C[maxn];
int ans;
int gcd (int a, int b)
{
return b==0?a:gcd(b, a%b);
}
void GetAns (int a, int b, int c)
{
for(int i=0; i<31; i++){
int x=1<<i;
if()
}
}
bool check (int a, int b, int c)
{
if(ans<a || ans>b) return false;
if((ans-a)*c==0) return true;
return false;
}
int main()
{
int n, m;
while(scanf("%d", &n)==1){
ans=0;
for(int i=0; i<n; i++){
scanf("%d %d %d", &A[i], &B[i], &C[i]);
B[i]=(B[i]-A[i])/C[i]*C[i]+A[i];
GetAns(A[i], B[i], C[i]);
}
if(!ans) printf("DC Qiang is unhappy.\n");
else{
m=0;
for(int i=0; i<n; i++){
if(check(A[i], B[i], C[i])) m++;
}
printf("%d\n", m);
}
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s005340444
|
p00000
|
C
|
2345 3
7 8 9
100 1
0
123 4
1 2 3 4
934 4
1 2 3 4
567 4
5 6 7 1
789 4
1 2 3 9
890 3
1 2 0
890 4
1 2 3 9
890 4
1 2 3 8
110 9
1 2 3 4 5 6 7 8 9
125 1
0
125 1
5
125 2
0 5
122 5
0 2 4 6 8
124 5
0 2 4 6 8
128 5
0 2 4 6 8
124 4
2 4 6 8
102 4
2 4 6 8
201 4
2 4 6 8
Case 1: 2345
Case 2: -1
Case 3: 5658
Case 4: 57908
Case 5: 3402
Case 6: 56808
Case 7: -1
Case 8: 4450
Case 9: 4450
Case 10: -1
Case 11: 125
Case 12: 1000
Case 13: -1
Case 14: -1
Case 15: -1
Case 16: -1
Case 17: 3100
Case 18: 510
Case 19: 1005
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 2345 3
| ^~~~
|
s078576065
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn=210000;
struct node
{
int u,next,d;
}a[maxn];
int head[maxn],b[maxn],f[maxn],rec1[maxn],rec2[maxn],max1[maxn],max2[maxn];
bool v[maxn];
int n;
void dp(int x)
{
if(v[x])return;
v[x]=true;
bool flag=false;
//max1
for(int i=head[x];i!=-1;i=a[i].next)
if(!v[a[i].u])
{
flag=true;
dp(a[i].u);
if(max1[a[i].u]+a[i].d>=max1[x])
{
max2[x]=max1[x];
rec2[x]=rec1[x];
max1[x]=max1[a[i].u]+a[i].d;
rec1[x]=a[i].u;
}
else if(max1[a[i].u]+a[i].d>max2[x])
{
max2[x]=max1[a[i].u]+a[i].d;
rec2[x]=a[i].u;
}
}
if(!flag)max1[x]=0;
}
void dfs(int x,int father,int d)
{
v[x]=true;
if(x==1)f[x]=0;
else
{
if(rec1[father]!=x && max1[father]!=-1)
f[x]=max1[father]+d;
else if(rec2[father]!=x && max2[father]!=-1)
f[x]=max2[father]+d;
f[x]=max(f[x],f[father]+d);
}
for(int i=head[x];i!=-1;i=a[i].next)
if(!v[a[i].u])
{
dfs(a[i].u,x,a[i].d);
}
}
int bmax[maxn][20], bmin[maxn][20];
void RMQ_init ()
{
for(int i=1; i<=n; i++) bmax[i][0]=bmin[i][0]=i;
for(int j=1; (1<<j)<=n; j++)
for(int i=1; i+(1<<j)-1<=n; i++){
if(b[bmax[i][j-1]] > b[bmax[i+(1<<(j-1))][j-1]]) bmax[i][j]=bmax[i][j-1];
else bmax[i][j]=bmax[i+(1<<(j-1))][j-1];
if(b[bmin[i][j-1]] < b[bmin[i+(1<<(j-1))][j-1]]) bmin[i][j]=bmin[i][j-1];
else bmin[i][j]=bmin[i+(1<<(j-1))][j-1];
}
}
int RMQ_max (int L, int R)
{
int k=0;
while((1<<(k+1))<= R-L+1) k++;
if(b[bmax[L][k]] > b[bmax[R-(1<<k)+1][k]]) return bmax[L][k];
else return bmax[R-(1<<k)+1][k];
}
int RMQ_min (int L, int R)
{
int k=0;
while((1<<(k+1))<= R-L+1) k++;
if(b[bmin[L][k]] < b[bmin[R-(1<<k)+1][k]]) return bmin[L][k];
else return bmin[R-(1<<k)+1][k];
}
int query (int q)
{
int ret, minx, maxx, minloc, maxloc, r, l;
ret=1;
minx=maxx=b[1];
maxloc=minloc=1;
l=r=1;
while(r<=n){
if(b[r]>=minx && b[r]<=maxx) r++;
else{
if(b[r]<minx){
if(maxx-b[r]<=q){
minx=b[r]; minloc=r;
r++;
}
else{
ret=max(ret, r-l);
l=maxloc+1;
maxloc=RMQ_max(l, r);
maxx=b[maxloc];
r++;
}
}
else{
if(b[r]-minx<=q){
maxx=b[r]; maxloc=r;
r++;
}
else{
ret=max(ret, r-l);
l=minloc+1;
minloc=RMQ_min(l, r);
minx=b[minloc];
r++;
}
}
}
}
return ret;
}
int main()
{
freopen("data","r",stdin);
int m;
while(scanf("%d%d",&n,&m),n|m)
{
int num=0;
for(int i=1;i<=n-1;i++)
{
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
num++;a[num].u=y;a[num].d=z;a[num].next=head[x];head[x]=num;
num++;a[num].u=x;a[num].d=z;a[num].next=head[y];head[y]=num;
}
//pre
memset(rec1,0,sizeof(rec1));
memset(rec2,0,sizeof(rec2));
memset(max1,-1,sizeof(max1));
memset(max2,-1,sizeof(max2));
memset(v,false,sizeof(v));
dp(1);
memset(f,-1,sizeof(f));
memset(v,false,sizeof(v));
dfs(1,0,0);
for(int i=1;i<=n;i++)
{
b[i]=max(max1[i],f[i]);
cout<<b[i]<<endl;
}
//solve b
RMQ_init();
int ans=0;
for(int i=1;i<=m;i++)
{
int q;
scanf("%d",&q);
printf("%d\n", query(q));
}
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s713958219
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int hx[]={2,2,-2,-2,1,-1,1,-1},hy[]={1,-1,1,-1,2,2,-2,-2};
int n,x,y;
char type[10][10];
int px[10],py[10];
int main()
{
freopen("data","r",stdin);
while(~scanf("%d%d%d",&n,&x,&y))
{
if(!n && !x && !y) break;
for(int i=0;i<n;i++)
scanf("%s%d%d",type[i],&px[i],&py[i]);
int ans=0;
for(int i=0;i<4;i++)
{
int vx=x+dx[i],vy=y+dy[i];
int tmp=0;
if(vx>=1 && vx<=3 && vy>=4 && vy<=6)
{
for(int j=0;j<n;j++)
{
if(type[j][0]=='G')
{
if(py[j]==vy) tmp=1;
}
else if(type[j][0]=='R')
{
if(px[j]==vx)
{
int flag=0;
for(int k=0;k<n;k++)
{
if(k==j) continue;
if(px[k]==vx)
{
if(py[k]<vy && py[k]>py[j]) flag=1;
if(py[k]>vy && py[k]<py[j]) flag=1;
}
}
if(!flag) tmp=1;
}
if(py[j]==vy)
{
int flag=0;
for(int k=0;k<n;k++)
{
if(k==j) continue;
if(py[k]==vy)
{
if(px[k]<vx && px[k]>px[j]) flag=1;
if(px[k]>vx && px[k]<px[j]) flag=1;
}
}
if(!flag) tmp=1;
}
}
else if(type[j][0]=='H')
{
for(int k=0;k<8;k++)
{
int ux=px[j]+hx[k],uy=py[j]+hy[k];
int jx=px[j]+dx[k/2],jy=py[j]+dy[k/2];
int flag=0;
for(int p=0;p<n;p++)
{
if(px[p]==jx && py[p]==jy) flag=1;
}
if(ux>=1 && ux<=10 && uy>=1 && uy<=9 && !flag)
{
if(ux==vx && uy==vy) tmp=1;
}
}
}
else
{
if(px[j]==vx)
{
int cnt=0;
for(int k=0;k<n;k++)
{
if(k==j) continue;
if(px[k]==vx)
{
if(py[k]<vy && py[k]>py[j]) cnt++;
if(py[k]>vy && py[k]<py[j]) cnt++;
}
}
if(cnt==1) tmp=1;
}
if(py[j]==vy)
{
int cnt=0;
for(int k=0;k<n;k++)
{
if(k==j) continue;
if(py[k]==vy)
{
if(px[k]<vx && px[k]>px[j]) cnt++;
if(px[k]>vx && px[k]<px[j]) cnt++;
}
}
if(cnt==1) tmp=1;
}
}
}
}
if(!tmp) ans=1;
}
if(ans) puts("NO");
else puts("YES");
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s095884506
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
const long long zero=(long long)0;
const long long one=(long long)1;
const long long maxn=(long long)1<<32;
long long n, m, x, y, X, Y;
long long getlastz (long long x)
{
long long s=0, i=1;
while(!(i&x)){
s++;
i<<=1;
}
//printf("x %lld s %lld\n", x, s);
return s;
}
long long getsum (long long x)
{
long long s=0;
while(x>zero){
s+=getlastz(x);
//printf("s %lld x %lld\n", s, x);
x-=x&-x;
}
return s;
}
int main()
{
while(scanf("%lld %lld", &n, &m)==2){
long long L, R, M, tmp;
L=1; R=maxn;
while(L<R){
M=L+(R-L)/2;
x=getsum(M);
if(x>=n) R=M;
else L=M+1;
}
x=getsum(R);
X=R;
L=1; R=maxn;
while(L<R){
M=L+(R-L)/2;
y=getsum(M);
if(y>=m) R=M;
else L=M+1;
}
y=getsum(R);
Y=R;
printf("x %lld y %lld X %lld Y %lld\n", x, y, X, Y);
long long sum=0;
for(int i=1; i<=31; i++){
tmp=one<<i;
L=X/tmp+1;
if(L%2==0) L++;
if(Y%tmp==0) R=Y/tmp-1;
else R=Y/tmp;
if(R%2==0) R--;
if(L>R) continue;
sum+=((R-L)/2+1)*(L+R)/2*tmp*i;
printf("i %d L %lld R %lld\n", i, L, R);
}
if(n!=m) sum+=(x-n+1)*X+(y-m+1)*Y;
else sum+=(x-n+1)*X;
printf("%lld\n", sum);
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s742711714
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const double eps=1e-10;
const int maxn=30010;
int dcmp(double x)
{
if(fabs(x)<eps) return 0;
else return x<0?-1:1;
}
struct point
{
double x,y;
point(double x=0,double y=0):x(x),y(y){}
};
double a,b;
int main()
{
while(scanf("%lf%lf",&a,&b)!=EOF)
{
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s672734742
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
typedef double matrix[70][300];
const double eps=1e-6;
int l,w,h;
int m,n;
int val[100];
bool gauss(matrix a)
{
int i=0,j=0,k,r,u;
while(i<m && j<n)
{
r=i;
for(k=i+1;k<m;k++)
if(fabs(a[k][j])>fabs(a[r][j])) r=k;
if(fabs(a[r][j])>eps)
{
if(r!=i) for(k=0;k<=n;k++) swap(a[r][k],a[i][k]);
for(k=n;k>=i;k--)
{
for(u=i+1;u<m;u++)
a[u][k]-=a[u][i]*a[i][k]/a[i][j];
}
i++;
}
j++;
// for(k=0;k<m;k++)
// {
// for(u=0;u<=n;u++) cout<<a[k][u]<<" ";
// cout<<endl;
// }
}
int flag=1;
for(k=i;k<m;k++) if(fabs(a[k][n])>eps) flag=0;
for(k=0;k<i;k++) if(fabs(a[k][n]-ceil(a[k][n]))>eps) flag=0;
if(flag==0) return false;
else return i<=n;
}
int main()
{
freopen("data","r",stdin);
while(scanf("%d%d%d",&l,&w,&h)!=EOF)
{
n=0;m=l*w*h;
matrix a;
for(int i=0;i<m;i++)
for(int j=0;j<=3*m;j++) a[i][j]=0;
int u,v;
for(int i=0;i<l;i++)
for(int j=0;j<w;j++)
for(int k=0;k<h;k++)
{
u=i*w*h+j*h+k;
scanf("%d",&val[u]);
if(i+1<l)
{
v=(i+1)*w*h+j*h+k;
a[u][n]=1;a[v][n]=1;
n++;
}
if(j+1<w)
{
v=i*w*h+(j+1)*h+k;
a[u][n]=1;a[v][n]=1;
n++;
}
if(k+1<h)
{
v=i*w*h+j*h+k+1;
a[u][n]=1;a[v][n]=1;
n++;
}
}
for(int i=0;i<m;i++) a[i][n]=val[i];
// for(int i=0;i<m;i++)
// {
// for(int j=0;j<=n;j++) cout<<a[i][j]<<" ";
// cout<<endl;
// }
// cout<<endl;
if(!gauss(a)) puts("No");
else puts("Yes");
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s149792266
|
p00000
|
C
|
#include<stdio.h>
int main(void)
{
|
main.c: In function 'main':
main.c:3:1: error: expected declaration or statement at end of input
3 | {
| ^
|
s280545499
|
p00000
|
C
|
#include<stdio.h>
int main(void)
{
int ma=1;
while(ma<=10){
printf("%d*%d=%d\n",ma,ma,ma*ma);
ma++;
return(0);
}
|
main.c: In function 'main':
main.c:11:1: error: expected declaration or statement at end of input
11 | }
| ^
|
s907796031
|
p00000
|
C
|
#include<stdio.h>
int main(void){
int ma=1;
while(ma<=10){
printf("%d*%d=%d\n"ma,ma,ma*ma);
ma++;
}
return(0);
}
|
main.c: In function 'main':
main.c:6:20: error: expected ')' before 'ma'
6 | printf("%d*%d=%d\n"ma,ma,ma*ma);
| ~ ^~
| )
|
s060937254
|
p00000
|
C
|
#include<stdio.h>
int main()
{
int ma=1;
while(ma<=10){
printf("%d×%d=%d\n",ma,ma,ma*ma);
ma++;
}
return0;
}
|
main.c: In function 'main':
main.c:10:1: error: 'return0' undeclared (first use in this function)
10 | return0;
| ^~~~~~~
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
|
s951348202
|
p00000
|
C
|
null
|
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
1 | null
| ^~~~
|
s393468053
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
char a[300], b[520000], c[520000];
int l1, l2;
int judge(int ip) {
if(ip - l1 + 1 < 0) return 0;
for(int i=ip-l1+1; i<=ip; i++) {
if(c[i] != a[i-ip+l1-1]) return 0;
}
return 1;
}
int main() {
int i, j, ip, ans;
while(~scanf("%s", a)) {
scanf("%s", b);
l1 = strlen(a);
l2 = strlen(b);
ip = ans = 0;
for(i=0; i<l2; i++) {
c[ip] = b[i];
if(judge(ip)) {
ip -= l1;
ans++;
}
ip++;
}
printf("%d\n", ans);
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s204386400
|
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("%dx%d=%d",i,j,s);
}
}
return 0;
}
|
main.c: In function 'main':
main.c:5:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for'
5 | for(i = 1,i <= 9,i++){
| ^~~
|
s611304822
|
p00000
|
C
|
#include<stdio.h>
int main(void){
int i,j,s
for(i = 1,i <= 9,i++){
for(j = 1,j <= 9,j++){
s=i*j;
printf("%dx%d=%d",i,j,s);
}
}
return 0;
}
|
main.c: In function 'main':
main.c:5:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for'
5 | for(i = 1,i <= 9,i++){
| ^~~
|
s446149779
|
p00000
|
C
|
#include<stdio.h>
int main(void){
int i,j,s
for(i = 1,i <= 9,i++){
for(j = 1,j <= 9,j++){
s=i*j;
printf("%dx%d=%d\n",i,j,s);
}
}
return 0;
}
|
main.c: In function 'main':
main.c:5:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for'
5 | for(i = 1,i <= 9,i++){
| ^~~
|
s856908701
|
p00000
|
C
|
http://blog.fens.me/nodejs-socketio-chat/
........................................................................................................................
|
main.c:1:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
1 | http://blog.fens.me/nodejs-socketio-chat/
| ^
|
s031495329
|
p00000
|
C
|
#include <iostream>
using namespace std;
int main(){
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= 9 ; 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.
|
s209462408
|
p00000
|
C
|
#include <iostream>
using namespace std;
int main()
{
while(!-1){
long long int a,b;
cin >> a >> b;
cout << (a+b) << endl;
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s520065752
|
p00000
|
C
|
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
using namespace std;
#define N 27
int T,n;
char s[100];
int map[N][N],fg,f[N],mlen,st[100],stt[100],pre[100],pree[100],dep,edd,ed;
int q[100],cp;
void init()
{
for(int i=0;i<26;i++)
for(int j=0;j<26;j++)map[i][j]=1;
memset(f,0,sizeof(f));
mlen=0;
}
void dfs(int s,int h,int x)
{
if(fg>0)return;
if(s==x)
{
fg=h;
return;
}
if(f[s])return;
f[s]=1;
for(int i=0;i<26;i++)
{
if(map[s][i])
{
st[h]=i;
dfs(i,h+1,x);
}
}
}
void dfs1(int s,int x,int d)
{
if(d>depp)
{
depp=d;
edd=s;
}
for(int i=0;i<26;i++)
{
if(map[s][i])
{
pree[s]=x;
dfs1(i,s,d+1);
}
}
}
void pt(int len,int st[],int fg)
{
int ps=0;
for(int i=0;i<len;i++)
{
int pos=ps+i;
for(int j=0;j<len;j++)
{
printf("%c",st[pos]);
pos++;
if(pos>=fg)pos=0;
}
puts("");
}
}
int main()
{
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
init();
for(int i=0;i<n;i++)
{
scanf("%s",s);
map[s[0]-'a'][s[1]-'a']=0;
}
fg=-1;
for(int i=0;i<26;i++)
{
if(map[i][i]==1)
{
fg=i;
break;
}
}
if(~fg)
{
for(int i=0;i<20;i++)
{
for(int j=0;j<20;j++)
printf("%c",fg+'a');
puts("");
}
}
else
{
int dep_max=0;
for(int i=0;i<26;i++)
{
memset(f,0,sizeof(f));
dfs(i,0,i);
if(fg)break;
}
if(fg)
{
pt(20,st,fg);
}
else
{
dep=0; depp=0;
for(int i=0;i<26;i++)
{
dfs1(i,-1);
if(depp>dep)
{
dep=depp;
ed=edd;
while(~pree[edd])
{
pre[edd]=pree[edd];
edd=pre[edd];
}
}
}
cp=0;
while(~pre[ed])
{
q[cp++]=ed;
ed=pre[ed];
}
reverse(q,q+cp);
pt(dep-2, q, cp);
}
}
}
return 0;
}
|
main.c:3:10: fatal error: algorithm: No such file or directory
3 | #include <algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s433574508
|
p00000
|
C
|
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define N 27
int T,n;
char s[100];
int map[N][N], fg;
void init()
{
for(int i=0; i<26; i++)
for(int j=0; j<26; j++)map[i][j]=1;
}
bool loop;
bool vis[26];
int pre[26];
#define clr(a,b) memset(a,b,sizeof(a))
vector<int> ans;
int gg[55][55];
void dfs(int u)
{
if(loop == true) return ;
for(int i=0; i<26; i++)
{
if(map[u][i] == 1)
{
if(vis[i] == 1)
{
loop = true;
int cur = u;
vector<int> tmp;
int tmplen;
while(cur != -1)
{
tmp.push_back(cur);
cur = pre[cur];
}
ans = tmp;
return ;
}
else
{
vis[i] = true;
pre[i] = u;
dfs(i);
pre[i] = -1;
vis[i] = false;
}
}
}
vector<int> tmp;
int tmplen;
int cur = u;
while(cur != -1)
{
tmp.push_back(cur);
cur = pre[cur];
}
if(tmp.size() > ans.size())
ans = tmp;
}
int main()
{
freopen("in","r",stdin);
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
init();
for(int i=0; i<n; i++)
{
scanf("%s",s);
map[s[0]-'a'][s[1]-'a']=0;
}
fg=-1;
for(int i=0; i<26; i++)
{
if(map[i][i]==1)
{
fg=i;
break;
}
}
if(~fg)
{
for(int i=0; i<20; i++)
{
for(int j=0; j<20; j++)
printf("%c",fg+'a');
puts("");
}
}
else
{
loop = false;
for(int i=0; i<26 && loop == false; i++)
{
clr(pre, -1);
clr(vis, false);
vis[i] = true;
dfs(i);
}
if(loop)
{
int pos = 0;
for(int l=2; l<=40; l++)
{
for(int i=1; i<l; i++)
{
int j = l - i;
gg[i][j] = ans[pos];
}
pos = (pos + 1) % ans.size();
}
for(int i=1; i<=20; i++)
{
for(int j=1; j<=20; j++)
printf("%c",gg[i][j]);
puts("");
}
}
else
{
int len = 0;
int pos = 0;
for(int l=2; l<=ans.size()+1; l++)
{
for(int i=1; i<l; i++)
{
int j = l-i;
len = max(len, min(i,j) );
gg[i][j] = ans[pos];
}
pos++;
}
for(int i=1; i<=len; i++)
{
for(int j=1; j<=len; j++)
printf("%c",gg[i][j]);
puts("");
}
}
}
}
return 0;
}
|
main.c:3:10: fatal error: algorithm: No such file or directory
3 | #include <algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s973876470
|
p00000
|
C
|
#include <stdio.h>
int main(void)
{
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:13:3: error: expected declaration or statement at end of input
13 | return(0);
| ^~~~~~
|
s589552071
|
p00000
|
C
|
#include <stdio.h>
int main(void)
{
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:13:3: error: expected declaration or statement at end of input
13 | return 0;
| ^~~~~~
|
s496269418
|
p00000
|
C
|
0000: QQ
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 0000: QQ
| ^~~~
|
s228489625
|
p00000
|
C
|
0000: QQ
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 0000: QQ
| ^~~~
|
s089725287
|
p00000
|
C
|
#include<stdio.h> int main() {int a,i,j; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) { printf("%d x %d = %d",i,j,i*j); printf("\n"); } } return 0; }
|
main.c:1:19: warning: extra tokens at end of #include directive
1 | #include<stdio.h> int main() {int a,i,j; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) { printf("%d x %d = %d",i,j,i*j); printf("\n"); } } return 0; }
| ^~~
/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
|
s652914235
|
p00000
|
C
|
#include <stdio.h>
int main(void){
|
main.c: In function 'main':
main.c:3:1: error: expected declaration or statement at end of input
3 | int main(void){
| ^~~
|
s690096895
|
p00000
|
C
|
#include<stdio.h>
int main(){
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
printf("%d"+"x"+"%d"+"="+"%d\n",i,j,i*j);
return 0;
}
|
main.c: In function 'main':
main.c:4:5: error: 'i' undeclared (first use in this function)
4 | for(i=1;i<=9;i++){
| ^
main.c:4:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:5: error: 'j' undeclared (first use in this function)
5 | for(j=1;j<=9;j++){
| ^
main.c:6:12: error: invalid operands to binary + (have 'char *' and 'char *')
6 | printf("%d"+"x"+"%d"+"="+"%d\n",i,j,i*j);
| ~~~~^
| | |
| | char *
| char *
main.c:8:1: error: expected declaration or statement at end of input
8 | }
| ^
main.c:8:1: error: expected declaration or statement at end of input
|
s988939499
|
p00000
|
C
|
#include<stdio.h>
int main(){
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
printf("%d",i);
printf("x");
printf("%d",j);
printf("=");
printf("%d\n",i*j);
return 0;
}
|
main.c: In function 'main':
main.c:4:5: error: 'i' undeclared (first use in this function)
4 | for(i=1;i<=9;i++){
| ^
main.c:4:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:5: error: 'j' undeclared (first use in this function)
5 | for(j=1;j<=9;j++){
| ^
main.c:12:1: error: expected declaration or statement at end of input
12 | }
| ^
main.c:12:1: error: expected declaration or statement at end of input
|
s239527558
|
p00000
|
C
|
#include<stdio.h>
int main(){
int i,j;
for(i = 1;i<=9;i++){
for(j = 1; j<=9;j++){
pritnf("%dx%d=%d",j,i,j*i);
}
}
return 0;
}
|
main.c: In function 'main':
main.c:7:25: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration]
7 | pritnf("%dx%d=%d",j,i,j*i);
| ^~~~~~
| printf
|
s432083608
|
p00000
|
C
|
#include<cstdio>
#include<algorithm>
const int Inf = (int) (2e8);
int n, m, x[1 << 15], c[1 << 15], r[1 << 15], p[1 << 15];
int li[1 << 15], ri[1 << 15], pre[1 << 15], f[1 << 7][2], ans;
struct tree_st {
int e[1 << 16], c[1 << 16];
void build(int l, int r, int rt) {
e[rt] = c[rt] = Inf;
if (l != r) {
int m = (l + r) >> 1;
build(l, m, rt << 1);
build(m + 1, r, rt << 1 | 1);
}
}
void pushdown(int rt) {
if (c[rt] == Inf) {
return;
}
c[rt << 1] = std::min(c[rt << 1], c[rt]);
e[rt << 1] = e[rt];
c[rt << 1 | 1] = std::min(c[rt << 1 | 1], c[rt]);
e[rt << 1 | 1] = e[rt];
c[rt] = Inf;
}
void modify(int sl, int sr, int v, int l, int r, int rt) {
if (sl > r || sr < l) {
return;
} else {
if (sl <= l && r <= sr) {
c[rt] = std::min(c[rt], v);
e[rt] = c[rt];
} else {
int m = (l + r) >> 1;
pushdown(rt);
modify(sl, sr, v, l, m, rt << 1);
modify(sl, sr, v, m + 1, r, rt << 1 | 1);
e[rt] = std::min(e[rt << 1], e[rt << 1 | 1]);
}
}
}
int min(int sl, int sr, int l, int r, int rt) {
if (sl > r || sr < l) {
return Inf;
} else {
if (sl <= l && r <= sr) {
return e[rt];
} else {
int m = (l + r) >> 1;
pushdown(rt);
int ans = Inf;
ans = std::min(ans, min(sl, sr, l, m, rt << 1));
ans = std::min(ans, min(sl, sr, m + 1, r, rt << 1 | 1));
return ans;
}
}
}
} tree[1 << 7][2];
inline int cost(int l, int r) {
if (l > r) {
return 0;
}
return (l ? pre[r] - pre[l - 1] : pre[r]);
}
int solve() {
for (int i = 1; i <= m; ++i) {
for (int j = 0; j < 2; ++j) {
tree[i][j].build(0, n - 1, 1);
}
}
ans = pre[n - 1];
for (int i = 0; i < n; ++i) {
f[1][0] = c[i] + cost(0, i - 1);
f[1][1] = c[i] + cost(0, li[i] - 1);
for (int j = 2; j <= std::min(i + 1, m); ++j) {
f[j][0] = Inf;
if (j - 2 <= i - 1) {
f[j][0] = c[i] - cost(i, n - 1)
+ tree[j - 1][1].min(j - 2, i - 1, 0, n - 1, 1);
}
f[j][1] = Inf;
if (std::max(j - 2, li[i]) <= i - 1) {
f[j][1] = std::min(f[j][1],
c[i]
+ tree[j - 1][0].min(std::max(j - 2, li[i]),
i - 1, 0, n - 1, 1));
}
if (j - 2 <= li[i] - 1) {
f[j][1] = std::min(f[j][1],
c[i] - cost(li[i], n - 1)
+ tree[j - 1][1].min(j - 2, li[i] - 1, 0, n - 1,
1));
}
}
for (int j = 1; j <= std::min(i + 1, m); ++j) {
tree[j][0].modify(0, ri[i], f[j][0], 0, n - 1, 1);
tree[j][1].modify(0, ri[i], f[j][0] + cost(ri[i] + 1, n - 1), 0,
n - 1, 1);
ans = std::min(ans, f[j][0] + cost(ri[i] + 1, n - 1));
tree[j][0].modify(0, i, f[j][1], 0, n - 1, 1);
tree[j][1].modify(0, i, f[j][1] + cost(i + 1, n - 1), 0, n - 1, 1);
ans = std::min(ans, f[j][1] + cost(i + 1, n - 1));
}
}
return ans;
}
int main() {
int test = 1;
while (scanf("%d%d", &n, &m) == 2) {
if (n == 0 && m == 0) {
break;
}
x[0] = 0;
for (int i = 1; i < n; ++i) {
scanf("%d", &x[i]);
}
for (int i = 0; i < n; ++i) {
scanf("%d", &c[i]);
}
for (int i = 0; i < n; ++i) {
scanf("%d", &r[i]);
}
for (int i = 0; i < n; ++i) {
li[i] = std::lower_bound(x, x + n, x[i] - r[i]) - x;
ri[i] = std::lower_bound(x, x + n, x[i] + r[i]) - x;
if (ri[i] == n || x[ri[i]] > x[i] + r[i]) {
ri[i]--;
}
}
for (int i = 0; i < n; ++i) {
scanf("%d", &p[i]);
pre[i] = (i ? pre[i - 1] + p[i] : p[i]);
}
printf("Case %d: %d\n", test++, solve());
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s852798156
|
p00000
|
C
|
#include<stdio.h> int main() {int a,i,j; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) { printf("%d x %d = %d",i,j,i*j); printf("\n"); } } return 0; }
|
main.c:1:19: warning: extra tokens at end of #include directive
1 | #include<stdio.h> int main() {int a,i,j; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) { printf("%d x %d = %d",i,j,i*j); printf("\n"); } } return 0; }
| ^~~
/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
|
s153342981
|
p00000
|
C
|
#include int main(int argc, const char * argv[]) { 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:1:10: error: #include expects "FILENAME" or <FILENAME>
1 | #include int main(int argc, const char * argv[]) { 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; }
| ^~~
|
s304433668
|
p00000
|
C
|
#include<stdio.h>
int main(){
int i = 9;
int j=0;
for(;i<=9;i++)
{
j=i*i;
printf("%d*%d=%d"i,i,j);
return 0;
}
}
|
main.c: In function 'main':
main.c:9:22: error: expected ')' before 'i'
9 | printf("%d*%d=%d"i,i,j);
| ~ ^
| )
|
s454025790
|
p00000
|
C
|
#include <cstdio>
using namespace std;
int main()
{
int i,j;
for(i=1;i<10;i++)
for(j=1;j<10;j++)
printf("%dx%d=%d\n",i,j,i*j);
getchar();
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s169663211
|
p00000
|
C
|
#include <stdio.h>
#include <string.h>
#define maxx(a,b) a>b?a:b
const int N = 1000000010;
int m[N];
int l[N];
int r[N];
int main()
{
int n;
while(scanf("%d",&n)!=EOF,n)
{
int i,j;
for(i=1;i<=n;i++)
{
scanf("%d",&m[i]);
}
memset(l,0,sizeof(l));
memset(r,0,sizeof(r));
for(i=1;i<=n;i++)
{
while(m[l[i]-1]>=m[i])
{
l[i]=l[l[i]-1];
}
}
for(i=n;i>=1;i--)
{
while(m[r[i]+1]>=m[i])
{
}
}
}
return 0;
}
|
main.c:7:5: error: variably modified 'm' at file scope
7 | int m[N];
| ^
main.c:8:5: error: variably modified 'l' at file scope
8 | int l[N];
| ^
main.c:9:5: error: variably modified 'r' at file scope
9 | int r[N];
| ^
|
s755237674
|
p00000
|
C
|
#include<stdio.h> int main() {int i,j; for(i=1;i<=9;++i) { for(j=1;j<=9;++j) { printf("%d * %d = %d\n",i,j,i*j); } } return 0; }
|
main.c:1:19: warning: extra tokens at end of #include directive
1 | #include<stdio.h> int main() {int i,j; for(i=1;i<=9;++i) { for(j=1;j<=9;++j) { printf("%d * %d = %d\n",i,j,i*j); } } return 0; }
| ^~~
/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
|
s879713890
|
p00000
|
C
|
#include<stdio.h>
int main(void){
int i, j;
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
printf("%d %s %d %s %d",i,x,j,=,i*j);
}
}
return 0;
}
|
main.c: In function 'main':
main.c:6:33: error: 'x' undeclared (first use in this function)
6 | printf("%d %s %d %s %d",i,x,j,=,i*j);
| ^
main.c:6:33: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:37: error: expected expression before '=' token
6 | printf("%d %s %d %s %d",i,x,j,=,i*j);
| ^
|
s525548154
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1005;
int dp[N][8];
int a[N][5];
int x;
bool ok(int st, int x) {
return !(st>>x&1);
}
int fix(int st, int x) {
return st|(1<<x);
}
void dfs(int y, int pre, int now, int val) {
if(y == 3) {
dp[x+1][now] = max(dp[x+1][now], val);
return;
}
int i, j;
dfs(y+1, pre, now, val); // no
if(ok(pre, y) && ok(now, y)) { //*
//*
dfs(y+1, fix(pre, y), fix(now, y), val+a[x][y]*a[x+1][y]);
}
if(y+1 < 3 && ok(now, y) && ok(now, y+1)) { //**
dfs(y+1, fix(now, y), fix(now, y+1), val+a[x+1][y]*a[x+1][y+1]);
}
}
int n;
int main() {
int i, j, ca = 1;
while(~scanf("%d", &n) && n) {
for(i = 0; i <= n; i++)
for(j = 0; j < 8; j++)
dp[i][j] = -1e9;
for(i = 1; i <= 3; i++)
for(j = 1; j <= n; j++)
scanf("%d", &a[j][i]);
dp[0][7] = 0;
for(i = 0; i <= n; i++) {
for(j = 0; j < 8; j++) if(dp[i][j] != -1e9){
x = i;
dfs(0, j, 0, dp[i][j]);
}
}
int ans = 0;
for(i = 0; i < 8; i++)
ans = max(ans, dp[n+1][i]);
printf("Case %d: %d\n", ca++, ans);
}
return 0;
}
/*
4
7 2 4 9
3 5 9 3
9 5 1 8
*/
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s254698225
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1005;
int dp[N][8];
int a[N][5];
int x;
bool ok(int st, int x) {
return !(st>>x&1);
}
int fix(int st, int x) {
return st|(1<<x);
}
void dfs(int y, int pre, int now, int val) {
if(y == 3) {
dp[x+1][now] = max(dp[x+1][now], val);
// printf ( "dp[%d][%d] = %d\n" , x +1 , now , dp[x+1][now] ) ;
return;
}
int i, j;
dfs(y+1, pre, now, val); // no
if(ok(pre, y)) { //*
//*
dfs(y+1, fix(pre, y), fix(now, y), val+a[x][y]*a[x+1][y]);
}
if(y+1 < 3 && ok(pre, y) && ok (pre , y + 1) ) { //**
dfs(y+2, fix(fix(pre, y),y+1),now, val+a[x][y]*a[x][y+1]);
}
}
int n;
int main() {
int i, j, ca = 1;
while(~scanf("%d", &n) && n) {
for(i = 0; i <= n; i++)
for(j = 0; j < 8; j++)
dp[i][j] = 0;
for(i = 1; i <= n; i++)
for(j = 0; j < 3; j++)
scanf("%d", &a[i][j]);
for(i = 0; i <= n; i++) {
for(j = 0; j < 8; j++) {
x = i;
// printf ( "i = %d , j = %d\n" , i , j ) ;
dfs(0, j, 0, dp[i][j]);
}
}
int ans = 0;
printf("Case %d: %d\n", ca++, dp[n+1][0]);
}
return 0;
}
/*
4
7 2 4 9
3 5 9 3
9 5 1 8
*/
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s281262539
|
p00000
|
C
|
1 1
Case 1: a a
2 1
Case 1: bb bb
3 1
Case 1: bbbbab bbbbab
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 1 1
| ^
|
s480477568
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;
const int N = 66;
typedef unsigned long long ll;
ll n, m, f[N], cnt[N][4];
void init() {
ll p = 2;
f[0] = 1;f[1] = 1;
for(int i = 2; i < N; i++) {
p <<=1;
f[i] = p-f[i-1];
cnt[i][3] = f[i-2];
cnt[i][1] = cnt[i][0] = (f[i]-cnt[i][3])>>1;
cnt[i][2] =cnt[i][1]>>1;
cnt[i][1] -= cnt[i][2];
}
cnt[1][0] = 1;
}
void dfs(ll x, int len, string &s) {
if(!len) {
cout <<s;
return;
}
if(x==1) {
for(int i = 0; i < len; i++)
s += 'a';
cout<<s;
return;
}
if(x <= cnt[len][0]) {
s += "a";
dfs(x, len-1, s);
}
else if(x <= cnt[len][0]+cnt[len][1]) {
s += "ab";
dfs(x-cnt[len][0], len-2, s);
}
else if(x <= cnt[len][0]+cnt[len][1]+cnt[len][2]){
s += "abb";
dfs(x-cnt[len][0]-cnt[len][1], len-3, s);
}else {
s += "bb";
dfs(x-cnt[len][0]-cnt[len][1]-cnt[len][2], len-2, s);
}
}
void gao(ll a, ll b) {
a = a*n+b;
int i;
string s="";
for(i = 1; i < N; i++)
if(a > f[i]) a -= f[i];
else break;
dfs(a, i, s);
}
int main() {
init();
int i, j, ca=1;
while(cin>>n>>m) {
if(!n && !m) break;
cout<<"Case " << ca <<": ";
gao(m-1, 1); cout<<" ";
gao(m, 0); cout<<"\n";
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s761240471
|
p00000
|
C
|
49 46 45 28 27 26 25
48 47 44 29 32 33 24
5 6 43 30 31 34 23
4 7 42 41 40 35 22
3 8 13 14 39 36 21
2 9 12 15 38 37 20
1 10 11 16 17 18 19
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 49 46 45 28 27 26 25
| ^~
|
s271892451
|
p00000
|
C
|
#include <stdio.h>
int main()
{
__int64 i,j;
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
printf("%I64d*%I64d=%I64d\n",i,j,i*j);
}
return 0;
}
|
main.c: In function 'main':
main.c:4:9: error: unknown type name '__int64'; did you mean '__int64_t'?
4 | __int64 i,j;
| ^~~~~~~
| __int64_t
|
s710677390
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
const double eps = 1e-8;
struct Point {
double x, y;
Point operator-(const Point &t) const {
return (Point) {x-t.x, y-t.y};
}
}p[100005];
int n, m, k;
int cross(Point o, Point a, Point b) {
double t = (a.x-o.x)*(b.y-o.y)-(a.y-o.y)*(b.x-o.x);
if(fabs(t) < eps) return 0;
return t > 0 ? 1 : -1;
}
bool bin(Point &tp) {
int l = 0, r = n-1;
while(l < r) {
int m = l+r >> 1;
// int c1 = cross(tp, p[0], p[m]);
// int c2 = cross(tp, p[0], p[(m+1)%n]);
// int c3 = cross(tp, p[m], p[(m+1)%n]);
int c1 = cross(p[0], p[m], tp);
int c2 = cross(p[0], p[(m+1)%n], tp);
int c3 = cross(p[m], p[(m+1)%n], tp);
if(c1 >= 0 && c2 <= 0) {
if(c3 <= 0)return true;
else return false;
}
if(c1 > 0)
l = m+1;
else r = m;
}
Point a = p[l], b = p[(l+1)%n];
return cross(a, b, tp) ==0 && (tp.x-a.x)*(tp.x-b.x) <=0 && (tp.y-a.y)*(tp.y-b.y) <=0;
}
int main() {
int i;
while(~scanf("%d", &n)) {
for(i = n-1; i >=0; i--) {
getchar();
scanf("(%lf,%lf)", &p[i].x, &p[i].y);
}
int cnt = 0;
p[n] = p[0];
scanf("%d", &m);
while(m--) {
Point tp;
getchar();
scanf("(%lf,%lf)", &tp.x, &tp.y);
puts(bin(tp)? "Yes" : "No");
}
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s376181342
|
p00000
|
C
|
#include<stdio.h>
int main(){
int i,j;
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
printf("%d"+"x"+"%d"+"="+"%d",i,j,i*j);
}
}
return 0;
}
|
main.c: In function 'main':
main.c:6:14: error: invalid operands to binary + (have 'char *' and 'char *')
6 | printf("%d"+"x"+"%d"+"="+"%d",i,j,i*j);
| ~~~~^
| | |
| | char *
| char *
|
s097857964
|
p00000
|
C
|
#include <iostream>
#include<stdio.h>
using namespace std;
int main(){
while(1){
int i,j;
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
printf("%d*%d=%d\n",i,j,i*j);
}
}
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s017998896
|
p00000
|
C
|
include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=9;i++)
for(j=1;j<=9;j++)
printf("%dx%d=%d",i,j,i*j);
return 0;
}
|
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s712248894
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
using namespace std;
#define LL long long
#define eps 1e-8
#define mod 1000000007
struct node{
int a ,d ,b ;
}a[30];
int u[30] ;
void init(){
int n = 30 ;
for( int i = 0 ;i < n ;i ++ ){
if( i & 1 ) u[i] = 1 ;
else u[i] = -1 ;
}
}
long long gcd( long long a ,long long b ){
return b == 0 ? a : gcd( b ,a % b ) ;
}
long long lcm( long long a ,long long b ){
return a * b / gcd( a ,b ) ;
}
void exgcd( int a ,int b ,long long &x ,long long &y ,int c ){
if( !b ){
y = 0 ,x = c / a ;
return ;
}
exgcd( b ,a%b ,y ,x ,c ) ;
y -= a/b * x ;
}
bool uni( node a ,node b ,node &ret ){
if( b.d == 0 && a.d == 0 ){
ret = a ;
ret.b = min( a.b ,b.b ) ;
if( b.a != a.a ) return 0 ;
return 1 ;
}
if( b.d == 0 ){
if( ( b.a % a.d + a.d ) % a.d != ( a.a % a.d + a.d ) % a.d ) //
return 0 ;
ret.d = b.d ;
ret.b = min( a.b ,b.b ) ;
ret.a = b.a ;
return 1 ;
}
if( a.d == 0 ){
if( ( a.a % b.d + b.d ) % b.d != ( b.a % b.d + b.d ) % b.d ) //
return 0 ;
ret.d = a.d ;
ret.b = min( a.b ,b.b ) ;
ret.a = a.a ;
return 1 ;
}
ret.b = min( a.b ,b.b ) ;
long long x1 ,y1 ,x2 ,y2 ;
long long d = a.d / gcd( a.d ,b.d ) ;
exgcd( d ,b.d ,x1 ,y1 ,b.a ) ;
exgcd( b.d ,d ,x2 ,y2 ,a.a%d ) ;
long long L = lcm( a.d ,b.d ) ;
if( L > 2147483647LL ) return 0 ;
long long u = ( x1 * d + x2 * b.d ) % L ;
if( u < 0 ) u += L ;
if( ( u % d + d ) % d != ( a.a % d + a.d ) % d || ( u % b.d + b.d ) % b.d != ( b.a % b.d + b.d ) % b.d ) return 0 ; //
int k = ( max( a.a ,b.a ) - u ) / L ;
u += k * L ;
ret.a = u ,ret.d = L ;
return 1 ;
}
int cal( node tmp ){
if( tmp.d == 0 ){
if( tmp.b >= tmp.a ) return 1 ;
return 0 ;
}
if( tmp.b < tmp.a ) return 0 ;
return ( tmp.b - tmp.a ) / tmp.d + 1 ;
}
void solve( int n ){
int ans = 0 ;
for( int i = 1 ;i < (1<<n) ;i ++ ){
node tmp ;bool flag = 1 ;
int cnt = 0 ;
int j ;
int tans = 0 ;
for( j = 0 ;j < n ;j ++ )
if( (1<<j) & i ){
cnt = 1 ;
tmp = a[j] ;
// tans += cal( a[j] ) ;
break ;
}
for( j = j + 1;j < n ;j ++ ) if( (1<<j) & i ){
cnt ++ ;
if( !uni( tmp ,a[j] ,tmp ) ){ flag = 0 ;break ;}
// tans += cal( tmp ) ;
}
tans = cal( tmp ) ;
if( flag ) ans += tans * u[cnt] ;
}
cout << ans << endl ;
}
int main(){
int n ;
init() ;
while( scanf( "%d" ,&n ) && n ){
for( int i = 0 ;i < n ;i ++ ){
scanf( "%d %d %d" ,&a[i].a ,&a[i].b ,&a[i].d ) ;
}
solve( n ) ;
}
}
|
main.c:10:10: fatal error: iostream: No such file or directory
10 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.