submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s571249166
|
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\n", i, j, i*j);
return 0;
}
|
main.c: In function 'main':
main.c:10:1: error: expected declaration or statement at end of input
10 | }
| ^
main.c:10:1: error: expected declaration or statement at end of input
|
s611183347
|
p00000
|
C
|
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <cstring>
using namespace std;
const double eps = 1e-8;
const double PI = acos(-1.0);
int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0;}
double sqr(double x) { return x*x; }
//ツカテセテ篠ャツオテ」
struct pt
{
double x,y;
pt(double _x = 0,double _y = 0) { x = _x; y = _y;}
pt operator + (const pt &a) const { return pt(x+a.x, y+a.y);}
pt operator - (const pt &a) const { return pt(x-a.x, y-a.y);}
pt operator * (const double r) const { return pt(x * r, y * r);}
pt operator / (const double r) const { return pt(x / r, y / r);}
bool operator == (const pt &a) const { return sgn(x-a.x) == 0 && sgn(y-a.y) == 0; }
double len() { return sqrt(x*x + y*y); }
double ang() { return atan2(y, x); }
pt unit() { double l = len(); return pt(x/l, y/l); }
pt per() { return pt(-y, x); }
void rd() { scanf("%lf%lf",&x,&y);}
void write() { printf("(%.2f, %.2f) ",x, y); }
};
bool CompareByX(const pt &a, const pt &b) {
return sgn(a.x - b.x) < 0 || (sgn(a.x - b.x) == 0 && sgn(a.y - b.y) < 0);
}
bool CompareByY(const pt &a, const pt &b) {
return sgn(a.y - b.y) < 0 || (sgn(a.y - b.y) == 0 && sgn(a.x - b.x) < 0);
}
double det(const pt &a,const pt &b) { return a.x*b.y - a.y*b.x; }
double dot(const pt &a,const pt &b) { return a.x*b.x + a.y*b.y; }
double dis(const pt &a,const pt &b) { return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));}
///////////////////////
const V = 100000 + 10;
int n;
pt p[V];
double closest_pair_point_distance(int l, int r)
{
vector<pt> back_up;
int mid = (l + r) / 2;
double min_left = closest_pair_point_distance(l, mid);
double min_right = closest_pair_point_distance(mid+1, r);
double min_all = min(min_left, min_right);
sort(p+l, p+mid+1, CompareByY);
sort(p+mid+1, p+r+1, CompareByY);
}
int main()
{
while (cin >> n)
{
for (int i = 0; i < n; i++)
p[i].read();
sort(p, p+n, CompareByX);
cout << closest_pair_point_distance(0, n-1);
}
}
|
main.c:2:10: fatal error: iostream: No such file or directory
2 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s658396664
|
p00000
|
C
|
//#include<cstdio>
//#include <algorithm>
//#include <cstdlib>
//
//using namespace std;
//
//typedef long long LL;
//
//struct st
//{
// LL x,y;
//}p[100010];
//
//LL a[100010],b[100010];
//
//int res[100010];
//int cnt;
//LL maxi;
//
//int xl,xr,yl,yr;
//
//LL judge(int x,int y)
//{
// if(xl <= x && x<=xr && yl<=y && y<=yr)
// return 0;
//
// LL ret = 0;
// if(x < xl) ret += xl-x;
// if(x > xr) ret += x - xr;
// if(y < yl) ret += yl-y;
// if(y > yr) ret += y - yr;
// return ret;
//}
//
//
//int T,n;
//int main()
//{
// scanf("%d",&T);
// while(T--)
// {
// scanf("%d",&n);
// for(int i=1; i<=n; i++)
// {
// scanf("%I64d%I64d",&p[i].x,&p[i].y);
// a[i] = p[i].x,b[i] = p[i].y;
// }
// sort(a+1,a+1+n);
// sort(b+1,b+1+n);
//
//
// if(n%2 == 1)
// {
// xl = xr = a[(n+1)/2];
// yl = yr = b[(n+1)/2];
// }
// else
// {
// xl = a[n/2],xr = a[n/2+1];
// yl = b[n/2];yr = b[n/2+1];
// }
//
// cnt = 0;
// maxi = 1000000000000LL;
// for(int i=1; i<=n; i++)
// {
// LL d = judge(p[i].x,p[i].y);
// if(d < maxi)
// {
// maxi = d;
// cnt = 0;
// res[++cnt] = i;
// }
// else if(d == maxi)
// res[++cnt] = i;
// }
//
// LL ans = 1000000000000LL;
// for(int i=1; i<=cnt; i++)
// {
// LL tmp = 0;
// for(int j=1; j<=n; j++)
// tmp += abs(p[i].x-p[j].x) + abs(p[i].y - p[j].y);
// ans = min(tmp,ans);
// }
// printf("%I64d\n",ans);
//
//
//
//
// }
//
//}
//
//
//
|
/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
|
s243568561
|
p00000
|
C
|
#include <iostream>
#include <algorithm>
#include <string.h>
#include <cstdio>
#include <vector>
#define eps 1e-8
using namespace std;
struct EDG
{
int xx, val;
EDG(int _xx, int _val)
{
xx = _xx, val = _val;
}
};
const int maxn = 100007, maxnum = 100000000, maxzz = 1000000;
int n, S, T, power;
double dist[maxn];
int zz[maxzz];
bool use[maxn];
vector<EDG> edg[maxn];
void spfa(int S, int power)
{
for (int i = 1; i <= n; i++) dist[i] = -maxnum, use[i] = false;
int head = 1, tail = 1;
zz[head] = S;
dist[zz[head]] = power, use[zz[head]] = true;
while (head <= tail)
{
int x = zz[head];
use[x] = false;
if (dist[x] < dist[T])
{
head++;
continue;
}
for (int i = 0; i < edg[x].size(); i++)
{
int xx = edg[x][i].xx, val = edg[x][i].val;
if (dist[xx] < dist[x]*val/100)
{
dist[xx] = dist[x]*val/100;
if (!use[xx]) use[xx] = true, zz[++tail] = xx;
}
}
head++;
}
}
void work()
{
for (int i = 1; i <= n; i++) edg[i].clear();
for (int x = 1; x <= n; x++)
{
int k;
scanf("%d", &k);
for (int i = 1; i <= k; i++)
{
int xx, val;
scanf("%d%d", &xx, &val);
val = 100-val;
edg[x].push_back(EDG(xx, val));
}
}
scanf("%d%d%d", &S, &T, &power);
spfa(S, power);
double res = power-dist[T];
if (res < eps) puts("IMPOSSIBLE!");
else printf("%.2f\n", res);
}
int main()
{
while (scanf("%d", &n) != EOF) work();
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s573456738
|
p00000
|
C
|
#include <iostream>
#include <algorithm>
#include <string.h>
#include <cstdio>
#include <vector>
#define eps 1e-8
using namespace std;
struct EDG
{
int xx, val;
EDG(int _xx, int _val)
{
xx = _xx, val = _val;
}
};
const int maxn = 50007, maxnum = 100000000, maxzz = 1000000;
int n, S, T, power;
double dist[maxn];
int zz[maxzz+7];
bool use[maxn];
vector<EDG> edg[maxn];
void spfa(int S, int power)
{
for (int i = 1; i <= n; i++) dist[i] = -maxnum, use[i] = false;
int head = 1, tail = 1;
zz[head] = S;
dist[zz[head]] = power, use[zz[head]] = true;
while (head != tail+1)
{
int x = zz[head];
use[x] = false;
if (dist[x] < dist[T])
{
if (++head > maxzz) head = 1;
continue;
}
for (int i = 0; i < edg[x].size(); i++)
{
int xx = edg[x][i].xx, val = edg[x][i].val;
if (dist[xx] < dist[x]*val/100)
{
dist[xx] = dist[x]*val/100;
if (!use[xx])
{
use[xx] = true;
if (++tail > maxzz) tail = 1;
zz[tail] = xx;
}
}
}
head++;
}
}
void work()
{
for (int i = 1; i <= n; i++) edg[i].clear();
for (int x = 1; x <= n; x++)
{
int k;
scanf("%d", &k);
for (int i = 1; i <= k; i++)
{
int xx, val;
scanf("%d%d", &xx, &val);
val = 100-val;
edg[x].push_back(EDG(xx, val));
}
}
scanf("%d%d%d", &S, &T, &power);
spfa(S, power);
double res = power-dist[T];
if (res < eps) puts("IMPOSSIBLE!");
else printf("%.2f\n", res);
}
int main()
{
while (scanf("%d", &n) != EOF) work();
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s789325507
|
p00000
|
C
|
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,n;
for(i=1;i<=9;++i)
{
for(j=1;j<=9;++j)
{
printf("%d\n\n",i*j);
n=n*1;
n=n+1;
}
}
getch();
return 0;
}
|
main.c:2:9: fatal error: conio.h: No such file or directory
2 | #include<conio.h>
| ^~~~~~~~~
compilation terminated.
|
s488207373
|
p00000
|
C
|
#include<iostream>
#include<algorithm>
using namespace std;
#define lson u<<1
#define rson u<<1|1
#define MAXN 50005
struct Node{
int lef,rig;
int lsom,msum,rsom;//lsom隶ー蠖募玄髣エ蟾ヲ遶ッ譛?、ァ遨コ逋ス蛹コ?罫som隶ー蠖募承遶ッ?稽sum隶ー蠖墓紛荳ェ蛹コ髣エ譛?、ァ遨コ逋ス蛹コ
}T[MAXN<<2];
void Build(int u,int l,int r){
T[u].lef=l;
T[u].rig=r;
T[u].lsom=T[u].rsom=T[u].msum=r-l+1;
if(l==r)return;
int mid=(l+r)>>1;
Build(lson,l,mid);
Build(rson,mid+1,r);
}
void Check_in(int u,int size){
if(T[u].lsom>=size){}
}
int main(){}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s852037476
|
p00000
|
C
|
/*========================================
prim邂玲ウ穂ク堺サ?サ?庄莉・豎よ怙蟆冗函謌先??御ケ溷庄莉・豎や?譛?、ァ逕滓?譬鯛?縲よ怙蟆丞牡髮?toer-Wagner邂玲ウ募ーア譏ッ蜈ク蝙狗噪蠎皮畑螳樔セ九?
豎りァ」譛?ー丞牡髮?勸驕埼?逕ィStoer-Wagner邂玲ウ包シ御ク肴署萓帶ュ、邂玲ウ戊ッ∵?蜥御サ」遐?シ悟宵謠蝉セ帷ョ玲ウ墓?霍ッ??
1.min=MAXINT?悟崋螳壻ク?クェ鬘カ轤ケP
2.莉守せP逕ィ邀サ莨シprim逧г邂玲ウ墓黄螻募?窶懈怙螟ァ逕滓?譬鯛??瑚ョー蠖墓怙蜷取黄螻慕噪鬘カ轤ケ蜥梧怙蜷取黄螻慕噪霎ケ
3.隶。邂玲怙蜷取黄螻募芦逧?。カ轤ケ逧??蜑イ蛟シ?亥叉荳取ュ、鬘カ轤ケ逶ク霑樒噪謇?怏霎ケ譚?柱?会シ瑚凶豈芭in蟆乗峩譁ーmin
4.蜷亥ケカ譛?錘謇ゥ螻慕噪驍」譚。霎ケ逧?ク、荳ェ遶ッ轤ケ荳コ荳?クェ鬘カ轤ケ?亥ス鍋┯莉紋サャ逧?セケ荵溯ヲ∝粋蟷カ?瑚ソ吩クェ螂ス逅?ァ」蜷ァ?滂シ?
5.霓ャ蛻ー2?悟粋蟷カN-1谺。蜷守サ捺據
6.min蜊ウ荳コ謇?アゑシ瑚セ灘?min
prim譛ャ霄ォ螟肴揩蠎ヲ譏ッO(n^2)?悟粋蟷カn-1谺。?檎ョ玲ウ募、肴揩蠎ヲ蜊ウ荳コO(n^3)
螯よ棡蝨ィprim荳ュ蜉??莨伜喧?悟、肴揩蠎ヲ莨夐剄荳コO((n^2)logn) 縲?
========================================*/
/*
豁、鬚俶弍 譌?髄蝗セ 蜈ィ螻?怙蟆丞牡s-w邂玲ウ慕噪 荳?クェ蠕亥・ス逧?コ皮畑
證エ蜉帛悉髯、荳?クェ轤ケ?檎┯蜷取アょ?莉也せ逧?怙蟆丞牡縲?
蜑イ霎ケ髮??螳槫ーア譏ッ maxv轤ケ逧?桷謌?蜥?W髮?粋荳ュ逧?せ
逶ク霑樒噪霎ケ?檎┯蜷?maxv轤ケ逧?桷謌?謌台スソ逕ィ莠?ケカ譟・髮?シ瑚ソ呎?蟆ア蜿ッ莉・蛻、譁ュ荳、荳ェ髮?粋莠?シ御サ手?譖エ譁ー蜑イ霎ケ縲?
*/
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
const int maxn=100;
const int maxm=maxn*maxn;
const int INFI=999999999;
struct data
{
int id,v;
} edge[maxn][maxn],bak[maxn][maxn];
bool use[maxm];
int node[maxm],dist[maxm],root[maxm],fa[maxm];
int put[maxn*maxn];
int n,m,ans;
int find(int v)
{
if ( fa[v]!=v )
fa[v]=find(fa[v]);
return fa[v];
}
void updata(int x,int v)
{
int len=0;
for (int i=1;i<=n;i++)
root[i] = find(i);
for (int i=1;i<=n;i++)
if ( root[i]==root[v] && i!=x )
for (int j=1;j<=n;j++)
if ( root[j]!=root[v] && edge[i][j].id>0 && j!=x )
put[++len]=bak[i][j].id;
put[0]=len;
}
void Union(int a,int b)
{
if (find(a) != find(b))
fa[find(a)] = find(b);
}
void prim(int x)
{
int len=0,S;
for (int i=1;i<=n;i++)
{
if (i != x)
node[++len]=i;
fa[i]=i;
}
while ( len>1 )
{
S = node[1];
for (int i=1;i<=len;i++)
{
dist[ node[i] ] = edge[S][node[i]].v;
use[i] = false;
}
use[1] = 1;
int maxv = 1, prev;
for (int tt=2;tt<=len;tt++)
{
int maxd = -INFI;
prev = maxv;
for (int i=1;i<=len;i++)
if (!use[i] && dist[node[i]] > maxd)
{
maxd = dist[node[i]];
maxv = i;
}
use[maxv] = true;
for (int i=1;i<=len;i++)
if ( !use[i] )
dist[node[i]] += edge[ node[maxv] ][node[i]].v;
}
if (dist[node[maxv]] < ans)
{
ans = dist[node[maxv]];
updata(x,node[maxv]);
}
for (int i=1;i<=len;i++)
edge[node[i]][node[prev]].v = edge[node[prev]][node[i]].v += edge[node[maxv]][node[i]].v;
Union(node[prev], node[maxv]);
node[maxv] = node[len--];
}
}
int main()
{
int a,b,c;
scanf("%d%d",&n,&m);
memset(edge,0,sizeof(edge));
for (int i=1;i<=m;i++)
{
scanf("%d%d%d",&a,&b,&c);
edge[a][b].id = i;
edge[a][b].v = +c;
edge[b][a].id = i;
edge[b][a].v = +c;
}
memcpy(bak,edge,sizeof(edge));
ans = INFI;
for (int i=1;i<=n;i++)
{
memcpy(edge,bak,sizeof(bak));
prim(i);
}
sort(put+1,put+put[0]+1);
printf("%d\n",ans);
printf("%d\n",put[0]);
for (int i=1;i<=put[0];i++)
{
if ( i<put[0] )
printf("%d ",put[i]);
else
printf("%d",put[i]);
}
printf("\n");
}
|
main.c:21:9: fatal error: algorithm: No such file or directory
21 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s269489873
|
p00000
|
C
|
1 1
2 1
3 1
4 0
5 0
6 0
7 0
8 0
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 0
17 0
18 0
19 0
20 0
21 0
22 0
23 0
24 0
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 0
37 0
38 0
39 0
40 0
41 0
42 0
43 0
44 0
45 0
46 0
47 0
48 0
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 0
65 0
66 0
67 0
68 0
69 0
70 0
71 0
72 0
73 0
74 0
75 0
76 0
77 0
78 0
79 0
80 0
81 1
82 1
83 1
84 1
85 1
86 1
87 1
88 1
89 1
90 1
91 1
92 1
93 1
94 1
95 1
96 1
97 1
98 1
99 1
100 0
101 0
102 0
103 0
104 0
105 0
106 0
107 0
108 0
109 0
110 0
111 0
112 0
113 0
114 0
115 0
116 0
117 0
118 0
119 0
120 0
121 1
122 1
123 1
124 1
125 1
126 1
127 1
128 1
129 1
130 1
131 1
132 1
133 1
134 1
135 1
136 1
137 1
138 1
139 1
140 1
141 1
142 1
143 1
144 0
145 0
146 0
147 0
148 0
149 0
150 0
151 0
152 0
153 0
154 0
155 0
156 0
157 0
158 0
159 0
160 0
161 0
162 0
163 0
164 0
165 0
166 0
167 0
168 0
169 1
170 1
171 1
172 1
173 1
174 1
175 1
176 1
177 1
178 1
179 1
180 1
181 1
182 1
183 1
184 1
185 1
186 1
187 1
188 1
189 1
190 1
191 1
192 1
193 1
194 1
195 1
196 0
197 0
198 0
199 0
200 0
201 0
202 0
203 0
204 0
205 0
206 0
207 0
208 0
209 0
210 0
211 0
212 0
213 0
214 0
215 0
216 0
217 0
218 0
219 0
220 0
221 0
222 0
223 0
224 0
225 1
226 1
227 1
228 1
229 1
230 1
231 1
232 1
233 1
234 1
235 1
236 1
237 1
238 1
239 1
240 1
241 1
242 1
243 1
244 1
245 1
246 1
247 1
248 1
249 1
250 1
251 1
252 1
253 1
254 1
255 1
256 0
257 0
258 0
259 0
260 0
261 0
262 0
263 0
264 0
265 0
266 0
267 0
268 0
269 0
270 0
271 0
272 0
273 0
274 0
275 0
276 0
277 0
278 0
279 0
280 0
281 0
282 0
283 0
284 0
285 0
286 0
287 0
288 0
289 1
290 1
291 1
292 1
293 1
294 1
295 1
296 1
297 1
298 1
299 1
300 1
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 1 1
| ^
|
s199294673
|
p00000
|
C
|
void RectangularArea()
{
int i;
high[0] = high[n + 1] = -1; //蛻晏ァ句喧霎ケ逡鯉シ碁亟豁「雜顔阜蛻、髞?
for (i = 1; i <= n; i ++) //謚獲eft[], right[]襍句?荳コ譛ャ霄ォ
left[i] = right[i] = i;
for (i = 1; i <= n; i ++)
{
while(high[left[i] - 1] >= high[i]) //遑ョ螳嗟[i]逧?怙鬮伜キヲ菴咲スョ
left[i] = left[left[i] - 1];
}
for (i = n; i >= 1; i --)
{
while (high[right[i] + 1] >= high[i]) //遑ョ螳嗷[i]逧?怙鬮伜承菴咲スョ
right[i] = right[right[i] + 1];
}
int ans = 0;
for (i = 1; i <= n; i ++)
ans = Max(high[i] * (right[i] - left[i] + 1), ans); //蠕怜芦譛?、ァ逧?ソ樒サュ遏ゥ蠖「髱「遘ッ?亥黒菴埼柄蠎ヲ譏ッ1??
printf("%d\n", ans);
}
|
main.c: In function 'RectangularArea':
main.c:4:5: error: 'high' undeclared (first use in this function)
4 | high[0] = high[n + 1] = -1; //蛻晏ァ句喧霎ケ逡鯉シ碁亟豁「雜顔阜蛻、髞?
| ^~~~
main.c:4:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:20: error: 'n' undeclared (first use in this function)
4 | high[0] = high[n + 1] = -1; //蛻晏ァ句喧霎ケ逡鯉シ碁亟豁「雜顔阜蛻、髞?
| ^
main.c:7:9: error: 'left' undeclared (first use in this function)
7 | left[i] = right[i] = i;
| ^~~~
main.c:7:19: error: 'right' undeclared (first use in this function)
7 | left[i] = right[i] = i;
| ^~~~~
main.c:21:15: error: implicit declaration of function 'Max' [-Wimplicit-function-declaration]
21 | ans = Max(high[i] * (right[i] - left[i] + 1), ans); //蠕怜芦譛?、ァ逧?ソ樒サュ遏ゥ蠖「髱「遘ッ?亥黒菴埼柄蠎ヲ譏ッ1??
| ^~~
main.c:22:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
22 | printf("%d\n", ans);
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | void RectangularArea()
main.c:22:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
22 | printf("%d\n", ans);
| ^~~~~~
main.c:22:5: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s289853614
|
p00000
|
C
|
#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#define N 1010
#define mod 100000007
#define LL __int64
using namespace std;
//const int maxn=1000010;
//LL a,b;
//int T,cnt=0;
//bool isprm[maxn];
//int prm[maxn];
//
//int main()
//{
// memset(isprm,1,sizeof(isprm));
// for(int i=2;i<maxn;i++) if(isprm[i])
// {
// for(int j=i+i;j<maxn;j+=i) isprm[j]=0;
// prm[cnt++]=i;
// }
// scanf("%d",&T);
// int cas=1;
// while(T--)
// {
// scanf("%I64d%I64d",&a,&b);
// int lim=min(sqrt(a*1.0),sqrt(b*1.0))+1;
// bool fg=1;
// for(int i=0;prm[i]<=lim;i++)
// {
// if(a%prm[i]==0||b%prm[i]==0)
// {
// if(a%prm[i]==0&&b%prm[i]==0)
// {
// while(a%prm[i]==0) a/=prm[i];
// while(b%prm[i]==0) b/=prm[i];
// }
// else fg=0;
// }
// }
// if(a!=b) fg=0;
// printf("Case #%d: %s\n",cas++,fg?"YES":"NO");
// }
// return 0;
//}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s144486658
|
p00000
|
C
|
# include <cstring>
# include <cstdio>
# include <cstdlib>
# include <iostream>
using namespace std;
# define N 2000
char s[N][15];
int dp[15][15];
int len[N];
inline int abss (int x)
{
return x>0?x:-x;
}
int main (void)
{
int t,ys=0,n,m;
scanf("%d",&t);
for (int i=1;i<=11;i++)
dp[0][i]=dp[i][0]=i;
while (t--)
{
scanf("%d%d",&n,&m);
for (int i=1;i<=n;i++)
{
scanf("%s",s[i]+1);
len[i]=strlen(s[i]+1);
}
char ss[15];
int k;
printf("Case #%d:\n",++ys);
while (m-->0)
{
scanf("%s%d",ss+1,&k);
int ans=0,len1=strlen(ss+1);
for (int i=1;i<=n;i++)
{
if (k>=max(len1,len[i]))
{
ans++;
continue;
}
if (k<abss(len1-len[i]))
continue;
int flag=1;
for (int x=1;x<=len[i] && flag;x++)
for (int y=1;y<=len1 && flag;y++)
{
if (s[i][x]==ss[y])
dp[x][y]=dp[x-1][y-1];
else
{
dp[x][y]=min(dp[x-1][y],dp[x][y-1])+1;
dp[x][y]=min(dp[x][y],dp[x-1][y-1]+1);
}
if (max(len[i]-x,len1-y)<=k-dp[x][y])
{
ans++;
flag=0;
}
}
if (flag)
ans++;
}
printf("%d\n",ans);
}
}
return 0;
}
|
main.c:1:11: fatal error: cstring: No such file or directory
1 | # include <cstring>
| ^~~~~~~~~
compilation terminated.
|
s259070272
|
p00000
|
C
|
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include<string.h>
using namespace std;
const int N = 2010;
int r[N*2],l[N*2],h[N*2];
char map[N][N];
inline int cal(int l,int r)
{
return r/2-(l-1)/2;
}
int rec(int h[],int n,int flag)
{
h[0]=h[n+1]=-1;
for(int i=1;i<=n;i++)l[i]=r[i]=i;
for(int i=1;i<=n;i++){
while(h[l[i]-1]>=h[i]){l[i]=l[l[i]-1];}
}
for(int i=n;i>=1;i--){
while(h[r[i]+1]>=h[i])r[i]=r[r[i]+1];
}
int ans=0;
if(flag==0){
for(int i=1;i<=n;i++){
if(h[i]==0)continue;
ans = max(h[i]*2+(r[i]-l[i]+1)*2,ans);
}
}
else{
for(int i=1;i<=n;i++){
if(h[i]==0)continue;
ans = max(h[i]*2+(r[i]-l[i]+1-cal(l[i],r[i]))*2,ans);
}
}
return ans;
}
int solve1(int r,int c,char v)
{
int ans=0;
for(int i=1;i<=c;i++)h[i]=0;
for(int i=1;i<=r;i++){
for(int j=1;j<=c;j++)if(map[i][j]==v)h[j]++;else h[j]=0;
for(int j=1;j<=c;j++)printf("%d ",h[j]);printf("\n");
ans=max(ans,rec(h,c,0));
}
printf("%d\n",ans);
return ans;
}
int solve2(int r,int c)
{
int ans=0,up=2*c-1;
for(int i=1;i<=up;i++)h[i]=0;
for(int i=1;i<=r;i++){
for(int j=1;j<=c;j++)
if(i==1||map[i][j]!=map[i-1][j])h[j*2-1]++;
else h[j*2-1]=1;
for(int j=1;j<c;j++)
if(map[i][j]!=map[i][j+1])h[j*2]++;
else h[j*2]=0;
for(int j=1;j<=up;j++)printf("%d ",h[j]);printf("\n");
ans=max(ans,rec(h,up,1));
}
printf("%d\n",ans);
return ans;
}
int main()
{
int t,r,c;
scanf("%d",&t);
for(int cs=1;cs<=t;cs++){
scanf("%d %d",&r,&c);
for(int i=1;i<=r;i++)scanf("%s",map[i]+1);
int ans=solve1(r,c,'B');
ans=max(ans,solve1(r,c,'R'));
ans=max(ans,solve2(r,c));
printf("Case #%d: %d\n",cs,ans);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s777351930
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <algorithm>
#define MAX (1<<18)
#define M (1<<17)
using namespace std;
struct Node {
int l[2],r[2],m[2],sum[2];
int op;
} Tree[MAX];
void push_up(int s) {
for(int i(0);i!=2;++i) {
Tree[s].sum[i] = Tree[s<<1].sum[i]+Tree[s<<1^1].sum[i];
if(Tree[s<<1].sum[i^1]==0) Tree[s].l[i] = Tree[s<<1].l[i]+Tree[s<<1^1].l[i];
else Tree[s].l[i] = Tree[s<<1].l[i];
if(Tree[s<<1^1].sum[i^1]==0) Tree[s].r[i] = Tree[s<<1^1].r[i]+Tree[s<<1].r[i];
else Tree[s].r[i] = Tree[s<<1^1].r[i];
Tree[s].m[i] = max(max(Tree[s<<1].m[i],Tree[s<<1^1].m[i]),Tree[s<<1].r[i]+Tree[s<<1^1].l[i]);
}
}
void add(int s,bool val) {
s+=M;
Tree[s].l[0] = Tree[s].r[0] = Tree[s].sum[0] = val^1;
Tree[s].l[1] = Tree[s].r[1] = Tree[s].sum[1] = val;
for(s>>=1;s;s>>=1)
push_up(s);
}
void _change(int s,bool val) {
int good = Tree[s].sum[0]+Tree[s].sum[1],bad(0);
if(val) swap(good,bad);
Tree[s].l[0] = Tree[s].r[0] = Tree[s].m[0] = Tree[s].sum[0] = good;
Tree[s].l[1] = Tree[s].r[1] = Tree[s].m[1] = Tree[s].sum[1] = bad;
}
void _rev(int s) { //3^3==0 1^3==2 2^3==1 0^3==3
Tree[s].op^=3;
if(Tree[s].op==1 || Tree[s].op==2) {
_change(s,Tree[s].op-1);
return;
}
swap(Tree[s].sum[0],Tree[s].sum[1]);
swap(Tree[s].l[0],Tree[s].l[1]);
swap(Tree[s].r[0],Tree[s].r[1]);
swap(Tree[s].m[0],Tree[s].m[1]);
}
void push_down(int s) {
int op = Tree[s].op;
Tree[s].op = 0;
if(s>=M) return;
if(op==1 || op==2)
Tree[s<<1].op = Tree[s<<1^1].op = op, _change(s<<1,op-1), _change(s<<1^1,op-1);
if(op==3)
_rev(s<<1), _rev(s<<1^1);
}
void force(int s,int t) {
s = s+M-1; t = t+M+1;
for(int i = M;i;i>>=1)
push_down(s/i), push_down(t/i);
}
void change(int s,int t,bool val) {
force(s,t);
for(s = s+M-1,t = t+M+1;s^t^1;s>>=1,t>>=1) {
if(~s&1) Tree[s^1].op = val+1, _change(s^1,val);
if( t&1) Tree[t^1].op = val+1, _change(t^1,val);
push_up(s>>1); push_up(t>>1);
}
while(s) push_up(s>>=1);
}
void rev(int s,int t) {
force(s,t);
for(s = s+M-1,t = t+M+1;s^t^1;s>>=1,t>>=1) {
if(~s&1) _rev(s^1);
if( t&1) _rev(t^1);
push_up(s>>1); push_up(t>>1);
}
while(s) push_up(s>>=1);
}
int query_sum(int s,int t) {
force(s,t);
int ret(0);
for(s = s+M-1,t = t+M+1;s^t^1;s>>=1,t>>=1) {
if(~s&1) ret+=Tree[s^1].sum[1];
if( t&1) ret+=Tree[t^1].sum[1];
}
return ret;
}
int query_len(int s,int t) {
force(s,t);
int llen(0),rlen(0),mmax(0);
for(s = s+M-1,t = t+M+1;s^t^1;s>>=1,t>>=1) {
if(~s&1) {
mmax = max(mmax,max(Tree[s^1].m[1],llen+Tree[s^1].l[1]));
if(Tree[s^1].sum[0]==0) llen+=Tree[s^1].l[1];
else llen = Tree[s^1].r[1];
}
if( t&1) {
mmax = max(mmax,max(Tree[t^1].m[1],rlen+Tree[t^1].r[1]));
if(Tree[t^1].sum[0]==0) rlen+=Tree[t^1].r[1];
else rlen = Tree[t^1].l[1];
}
}
mmax = max(mmax,llen+rlen);
return mmax;
}
int main() {
int t;
for(cin>>t;t;--t) {
for(int i(0);i!=MAX;++i)
for(int j(0);j!=2;++j)
Tree[i].l[j] = Tree[i].r[j] = Tree[i].m[j] = Tree[i].sum[j] = Tree[i].op = 0;
int n,q;
cin>>n>>q;
for(int i(0),tmp;i!=n;++i) {
scanf("%d",&tmp);
add(i+1,tmp);
}
for(int i(0),op,s,t;i!=q;++i) {
scanf("%d%d%d",&op,&s,&t);
if(op==0 || op==1) change(s+1,t+1,op);
if(op==2) rev(s+1,t+1);
if(op==3) cout<<query_sum(s+1,t+1)<<'\n';
if(op==4) cout<<query_len(s+1,t+1)<<'\n';
}
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s504517546
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
#define N 300
typedef long long LL;
LL a[10][N];
LL val1[N*N],val2[N*N];
int main()
{
int t,n;
// freopen("d.in","r",stdin);
scanf("%d",&t);
for(int cas=1;cas<=t;cas++)
{
scanf("%d",&n);
for(int i=0;i<5;i++)
for(int j=0;j<n;j++)
scanf("%I64d",&a[i][j]);
int cnt=0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
val1[cnt++]=a[1][i]+a[2][j];
cnt=0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
val2[cnt++]=a[3][i]+a[4][j];
sort(val1,val1+cnt);
sort(val2,val2+cnt);
int l1=unique(val1,val1+cnt)-val1;
int l2=unique(val2,val2+cnt)-val2;
// for(int i=0;i<l1;i++) cout<<val1[i]<<' ';
// puts("");
// for(int i=0;i<l2;i++) cout<<val2[i]<<' ';
// puts("");
bool f=1;
LL tmp;
for(int i=0;i<n&&f;i++){
int id=-1;
for(int j=0;j<l1&&f;j++)
{
LL tmp=val1[j]+a[0][i];
if(id==-1) id=lower_bound(val2,val2+l2,-tmp)-val2;
else {
while(val2[id]<tmp&&id<l2) id++;
}
if(val2[id]==-tmp&&id!=l2) f=0;
}
}
if(!f) puts("YES");
else puts("NO");
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s255996478
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
const int N = 205;
typedef long long ll;
int a[5][N],rd,ed;
ll q[N*N*20];
int u[N*N*20];
int f(ll v)
{
int rt=(v%rd)*(v%rd+1)%rd;
if(rt<0)rt+=rd;
return rt;
}
void hash(int x,ll v)
{
if(u[x]==-1)
{
u[x]=0;
q[x]=v;
return;
}
while(u[x]!=0)
x=u[x];
u[x]=ed;
x=u[x];
ed++;
u[x]=0;
q[x]=v;
}
bool find(int x,ll v)
{
if(u[x]==-1)
return false;
if(q[x]==v)
return true;
while(u[x]!=0)
{
x=u[x];
if(q[x]==v)
return true;
}
return false;
}
int main()
{
int T,n,i,j,k;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
for(i=0;i<5;i++)
{
for(j=0;j<n;j++)scanf("%d",&a[i][j]);
}
//puts("ok");
rd=(n*n+1)*10;
ed=rd;
memset(u,-1,sizeof(u));
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
ll v=a[0][i]+a[1][j];
int tp=f(v);
hash(tp,v);
//printf("i:%d j:%d v:%lld \n",i,j,v);
}
}
int flag=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
for(k=0;k<n;k++)
{
ll v=a[2][i]+a[3][j]+a[4][k];
int tp=f(v);
flag=find(tp,v);
//printf("i:%d j:%d k:%d v:%lld flag:%d \n",i,j,k,v,flag);
if(flag)break;
}
if(flag)break;
}
if(flag)break;
}
if(flag)puts("Yes");
else puts("No");
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s515851861
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
#define maxn 201001
int wa[maxn],wb[maxn],wv[maxn],WS[maxn];
int cmp(int *r,int a,int b,int l)
{
return r[a]==r[b]&&r[a+l]==r[b+l];
}
void da(int *r,int *sa,int n,int m)
{
int i,j,p,*x=wa,*y=wb,*t;
for(i=0;i<m;i++)WS[i]=0;
for(i=0;i<n;i++)WS[x[i]=r[i]]++;
for(i=1;i<m;i++)WS[i]+=WS[i-1];
for(i=n-1;i>=0;i--)sa[--WS[x[i]]]=i;
for(j=1,p=1;p<n;j*=2,m=p)
{
for(p=0,i=n-j;i<n;i++)y[p++]=i;
for(i=0;i<n;i++)if(sa[i]>=j)y[p++]=sa[i]-j;
for(i=0;i<n;i++)wv[i]=x[y[i]];
for(i=0;i<m;i++)WS[i]=0;
for(i=0;i<n;i++)WS[wv[i]]++;
for(i=1;i<m;i++)WS[i]+=WS[i-1];
for(i=n-1;i>=0;i--)sa[--WS[wv[i]]]=y[i];
for(t=x,x=y,y=t,p=1,x[sa[0]]=0,i=1;i<n;i++)
x[sa[i]]=cmp(y,sa[i-1],sa[i],j)?p-1:p++;
}
return ;
}
int rank[maxn],height[maxn];
void calheight(int *r,int *sa,int n)
{
int i,j,k=0;
for(i=1;i<=n;i++)rank[sa[i]]=i;
for(i=0;i<n;height[rank[i++]]=k)
for(k?k--:0,j=sa[rank[i]-1];r[i+k]==r[j+k];k++);
return ;
}
char str[maxn],s[maxn];
int arr[maxn],SA[maxn];
int main()
{
int T,i,ca=1;
scanf("%d",&T);
while(T--)
{
scanf("%s",str);
s[0]='\0';
strcat(s,str);
strcat(s,str);
int n=strlen(s);
for(i=0;i<n;i++)arr[i]=s[i];
arr[n]=0;
da(arr,SA,n+1,500);
calheight(arr,SA,n);
/*for(i=0;i<=n;i++)
{
printf("i:%d height:%d SA:%d rank:%d \n",i,height[i],SA[i],rank[i]);
}*/
int id=rank[0],r1,r2,r3;
r1=r2=r3=0;
for(i=id-1;i>=0;i--)
{
if(height[i+1]<n/2)break;
if(SA[i]<n/2)r2++;
}
for(;i>=0;i--)
{
if(SA[i]<n/2)r1++;
}
for(i=id+1;i<=n;i++)
{
if(height[i]<n/2)break;
if(SA[i]<n/2)r2++;
}
for(;i<=n;i++)
{
if(SA[i]<n/2)r3++;
}
printf("Case %d: %d %d %d\n",ca++,r1,r2+1,r3);
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s726109134
|
p00000
|
C
|
//#include<stdio.h>
//#include<algorithm>
//#include<string.h>
//#include<vector>
//#include<math.h>
//struct TPoint {
// double x, y;
//};
//using namespace std;
//#define N 1100
//#define EPS 1e-6
//struct TPoint p1[N], p2[N];
//double dis(TPoint a, TPoint b) {
// return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
//}
//double cross(TPoint a, TPoint b, TPoint c) {
// return (c.x - a.x) * (b.y - a.y) - (c.y - a.y) * (b.x - a.x);
//}
//bool graham_cmp2(TPoint b, TPoint c) {
// double tmp = cross(b, c, p2[0]);
// if (tmp > EPS)
// return true;
// if (fabs(tmp) < EPS && (dis(b, p2[0]) < dis(c, p2[0])))
// return true;
// return false;
//}
//double diancheng(TPoint a,TPoint b,TPoint c){
// return (c.x-a.x)*(b.x-a.x)+(c.y-a.y)*(b.y-a.y);
//}
//bool graham_cmp1(TPoint b, TPoint c) {
// double tmp = cross(b, c, p1[0]);
// if (tmp > EPS)
// return true;
// if (fabs(tmp) < EPS && (dis(b, p1[0]) < dis(c, p1[0])))
// return true;
// return false;
//}
//struct TPoint tp[N];
//double str[N << 2], cstr[N];
//int main() {
// setvbuf(stdout,NULL,_IONBF,0);
// int n;
// while (scanf(" %d", &n) == 1) {
// for (int i = 0; i < n; i++) {
// scanf(" %lf %lf", &p1[i].x, &p1[i].y);
// }
// for (int i = 0; i < n; i++) {
// scanf(" %lf %lf", &p2[i].x, &p2[i].y);
// }
//
// sort(p1, p1 + n, graham_cmp1);
// for (int i = 2; i < n; i++) {
// cstr[i - 1] = cross(p1[0], p1[i], p1[i - 1]);
// }
// cstr[n - 1] = cross(p1[0], p1[1], p1[n - 1]);
//
// int ans=-1;
// memcpy(tp,p2,sizeof(tp));
// for (int i = 0; i < n; i++) {
//
// swap(tp[i], tp[0]);
// memcpy(p2,tp,sizeof(tp));
// swap(tp[i],tp[0]);
//
// sort(p2, p2 + n, graham_cmp2);
// for (int j = 2; j < n; j++) {
// str[j - 1] = cross(p2[0], p2[j], p2[j - 1]);
// }
// str[n - 1] = cross(p2[0], p2[1], p2[n - 1]);
// for (int j = 1; j <= n - 1; j++) {
// str[n + j - 1] = str[j];
// }
//
// for (int e = 1; ans==-1&&e <= 2 * n - 2;e++) {
// for(int j=1;j<=n-1;){
// if(fabs(str[e+j-1]-cstr[j])<EPS) j++;
// else break;
// if(j==n){
// ans=e;
// break;
// }
// }
// }
// if (ans != -1) {
// double dx = p1[0].x - p2[0].x, dy = p1[0].y - p2[0].y;
// p2[ans].x += dx;
// p2[ans].y += dy;
// double tmp = diancheng(p1[0], p1[1], p2[ans]), ab = sqrt(dis(p1[0],
// p1[1]));
//
// double ac = sqrt(dis(p1[0], p2[ans]));
// if(ac*ab<1e-12) while(1);
// tmp = acos(tmp / ac / ab);
// printf("%.10lf\n", tmp);
// break;
// }
// }
// }
// return 0;
//}
#include <iostream>
#include<stdio.h>
#include<memory.h>
#include<stdlib.h>
using namespace std;
int n, m, mapp[160][160], size[160];
int map[160][160];
int i, tim, flag, boo, u, v, a[160], x, y, cnt;
bool use[160];
void dfs(int k, int num) {
int i;
if (boo)
return;
cnt++;
if (cnt >= 2000000)
return;
if (k == n + 1) {
if (mapp[a[1]][a[n]]) {
for (i = 1; i < n; i++)
printf("%d ", a[i]);
printf("%d\n", a[n]);
boo = 1;
return;
}
}
for (i = 1; i <= size[num]; i++) {
if (!use[map[num][i]]) {
a[k + 1] = map[num][i];
use[map[num][i]] = 1;
dfs(k + 1, map[num][i]);
use[map[num][i]] = 0;
}
}
}
int main() {
while (scanf("%d%d", &n, &m) != EOF) {
memset(map, 0, sizeof(map));
memset(mapp, 0, sizeof(mapp));
memset(size, 0, sizeof(size));
while (m--) {
scanf("%d%d", &u, &v);
size[u]++;
size[v]++;
map[u][size[u]] = v;
map[v][size[v]] = u;
mapp[u][v] = mapp[v][u] = 1;
}
boo = false;
for (i = 1; i <= n; i++) {
if (boo)
break;
a[1] = i;
cnt = 0;
memset(use, 0, sizeof(use));
use[i] = 1;
dfs(1, i);
use[i] = 0;
}
if (boo) {
for (i = 1; i < n; i++)
printf("%d ", a[i]);
printf("%d\n", a[n]);
} else
printf("no solution\n");
}
return 0;
}
|
main.c:101:10: fatal error: iostream: No such file or directory
101 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s838608484
|
p00000
|
C
|
30
1
2
1000000000
41
19028315
927
193885869
22394
765366
100700763
1000000000
999999999
999999998
999999997
999999996
999999995
999999994
999999993
999999992
999999991
874
304205
4764
823832483
118
371
678
163028
504110219
132780
Case 1: 2
Case 2: 49
Case 3: 400157471
Case 4: 339006498
Case 5: 580740930
Case 6: 761800138
Case 7: 99063167
Case 8: 78923991
Case 9: 746913587
Case 10: 495906670
Case 11: 400157471
Case 12: 283354241
Case 13: 405175527
Case 14: 663918505
Case 15: 951188325
Case 16: 450497356
Case 17: 281341835
Case 18: 145180425
Case 19: 647022352
Case 20: 367552360
Case 21: 834279117
Case 22: 661125772
Case 23: 346363535
Case 24: 619359982
Case 25: 615054731
Case 26: 898929287
Case 27: 5080816
Case 28: 356010430
Case 29: 815239060
Case 30: 188469457
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 30
| ^~
|
s790291892
|
p00000
|
C
|
const int N=10010;
const int E=200010;
class Graph
{
public:
int pnt[E],nxt[E],id[E];
int head[N],nv,ne;
void init(const int v)
{
nv=v;
ne=0;
memset(head,255,sizeof(head));
}
void add(const int u,const int v,const int i)
{
pnt[ne]=v,id[ne]=i,nxt[ne]=head[u],head[u]=ne++;
pnt[ne]=u,id[ne]=i,nxt[ne]=head[v],head[v]=ne++;
}
}ga,gb;
int dfn[N],low[N],idx;
int belong[N],bcnt;
int stk[N],top;
bool vis[N];
void tarjan(const Graph &g,const int u,const int f)
{
int i,v,e;
dfn[u]=low[u]=idx++;
stk[++top]=u;
vis[u]=1;
for(i=g.head[u];~i;i=g.nxt[i])
{
e=g.id[i];
if(dfn[v=g.pnt[i]]<0)
{
tarjan(g,v,e);
low[u]=min(low[u],low[v]);
}
else if(e!=f && vis[v] && low[u]>dfn[v]) low[u]=dfn[v];
}
if(dfn[u]==low[u])
{
do
{
v=stk[top--];
vis[v]=0;
belong[v]=bcnt;
}while(v!=u);
bcnt++;
}
}
void bcc(const Graph &g)
{
top=bcnt=idx=0;
memset(dfn,255,sizeof(dfn));
memset(vis,0,sizeof(vis));
for(int i=0;i<g.nv;i++) if(dfn[i]<0) tarjan(g,i,-1);
}
void shrink(const Graph &ga,Graph &gb)
{
int v,cnt=1;
gb.init(bcnt);
for(int i=0;i<ga.nv;i++) for(int j=ga.head[i];~j;j=ga.nxt[j])
if(belong[i]!=belong[v=ga.pnt[j]])
gb.add(belong[i],belong[v],cnt++);
}
|
main.c:4:1: error: unknown type name 'class'
4 | class Graph
| ^~~~~
main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
5 | {
| ^
main.c:22:2: warning: data definition has no type or storage class
22 | }ga,gb;
| ^~
main.c:22:2: error: type defaults to 'int' in declaration of 'ga' [-Wimplicit-int]
main.c:22:5: error: type defaults to 'int' in declaration of 'gb' [-Wimplicit-int]
22 | }ga,gb;
| ^~
main.c:24:5: error: variably modified 'dfn' at file scope
24 | int dfn[N],low[N],idx;
| ^~~
main.c:24:12: error: variably modified 'low' at file scope
24 | int dfn[N],low[N],idx;
| ^~~
main.c:25:5: error: variably modified 'belong' at file scope
25 | int belong[N],bcnt;
| ^~~~~~
main.c:26:5: error: variably modified 'stk' at file scope
26 | int stk[N],top;
| ^~~
main.c:27:1: error: unknown type name 'bool'
27 | bool vis[N];
| ^~~~
main.c:1:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
+++ |+#include <stdbool.h>
1 | const int N=10010;
main.c:27:6: error: variably modified 'vis' at file scope
27 | bool vis[N];
| ^~~
main.c:29:19: error: type defaults to 'int' in declaration of 'Graph' [-Wimplicit-int]
29 | void tarjan(const Graph &g,const int u,const int f)
| ^~~~~
main.c:29:25: error: expected ';', ',' or ')' before '&' token
29 | void tarjan(const Graph &g,const int u,const int f)
| ^
main.c:56:16: error: type defaults to 'int' in declaration of 'Graph' [-Wimplicit-int]
56 | void bcc(const Graph &g)
| ^~~~~
main.c:56:22: error: expected ';', ',' or ')' before '&' token
56 | void bcc(const Graph &g)
| ^
main.c:63:19: error: type defaults to 'int' in declaration of 'Graph' [-Wimplicit-int]
63 | void shrink(const Graph &ga,Graph &gb)
| ^~~~~
main.c:63:25: error: expected ';', ',' or ')' before '&' token
63 | void shrink(const Graph &ga,Graph &gb)
| ^
|
s542372153
|
p00000
|
C
|
qweqewqrgvl
vmebnklvndkls
vm slafnkdvn
mvsl;adfk
vmsl;adfmngv
v,s;adfl
|
main.c:1:1: error: unknown type name 'qweqewqrgvl'
1 | qweqewqrgvl
| ^~~~~~~~~~~
main.c:3:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'vm'
3 | vm slafnkdvn
| ^~
main.c:3:1: error: unknown type name 'vm'
main.c:4:6: error: unknown type name 'adfk'
4 | mvsl;adfk
| ^~~~
main.c:5:6: error: unknown type name 'adfmngv'
5 | vmsl;adfmngv
| ^~~~~~~
main.c:6:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
6 | v,s;adfl
| ^
|
s325977164
|
p00000
|
C
|
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define lson u<<1
#define rson u<<1|1
#define MAXN 100010
//#define Max(a,b,c) ((a)>(b)?(a)>(c)?(a):(c):(b)>(c)?(b):(c))
int dat[MAXN];
struct Node {
int lef,rig;
int lsum,rsum,msum;//蟾ヲ遶ッ譛?柄霑樒サュ1?悟承遶ッ譛?柄霑樒サュ1?悟玄髣エ譛?柄霑樒サュ1
int lz,rz,mz;//蟾ヲ遶ッ譛?柄霑樒サュ0?悟承遶ッ譛?柄霑樒サュ0?悟玄髣エ譛?柄霑樒サュ0
int sum;//蛹コ髣エ1逧?クェ謨ー
int COVER,XOR;
}T[MAXN<<2];
void makeXOR(int u){//鄙サ霓ャ謫堺ス?
swap(T[u].lsum,T[u].lz);
swap(T[u].rsum,T[u].rz);
swap(T[u].msum,T[u].mz);
T[u].sum=T[u].rig-T[u].lef+1-T[u].sum;
}
void PushUp(int u){
if(T[u].lef==T[u].rig)return;
int len=T[u].rig-T[u].lef+1;
T[u].lsum=T[lson].lsum;
T[u].rsum=T[rson].rsum;
if(T[u].lsum==(len+1)>>1)T[u].lsum+=T[rson].lsum;
if(T[u].rsum==len>>1)T[u].rsum+=T[lson].rsum;
T[u].msum=max(T[lson].msum,T[rson].msum);
T[u].msum=max(T[u].msum,T[lson].rsum+T[rson].lsum);
T[u].lz=T[lson].lz;
T[u].rz=T[rson].rz;
if(T[u].lz==(len+1)>>1)T[u].lz+=T[rson].lz;
if(T[u].rz==len>>1)T[u].rz+=T[lson].rz;
T[u].mz=max(T[lson].mz,T[rson].mz);
T[u].mz=max(T[u].mz,T[lson].rz+T[rson].lz);
T[u].sum=T[lson].sum+T[rson].sum;
}
void PushDown(int u){
if(T[u].lef==T[u].rig)return;
if(T[u].COVER!=-1){
int len=T[u].rig-T[u].lef+1;
T[lson].COVER=T[rson].COVER=T[u].COVER;
T[lson].XOR=T[rson].XOR=0;
T[lson].lsum=T[lson].rsum=T[lson].msum=T[u].COVER?(len+1)>>1:0;
T[lson].lz=T[lson].rz=T[lson].mz=T[u].COVER?0:(len+1)>>1;
T[lson].sum=T[u].COVER?(len+1)>>1:0;
T[rson].lsum=T[rson].rsum=T[rson].msum=T[u].COVER?len>>1:0;
T[rson].lz=T[rson].rz=T[rson].mz=T[u].COVER?0:len>>1;
T[rson].sum=T[u].COVER?len>>1:0;
T[u].COVER=-1;
}
if(T[u].XOR){
T[u].XOR=0;
T[lson].XOR^=1;
T[rson].XOR^=1;
makeXOR(lson);
makeXOR(rson);
}
}
void Build(int u,int l,int r){
T[u].lef=l;
T[u].rig=r;
T[u].COVER=-1;
T[u].XOR=0;
if(l==r){
T[u].lsum=T[u].rsum=T[u].msum=(dat[l]==1);
T[u].lz=T[u].rz=T[u].mz=(dat[l]==0);
T[u].sum=dat[l];
T[u].COVER=dat[l];
return;
}
int mid=(l+r)>>1;
Build(lson,l,mid);
Build(rson,mid+1,r);
PushUp(u);
}
void Update(int u,int l,int r,int op){
PushDown(u);
if(l<=T[u].lef&&T[u].rig<=r){
if(op<2){//隕?尠謫堺ス?
int len=T[u].rig-T[u].lef+1;
T[u].COVER=op;
T[u].lsum=T[u].rsum=T[u].msum=op?len:0;
T[u].lz=T[u].rz=T[u].mz=op?0:len;
T[u].sum=op?len:0;
}
else {
T[u].XOR=1;
makeXOR(u);
}
}
else {
//PushDown(u);
if(l<=T[lson].rig)Update(lson,l,r,op);
if(r>=T[rson].lef)Update(rson,l,r,op);
PushUp(u);
}
}
int Query(int u,int l,int r,int op){
PushDown(u);
if(l<=T[u].lef&&T[u].rig<=r){
if(op==3)return T[u].sum;
else return T[u].msum;
}
else {
//PushDown(u);
if(r<=T[lson].rig)return Query(lson,l,r,op);
if(l>=T[rson].lef)return Query(rson,l,r,op);
if(op==3) return Query(lson,l,T[lson].rig,op)+Query(rson,T[rson].lef,r,op);
int ret=min(T[lson].rsum,T[lson].rig-l+1)+min(T[rson].lsum,r-T[rson].lef+1);
int ans=max(Query(lson,l,T[lson].rig,op),Query(rson,T[rson].lef,r,op));
return max(ans,ret);
}
}
int main(){
int t;
scanf("%d",&t);
while(t--){
int n,m;
int cmd,a,b;
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)scanf("%d",dat+i);
Build(1,1,n);
while(m--){
scanf("%d%d%d",&cmd,&a,&b);
a++,b++;
if(cmd<3)Update(1,a,b,cmd);
else printf("%d\n",Query(1,a,b,cmd));
}
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s570443365
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
const int MAXN = 400100;
const int m = 10;
int val[MAXN], mp[11][11];
bool l[MAXN][10], r[MAXN][10], flag[MAXN][10];
void init(){
for(int i = 0; i < m; ++i){
for(int j = 0; j < m; ++j)
mp[i][j] = (i + j) % 10;
}
}
void update(int id, int lc, int rc){
for(int i = 0; i < m; ++i){
flag[id][i] = flag[lc][i] | flag[rc][i];
l[id][i] = l[lc][i];
r[id][i] = r[rc][i];
if(id == 3) printf(">>%d %d\n", i, flag[id][i]);
}
for(int i = 0; i < m; ++i){
if(r[lc][i]){
for(int j = 0; j < m; ++j)
flag[id][mp[i][j]] |= l[lc][j];
}
}
for(int i = 0; i < 10; ++i){
if(l[rc][i]) l[id][mp[val[lc]][i]] = 1;
if(r[lc][i]) r[id][mp[val[rc]][i]] = 1;
}
val[id] = (val[lc] + val[rc]) % 10;
}
void build(int id, int lt, int rt){
// printf("%d %d %d", id, lt, rt);
if(lt == rt){
for(int i = 0; i < m; ++i){
l[id][i] = r[id][i] = flag[id][i] = 0;
}
l[id][val[lt]] = r[id][val[lt]] = flag[id][val[lt]] = 1;
return;
}
int mid = (lt + rt) / 2, lc(id<<1), rc = (id<<1) + 1;
build(lc, lt, mid);
build(rc, mid + 1, rt);
update(id, lc, rc);
}
bool ans[11];
void query(int id, int lt, int rt, int ql, int qr){
if(qr < lt || ql > rt) return;
if(ql <= lt && qr >= rt){
for(int i = 0; i < m; ++i){
ans[i] |= flag[id][i];
// if(ql == 4 && qr == 5){
// printf("%d %d\n", i, flag[id][i]);
// }
}
// printf("%d %d %d %d\n", lt, rt, ql, qr);
return;
}
int mid = (lt + rt) / 2, lc(id<<1), rc = (id<<1) + 1;
query(lc, lt, mid, ql, qr);
query(rc, mid + 1, rt, ql, qr);
}
int b[10];
int main() {
freopen("1002.in", "r", stdin);
init();
int test, cas(1), n, m;
scanf("%d", &test);
while(test--){
if(cas != 1) puts("");
scanf("%d", &n);
for(int i = 1; i <= n; ++i){
scanf("%d", &val[i]);
if(val[i] > 9) val[i] %= 9;
}
// puts("222");
build(1, 1, n);
printf("Case #%d:\n", cas++);
scanf("%d", &m);
// printf("m:%d\n", m);
for(int i = 0, ql, qr; i < m; ++i){
scanf("%d%d", &ql, &qr);
memset(ans, 0, sizeof(ans));
query(1, 1, n, ql, qr);
int cnt = 0;
for(int i = 9; i >= 0; --i){
if(ans[i]) b[cnt++] = i;
}
for(int i = 0; i < 5; ++i){
if(cnt <= i) printf("%d", -1);
else printf("%d", b[i]);
if(i != 4) putchar(' ');
else puts("");
}
}
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s539182217
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=50005;
const double inf=1e15;
const double eps=1e-12;
struct A
{
int a,b,c,d;
}l[N],r[N];
double x[N],w[N];
void init(int n)
{
int i;
l[0].a=l[0].b=l[0].c=l[0].d=0;
for (i=1; i<=n; i++)
{
l[i].a=l[i-1].a+w[i];
l[i].b=l[i-1].b-3.0*w[i]*x[i];
l[i].c=l[i-1].c+3.0*w[i]*x[i]*x[i];
l[i].d=l[i-1].d-w[i]*x[i]*x[i]*x[i];
}
r[n+1].a=r[n+1].b=r[n+1].c=r[n+1].d=0;
for (i=n; i>=1; i--)
{
r[i].a=r[i+1].a-w[i];
r[i].b=r[i+1].b+3.0*w[i]*x[i];
r[i].c=r[i+1].c-3.0*w[i]*x[i]*x[i];
r[i].d=r[i+1].d+w[i]*x[i]*x[i]*x[i];
}
}
double f(double a,double b,double c,double d,double x)
{
double res=a*x*x*x+b*x*x+c*x+d;
//cout<<x<<' '<<res<<endl;
return res;
}
double func(double a,double b,double c,double d,double x1,double x2)
{
//cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
double res=min(f(a,b,c,d,x1),f(a,b,c,d,x2));
double temp=b*b-3*a*c;
if (temp>-eps)
{
double y1=(-b+sqrt(temp))/(3*a),y2=(-b-sqrt(temp))/(3*a);
if (y1>x1 && y1<x2) res=min(res,f(a,b,c,d,y1));
if (y2>x1 && y2<x2) res=min(res,f(a,b,c,d,y2));
//cout<<x1<<' '<<x2<<' '<<y1<<' '<<y2<<endl;
}
//cout<<x1<<' '<<x2<<' '<<res<<endl;
return res;
}
int main()
{
int o,i,cas=0,n;
double res;
scanf("%d",&o);
while (o--)
{
scanf("%d",&n);
for (i=1; i<=n; i++) scanf("%lf%lf",&x[i],&w[i]);
init(n);
if (n==1) res=0; else res=inf;
for (i=1; i<n; i++)
{
double a=l[i].a+r[i+1].a;
double b=l[i].b+r[i+1].b;
double c=l[i].c+r[i+1].c;
double d=l[i].d+r[i+1].d;
res=min(res,func(a,b,c,d,x[i],x[i+1]));
}
printf("Case #%d: %.0lf\n",++cas,res);
}
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s655090523
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<vector>
#include<map>
#include<string>
using namespace std;
const int maxn = 100100;
int n, first[maxn], cnt;
struct Arc
{
int v, next;
}arc[maxn*2];
int w[maxn], K;
int ans[maxn];
int q[maxn];
int state[maxn];
int mymp[maxn];
map<int,int>mp[maxn][2];
void add(int u, int v)
{
arc[cnt].v = v;
arc[cnt].next = first[u];
first[u] = cnt++;
}
void bfs(int s)
{
for(int i = 1; i <= n; i++)
state[i] = 0;
state[s] = 1;
int head = 0, tail = 0;
q[tail++] = s;
while(head < tail)
{
int u = q[head++];
for(int i = first[u]; i + 1; i = arc[i].next)
{
int v = arc[i].v;
if(state[v] == 0)
{
state[v] = state[u] + 1;
q[tail++] = v;
}
}
}
}
void deal(int u)
{
printf("u=%d ", u);
int xx = mymp[u];
mp[xx][0][w[u]]++;
mp[xx][0][1]++;
for(int i = first[u]; i + 1; i = arc[i].next)
{
int v = arc[i].v;
if(state[v] <= state[u]) continue;
int x = mymp[u], y = mymp[v];
if(mp[x][0].size() >= mp[y][0].size())
{
map<int,int>::iterator it;
for(it = mp[y][0].begin(); it != mp[y][0].end(); it++)
{
int y0 = (*it).first, y1 = (*it).second;
int tmp = mp[x][0][y0];
mp[x][1][tmp]--;
mp[x][0][y0] += y1;
mp[x][1][mp[x][0][y0]]++;
}
mp[y][0].clear();
mp[y][1].clear();
}
else
{
swap(x, y);
map<int,int>::iterator it;
for(it = mp[y][0].begin(); it != mp[y][0].end(); it++)
{
int y0 = (*it).first, y1 = (*it).second;
int tmp = mp[x][0][y0];
mp[x][1][tmp]--;
mp[x][0][y0] += y1;
mp[x][1][mp[x][0][y0]]++;
}
mp[y][0].clear();
mp[y][1].clear();
mymp[u] = x;
}
}
int x = mymp[u];
ans[u] = mp[x][1][K];
}
int main()
{
int T;
scanf("%d", &T);
for(int cas = 1; cas <= T; cas++)
{
scanf("%d%d", &n, &K);
for(int i = 1; i <= n; i++)
scanf("%d", w + i);
cnt = 0;
for(int i = 1; i <= n; i++)
{
mymp[i] = i;
mp[i][0].clear();
mp[i][1].clear();
first[i] = -1;
}
for(int i = 1; i <n ; i++)
{
int u, v;
scanf("%d%d", &u, &v);
add(u, v);
add(v, u);
}
bfs(1);
for(int i = n - 1; i >= 0; i--)
deal(q[i]);
int Q;
scanf("%d", &Q);
printf("Case #%d:\n", cas);
while(Q-->0)
{
int u;
scanf("%d", &u);
printf("%d\n", ans[u]);
}
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s548205450
|
p00000
|
C
|
#include<stdio.h>
main()
{
int l, m;
for(l=1; l<=9; l++)
for(m=1; m<=9; m++)
printf(" %d x %d = %d", l, m. l*m);
return(0);
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:9:30: error: request for member 'l' in something not a structure or union
9 | printf(" %d x %d = %d", l, m. l*m);
| ^
|
s042577461
|
p00000
|
C
|
#include<stdio.h>
main()
{
int l, m;
for(l=1; l<=9; l++)
for(m=1; m<=9; m++)
printf( %d x %d = %d, l, m. l*m,);
return(0);
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:9:10: error: expected expression before '%' token
9 | printf( %d x %d = %d, l, m. l*m,);
| ^
|
s605823786
|
p00000
|
C
|
#include<stdio.h>
main()
{
int n, m;
for(n=1; n<=9; l++)
for(m=1; m<=9; m++)
printf( %d x %d = %d, n, m. n*m,);
return(0);
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:6:17: error: 'l' undeclared (first use in this function)
6 | for(n=1; n<=9; l++)
| ^
main.c:6:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:10: error: expected expression before '%' token
9 | printf( %d x %d = %d, n, m. n*m,);
| ^
|
s975842993
|
p00000
|
C
|
#include<stdio.h>
main()
{
int n, m;
for(n=1; n<=9; n++){}
for(m=1; m<=9; m++){}
printf( %d x %d = %d, n, m, n*m,);
return(0);
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:9:10: error: expected expression before '%' token
9 | printf( %d x %d = %d, n, m, n*m,);
| ^
|
s993729090
|
p00000
|
C
|
#include<stdio.h>
main()
{
int n, m;
for(n=1; n<=9; n++){}
for(m=1; m<=9; m++){}
printf( %d\n x %d\n = %d\n, n, m, n*m,);
return(0);
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:9:10: error: expected expression before '%' token
9 | printf( %d\n x %d\n = %d\n, n, m, n*m,);
| ^
main.c:9:12: error: stray '\' in program
9 | printf( %d\n x %d\n = %d\n, n, m, n*m,);
| ^
main.c:9:19: error: stray '\' in program
9 | printf( %d\n x %d\n = %d\n, n, m, n*m,);
| ^
main.c:9:26: error: stray '\' in program
9 | printf( %d\n x %d\n = %d\n, n, m, n*m,);
| ^
|
s038687475
|
p00000
|
C
|
#include<stdio.h>
main()
{
int n, m;
for(n=1; n<=9; n++){}
for(m=1; m<=9; m++){}
printf( %d\n x %d\n =%d\n, n, m, n*m,);
return(0);
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:9:10: error: expected expression before '%' token
9 | printf( %d\n x %d\n =%d\n, n, m, n*m,);
| ^
main.c:9:12: error: stray '\' in program
9 | printf( %d\n x %d\n =%d\n, n, m, n*m,);
| ^
main.c:9:19: error: stray '\' in program
9 | printf( %d\n x %d\n =%d\n, n, m, n*m,);
| ^
main.c:9:25: error: stray '\' in program
9 | printf( %d\n x %d\n =%d\n, n, m, n*m,);
| ^
|
s948913650
|
p00000
|
C
|
#include<stdio.h>
main()
{
int n, m;
for(n=1; n<=9; n++){
for(m=1; m<=9; m++){
printf( %d x %d =%d\n, n, m, n*m,);
}
}
return(0);
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:8:10: error: expected expression before '%' token
8 | printf( %d x %d =%d\n, n, m, n*m,);
| ^
main.c:8:21: error: stray '\' in program
8 | printf( %d x %d =%d\n, n, m, n*m,);
| ^
|
s075205694
|
p00000
|
C
|
#include<stdio.h>
main(){
int n, m;
for(n=1; n<=9; n++){
for(m=1; m<=9; m++){
printf("%dx%d=%d\n", n, m, n*m,);
}
}
return(0);
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main(){
| ^~~~
main.c: In function 'main':
main.c:7:33: error: expected expression before ')' token
7 | printf("%dx%d=%d\n", n, m, n*m,);
| ^
|
s786038201
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<vector>
#include<map>
#include<string>
using namespace std;
const int maxn = 2100;
int n, C, K, M,first[maxn], cnt;
struct Arc
{
int v, next;
}arc[maxn*2];
int q[maxn];
int state[maxn];
pair<int,int> city[5100];
const int inf = (-1u)>>2;
int dp[maxn][2];
char visit[maxn];
void add(int u, int v)
{
arc[cnt].v = v;
arc[cnt].next = first[u];
first[u] = cnt++;
}
void bfs(int s,int &begin)
{
state[s] = 1;
int head = begin, tail = begin;
q[tail++] = s;
while(head < tail)
{
int u = q[head++];
for(int i = first[u]; i + 1; i = arc[i].next)
{
int v = arc[i].v;
if(state[v] == 0)
{
state[v] = state[u] + 1;
q[tail++] = v;
}
}
}
begin = tail;
}
int deal(int u)
{
visit[u] = 1;
for(int i = first[u]; i + 1; i = arc[i].next)
{
int v = arc[i].v;
if(state[v] <= state[u]) continue;
dp[u][0] = max(dp[u][0], dp[u][0] + max(dp[v][0], dp[v][1]));
dp[u][1] = max(dp[u][1], dp[u][1] + dp[v][0]);
}
return max(dp[u][0], dp[u][1]);
}
char check(int mid, int start)
{
for(int i = 0; i <= n; i++)
{
dp[i][0] = 0;
dp[i][1] = -inf;
visit[i] = 0;
}
int tx = mid + city[start].first;
for(int i = start; i < C; i++)
if(tx >= city[i].first)
{
dp[city[i].second][1] = 1;
}
int sum = 0;
for(int i = n - 1; i >= 0; i--)
if(visit[q[i]] == 0)
{
sum += deal(q[i]);
}
printf("mid %d start%d\n", mid, start);
for(int i = 1; i <= n; i++)
{
printf("%d %d %d]\n", i, dp[i][0], dp[i][1]);
}
return sum >= K;
}
/*
3 3 2 1
0 1
2 2
5 3
1 2
mid 2 start0
1 1 1]
2 0 1]
3 0 -1073741823]
2 1]
*/
char check(int mid)
{
for(int i = 0; i < C; i++)
{
if(i == 0 || city[i].first != city[i - 1].first)
{
if(check(mid, i)) return 1;
}
}
return 0;
}
int main()
{
int T;
scanf("%d", &T);
for(int cas = 1; cas <= T; cas++)
{
scanf("%d%d%d%d", &C, &n, &K, &M);
for(int i = 0; i < C; i++)
scanf("%d%d", &city[i].first, &city[i].second);
cnt = 0;
for(int i = 1; i <= n; i++)
{
first[i] = -1;
state[i] = 0;
}
for(int i = 0; i < M; i++)
{
int u, v;
scanf("%d%d", &u, &v);
add(u, v);
add(v, u);
}
int begin = 0;//bfs
for(int i = 1; i <= n; i++)
if(state[i] == 0)
bfs(i, begin);
sort(city, city + C);
int l = city[0].first, r = city[C - 1].first;
//printf("3 %d]\n", check(3));
printf("2 %d]\n", check(2));
return 0;
r = r - l, l = 0;
int tmp = r;
while(l <= r)
{
int mid = (r - l)/2 + l;
if(check(mid))
r = mid - 1;
else
l = mid + 1;
}
if(r + 1 < 0 || r + 1 > tmp) r = -2;
printf("Case #%d: %d\n", cas, r + 1);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s572411565
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<vector>
#include<map>
#include<string>
using namespace std;
#define MID(x,y) (((x)+(y))/2)
const int N = 100100;
const int M = 200100;
const int Q = 11;
typedef long long LL;
struct O
{
bool f[Q];
int trans(LL x){
if(x==0)return 0;
x%=9;
if(x==0)return 9;
return x;
}
void init(LL x){
memset(f,0,sizeof(f));
f[trans(x)]=true;
}
void init(){
memset(f,0,sizeof(f));
}
void uni(O b){
for(int i=0;i<=9;i++)
f[i]=f[i]||b.f[i];
}
int retrans(LL x,LL y){
if(x==0||y==0)return y;
y+=9-x;
if(y>9)y-=9;
return y;
}
void deal(LL x){
bool tmp[Q];
memset(tmp,0,sizeof(tmp));
for(int i=0;i<=9;i++)
if(f[i])
tmp[retrans(i,x)]=true;
for(int i=0;i<=9;i++)
f[i]=tmp[i];
}
void print(int x,int &flag){
if(flag==0)flag=1;
else printf(" ");
printf("%d",x);
}
void out(){
puts("aa");
int i,cnt=0,flag=0;
for(i=9;i>=0&&cnt<5;i--){
if(f[i]){
cnt++;
print(i,flag);
}
}
for(;cnt<5;cnt++)print(-1,flag);
printf("\n");
}
};
struct SGT{
int lk[M],rk[M],a[M],b[M],tp;
O val[M];
void init(int n,O x[]){
tp=0;
build(1,n,x);
}
int build(int l,int r,O y[]){
int x=++tp;
a[x]=l,b[x]=r;
if(l!=r){
lk[x]=build(l,MID(l,r),y);
rk[x]=build(MID(l,r)+1,r,y);
update(x);
}
else val[x]=y[l];
return x;
}
void update(int x){
val[x].init();
val[x].uni(val[lk[x]]);
val[x].uni(val[rk[x]]);
}
O query(int l,int r,int x){
printf("xxx %d %d %d\n",l,r,x);
if(a[x]>=l&&b[x]<=r)return val[x];
O ans;
ans.init();
if(l<=MID(a[x],b[x]))ans.uni(query(l,r,lk[x]));
if(r>MID(a[x],b[x]))ans.uni(query(l,r,rk[x]));
return ans;
}
}sgt;
O o[N];
long long sum[N];
int num[N];
struct SGT2{
int lk[M],rk[M],a[M],b[M],tp;
O val[M];
void init(int n,O x[]){
tp=0;
build(1,n,x);
//puts("aaaaaaaa");
}
int build(int l,int r,O y[]){
int x=++tp;
// printf("begin %d %d %d\n",l,r,x);
a[x]=l,b[x]=r;
if(l!=r){
lk[x]=build(l,MID(l,r),y);
rk[x]=build(MID(l,r)+1,r,y);
update(x);
}
else val[x]=y[l];
// printf("end %d %d %d\n",l,r,x);
return x;
}
void update(int x){
val[x].init();
val[x].uni(val[lk[x]]);
val[x].uni(val[rk[x]]);
O tmp;
tmp.init();
for(int i=a[x];i<=MID(a[x],b[x]);i++){
printf("%d %d %d %d\n",i,x,a[x],b[x]);
puts("bb");
//if(i <= b[x])
tmp=sgt.query(i,b[x],1);
puts("cc");
tmp.deal(sum[i-1]);
puts("dd");
val[x].uni(tmp);
}
puts("ee");
}
O query(int l,int r,int x){
if(a[x]>=l&&b[x]<=r)return val[x];
O ans;
ans.init();
if(l<=MID(a[x],b[x]))ans.uni(query(l,r,lk[x]));
if(r>MID(a[x],b[x]))ans.uni(query(l,r,rk[x]));
return ans;
}
}sgt2;
void init(int n)
{
for(int i=1;i<=n;i++)scanf("%d",&num[i]);
sum[0]=0;
for(int i=1;i<=n;i++)sum[i]=num[i]+sum[i-1];
o[0].init();
for(int i=1;i<=n;i++)o[i].init(sum[i]);
//puts("aa");
//printf("%d\n",n);
sgt.init(n,o);
puts("aa");
sgt2.init(n,o);
puts("ff");
}
void solve(int l,int r)
{
O x=sgt2.query(l,r,1);
//x.deal(sum[l-1]);
x.out();
}
int main()
{
int t,n,m,l,r;
scanf("%d",&t);
for(int cs=1;cs<=t;cs++){
scanf("%d",&n);
init(n);
//sgt.init(n,o);
if(cs!=1)printf("\n");
printf("Case #%d:\n",cs);
scanf("%d",&m);
for(int i=1;i<=m;i++){
scanf("%d %d",&l,&r);
// puts("cc");
solve(l,r);
}
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s299765905
|
p00000
|
C
|
#include<stdio.h>
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: In function 'main':
main.c:7:11: error: expected expression before '%' token
7 | printf(%dx%d=%d\n,i,j,i*j);
| ^
main.c:7:19: error: stray '\' in program
7 | printf(%dx%d=%d\n,i,j,i*j);
| ^
|
s845667552
|
p00000
|
C
|
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int N = 100010;
int sz[N],dep[N],fa[N],son[N],val[N],top[N];
int g[N],d[N];
vector<int> edge[N],pos[N];
int loc=0;
void dfs(int x,int dp,int pa)
{
fa[x]=pa;
sz[x]=1;
dep[x]=dp;
son[x]=0;
for(int i=0;i<edge[x].size();i++)
{
int u=edge[x][i];
if(u!=pa)
{
dfs(u,dp+1,x);
sz[x]+=sz[u];
if(sz[son[x]]<sz[u])
{
son[x]=u;
}
}
}
}
void find_link(int x,int tp)
{
val[x]=++loc;
d[loc]=g[x];
top[x]=tp;
if(son[x]!=0)
{
find_link(son[x],tp);
}
for(int i=0;i<edge[x].size();i++)
{
int u=edge[x][i];
if(u!=son[x]&&fa[u]==x)
{
find_link(u,u);
}
}
}
bool gao(int x,int l,int r)
{
vector<int>::iterator iter=lower_bound(pos[x].begin(),pos[x].end(),l);
if((*iter)<=r)
{
return true;
}
return false;
}
int query(int va,int vb,int v)
{
if(pos[v].size()==0) return 0;
int f1=top[va],f2=top[vb];
while(f1!=f2)
{
if(dep[f1]<dep[f2])
{
swap(f1,f2);
swap(va,vb);
}
if(gao(v,val[f1],val[va]))
{
return 1;
}
va=fa[f1];f1=top[va];
}
if(dep[va]<dep[vb]) swap(va,vb);
if(gao(v,val[vb],val[va]))
{
return 1;
}
else return 0;
}
int main(void)
{
int T,n,m,x,y,w;
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
pos[i].clear();
}
for(int i=1;i<=n;i++)
{
scanf("%d",&g[i]);
edge[i].clear();
}
for(int i=1;i<n;i++)
{
scanf("%d%d",&x,&y);
edge[x].push_back(y);
edge[y].push_back(x);
}
dfs(1,0,-1);
find_link(1,1);
for(int i=1;i<=loc;i++)
{
pos[d[i]].push_back(i);
}
for(int i=1;i<=m;i++)
{
scanf("%d%d%d",&x,&y,&w);
if(query(x,y,w))
{
printf("Find\n");
}
else
{
printf("NotFind\n");
}
}
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s233454309
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
#define min(x , y) ((x) > (y) ? (y) : (x))
#define max(x , y) ((x) > (y) ? (x) : (y))
#define abs(x) ((x) > 0 ? (x) : -(x))
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define db double
#define rt return
#define cs const
cs db eps = 1e-8;
inline int sig(db x){rt (x>eps)-(x<-eps);}
#define cp const P&
#define op operator
#define LL long long
cs int N = 211 , mod = 1000000007;
LL fib[N*N];
struct P{
db x , y;
P(db a = 0 , db b = 0):x(a),y(b){}
void in(){scanf("%lf%lf" , &x , &y);}
bool op<(cp a)cs{rt x < a.x;}
P op+(cp a)cs{rt P(x+a.x , y+a.y);}
P op-(cp a)cs{rt P(x-a.x , y-a.y);}
db op^(cp a)cs{rt x*a.y - a.x*y;}
db cross(P a , P b){rt a-*this ^ b-*this;}
}p[N];
int n , down[N][N] , up[N][N] , K[N*N];
int read() {
if(scanf("%d" , &n) == -1) return 0;
for(int i = 1 ; i <= n ; i++) p[i].in();
return 1;
}
LL exp_mod(LL a,LL b){
LL ret = 1 , base = a % mod;
while(b) {
if(b&1) ret = ret * base % mod;
b >>= 1;
base = base * base % mod;
}
return ret;
}
void solve() {
sort(p + 1 , p + n + 1);
for(int i = 1 ; i <= n ; i++)
for(int j = i + 1 ; j <= n ; j++) {
down[i][j] = up[i][j] = 0;
for(int k = 1 ; k <= n ; k++) if(k != i && k != j) {
if(p[i].x == p[j].x) {
if(p[k].y < min(p[i].y , p[j].y) ||
p[k].y > max(p[i].y , p[j].y)) continue;
}
else {
if(p[k].x < min(p[i].x , p[j].x) ||
p[k].x > max(p[i].x , p[j].x)) continue;
}
if(p[i].cross(p[j] , p[k]) < -eps) down[i][j]++;
else up[i][j]++;
}
}
int cnt = 0;
for(int i = 1 ; i <= n ; i++)
for(int j = i + 1 ; j <= n ; j++) K[++cnt] = down[i][j] * up[i][j];
LL res = 1;
for(int i = 1 ; i <= cnt ; i++) {
LL tmp=exp_mod(K[i] , fib[K[i]])+1;
res = res * tmp % mod;
}
if(n < 2) res = 0;
printf("%I64d\n" , res);
}
int main() {
int T;
fib[0] = fib[1] = 1;
for(int i = 2 ; i < N*N ; i++)
fib[i] = (fib[i-1] + fib[i-2]) % (mod - 1);
while(read()) {
solve();
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s687186264
|
p00000
|
C
|
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
using namespace std;
#define M 40
const int MOD=1000000007;
int f[M+5][M+5][5][5][5][5][2];
int cs[5][5][5][5];
int n,m;
void init(void);
void fz(int i,int j,int a,int b,int c,int d,int st);
int main()
{
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
int ca;
int i,j,k,a,b,c,d,e;
init();
for (i=1;i<=M;i++)
for (j=1;j<=M;j++)
{
for (a=0;a<5;a++)
for (b=0;b<5;b++)
for (c=0;c<5;c++)
for (d=0;d<5;d++)
{
if (f[i][j][a][b][c][d][0]==-1)
{
f[i][j][a][b][c][d][0]=cs[a][b][c][d];
//====================================
for (k=1;k<i;k++)
{
for (e=1;e<5;e++)
{
if (e!=a && e!=b && e!=d)
{
f[i][j][a][b][c][d][0]+=f[i-k][j][e][b][c][d][1];
f[i][j][a][b][c][d][0]%=MOD;
}
if (e!=b && e!=c && e!=d)
{
f[i][j][a][b][c][d][0]+=(f[k][j][a][b][e][d][1]+MOD-cs[a][b][e][d])%MOD;
f[i][j][a][b][c][d][0]%=MOD;
}
}
}
fz(i,j,a,b,c,d,0);
}
if (f[i][j][a][b][c][d][1]==-1)
{
f[i][j][a][b][c][d][1]=cs[a][b][c][d];
//====================================
for (k=1;k<j;k++)
{
for (e=1;e<5;e++)
{
if (e!=a && e!=b && e!=c)
{
f[i][j][a][b][c][d][1]+=f[i][j-k][a][e][c][d][0];
f[i][j][a][b][c][d][1]%=MOD;
}
if (e!=a && e!=c && e!=d)
{
f[i][j][a][b][c][d][1]+=(f[i][k][a][b][c][e][0]+MOD-cs[a][b][c][e])%MOD;
f[i][j][a][b][c][d][1]%=MOD;
}
}
}
//====================================
fz(i,j,a,b,c,d,1);
}
}
}
scanf("%d",&ca);
while (ca--)
{
scanf("%d%d",&n,&m);
printf("%d\n",f[n][m][0][0][0][0][0]%MOD);
}
return 0;
}
void init(void)
{
int a,b,c,d,e;
memset(f,-1,sizeof(f));
memset(cs,0,sizeof(cs));
for (a=0;a<5;a++)
for (b=0;b<5;b++)
for (c=0;c<5;c++)
for (d=0;d<5;d++)
{
for (e=1;e<5;e++)
if (e!=a && e!=b && e!=c && e!=d)
cs[a][b][c][d]++;
}
}
void fz(int i,int j,int a,int b,int c,int d,int st)
{
f[i][j][c][b][a][d][st]=f[i][j][a][b][c][d][st];
f[i][j][a][d][c][b][st]=f[i][j][a][b][c][d][st];
f[i][j][c][d][a][b][st]=f[i][j][a][b][c][d][st];
//======================================
f[j][i][b][c][d][a][1-st]=f[i][j][a][b][c][d][st];
f[j][i][d][c][b][a][1-st]=f[i][j][a][b][c][d][st];
f[j][i][d][a][b][c][1-st]=f[i][j][a][b][c][d][st];
f[j][i][b][a][d][c][1-st]=f[i][j][a][b][c][d][st];
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s862166945
|
p00000
|
C
|
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[110][1010],sum[110][1010],dp[110][1010];
struct node{
int cc;
int id;
}tmp1[1010],tmp2[1010];
int cmp(node aa,node bb){
return aa.cc>bb.cc;
}
main(){
int n,m,x,t;
scanf("%d%d%d%d",&n,&m,&x,&t);
memset(a,0,sizeof(a));
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
scanf("%d",&a[i][j]);
}
}
memset(sum,0,sizeof(sum));
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
sum[i][j]=sum[i][j-1]+a[i][j];
}
}
for(int i=1;i<=n+1;i++){
for(int j=1;j<=m;j++)
dp[i][j]=-600000000;
}
dp[1][x]=0;
for(int i=2;i<=n+1;i++){
for(int p=1;p<=m;p++){
tmp1[p].cc=dp[i-1][p]-sum[i-1][p-1];
tmp1[p].id=p;
}
sort(tmp1+1,tmp1+1+m,cmp);
for(int p=1;p<=m;p++){
tmp2[p].cc=dp[i-1][p]+sum[i-1][p];
tmp2[p].id=p;
}
sort(tmp2+1,tmp2+m+1,cmp);
for(int j=1;j<=m;j++){
for(int k=1;k<=m;k++){
if(tmp1[k].id<=j && (tmp1[k].id+t)>=j && dp[i-1][tmp1[k].id]!=-600000000){
dp[i][j]=tmp1[k].cc+sum[i-1][j];
break;
}
}
for(int k=1;k<=m;k++){
if(tmp2[k].id>=j && (tmp2[k].id-t)<=j && dp[i-1][tmp2[k].id]!=-600000000){
dp[i][j]=max(dp[i][j],tmp2[k].cc-sum[i-1][j-1]);
break;
}
}
printf("%d\n",dp[i][j]);
}
printf("\n");
}
int ans=dp[n+1][1];
for(int i=1;i<=m;i++){
if(dp[n+1][i]>ans)
ans=dp[n+1][i];
}
printf("%d\n",ans);
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s467734245
|
p00000
|
C
|
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1005;
const int M = 52;
const int INF = 2000000011;
struct P
{
int p,e;
}data[M][N];
bool cmp(P a,P b)
{
return a.p<b.p;
}
int dp[M][N],q[N],top,tail;
int abs(int x){return x>0?x:-x;}
int cost(int i,int k,int j)
{
return dp[i-1][k]+abs(data[i-1][k].p-data[i][j].p);
}
int main()
{
freopen("data.in", "r", stdin);
freopen("data1.out", "w", stdout);
int T,m,n,l,i,j,k,t;
scanf("%d",&T);
while(T--)
{
scanf("%d%d%d",&m,&n,&l);
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%d",&data[i][j].p);
}
}
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%d",&data[i][j].e);
}
sort(data[i]+1,data[i]+1+n,cmp);
}
for(i=1;i<=n;i++)dp[1][i]=abs(l-data[1][i].p)+data[1][i].e;
for(i=2;i<=m;i++)
{
top=0;
tail=-1;
for(k=j=1;j<=n;j++)
{
dp[i][j]=INF;
while(k<=n&&data[i-1][k].p<=data[i][j].p)
{
t=cost(i,k,j);
while(tail>=top&&cost(i,q[tail],j)>=t)tail--;
q[++tail]=k;
k++;
}
if(tail>=top)dp[i][j]=cost(i,q[top],j);
}
top=0;
tail=-1;
for(k=j=n;j>0;j--)
{
while(k>0&&data[i-1][k].p>data[i][j].p)
{
t=cost(i,k,j);
while(tail>=top&&cost(i,q[tail],j)>=t)tail--;
q[++tail]=k;
k--;
}
if(tail>=top)
{
t=cost(i,q[top],j);
if(dp[i][j]>t)dp[i][j]=t;
}
}
for(j=1;j<=n;j++)dp[i][j]+=data[i][j].e;
}
t=INF;
for(i=1;i<=n;i++)if(t>dp[m][i])t=dp[m][i];
printf("%d\n",t);
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s164434845
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#define DBLE 1e-8
#define PI 3.1415926535898
#define MAXN 310
#define INF 800000000
using namespace std;
int matrix[MAXN][MAXN],n;
int dp[MAXN];
int SPFA()
{
bool visit[MAXN]={0};
int now;
queue<int> que;
que.push(0);
while(!que.empty())
{
now=que.front();
que.pop();
visit[now]=0;
if(now==n-1) continue;
for(int i=1;i<n;++i)
if(dp[now]+matrix[now][i]<dp[i])
{
dp[i]=dp[now]+matrix[now][i];
if(visit[i]==0) que.push(i);
visit[i]=1;
}
if(now==0) continue;
for(int i=1;i<n-1;++i)
if(dp[now]+matrix[now][0]+matrix[n-1][i]<dp[i])
{
dp[i]=dp[now]+matrix[now][0]+matrix[n-1][i];
if(visit[i]==0) que.push(i);
visit[i]=1;
}
}
return 0;
}
int main()
{
while(scanf("%d",&n)==1)
{
for(int i=0;i<n;++i)
{
for(int j=0;j<n;++j) scanf("%d",&matrix[i][j]);
dp[i]=INF;
}
dp[0]=0;
SPFA();
cout<<dp[n-1]<<endl;
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s192946097
|
p00000
|
C
|
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;i++)
#define N 32
using namespace std;
int A,B,C,D,E;
int alla,allb,allc,alld,alle;
double dp[N][N][N][N][2];
const int base=16;
double f(int a,int b,int c,int d,int e)
{
if (a<=0 && b<=0 && c<=0 && d<=0) return 0;
if (dp[a+base][b+base][c+base][d+base][e+base]>=0)
return dp[a+base][b+base][c+base][d+base][e+base];
double ret=1;
int lefta=alla-(A-a),leftb=allb-(B-b),leftc=allc-(C-c),leftd=alld-(D-d),lefte=alle-(E-e);
int unuse=(lefta>0?lefta:0)+(leftb>0?leftb:0)+(leftc>0?leftc:0)+(leftd>0?leftd:0)+(lefte>0?lefte:0);
// printf("%d %d %d %d %d\n",a,b,c,d,e);
if (lefta>0) ret+=lefta*1.0/unuse*f(a-1,b,c,d,e);
if (leftb>0) ret+=leftb*1.0/unuse*f(a,b-1,c,d,e);
if (leftc>0) ret+=leftc*1.0/unuse*f(a,b,c-1,d,e);
if (leftd>0) ret+=leftd*1.0/unuse*f(a,b,c,d-1,e);
if (lefte>0)
{
double t1,t2;
t1=min(f(a-1,b,c,d,e-1),f(a,b-1,c,d,e-1));
t2=min(f(a,b,c-1,d,e-1),f(a,b,c,d-1,e-1));
ret+=lefte*1.0/unuse*min(t1,t2);
}
dp[a+base][b+base][c+base][d+base][e+base]=ret;
return ret;
}
int main()
{
int runs;
cin>>runs;
for (int r=1;r<=runs;r++)
{
double ans=0;
REP(i,N) REP(j,N) REP(k,N) REP(l,N) REP(m,2) dp[i][j][k][l][m]=-1;
cin>>A>>B>>C>>D; E=2;
alla=allb=allc=alld=13;alle=2;
if (A>13) E-=(A-13),alla+=(A-13); if (B>13) E-=(B-13),allb+=(B-13);
if (C>13) E-=(C-13),allc+=(A-13); if (D>13) E-=(D-13),alld+=(D-13);
alle=E;
if (E<0) ans=-1;
else ans=f(A,B,C,D,E);
if (fabs(ans)<1e-8) ans=0; // fix
printf("Case %d: %.3f\n",r,ans);
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s584329873
|
p00000
|
C
|
j;main(i){for(;j>8?j=i++<9:++j;printf("%dx%d=%d\n",i,j,i*j));}
|
main.c:1:1: warning: data definition has no type or storage class
1 | j;main(i){for(;j>8?j=i++<9:++j;printf("%dx%d=%d\n",i,j,i*j));}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int]
1 | j;main(i){for(;j>8?j=i++<9:++j;printf("%dx%d=%d\n",i,j,i*j));}
| ^~~~
main.c: In function 'main':
main.c:1:3: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:32: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | j;main(i){for(;j>8?j=i++<9:++j;printf("%dx%d=%d\n",i,j,i*j));}
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | j;main(i){for(;j>8?j=i++<9:++j;printf("%dx%d=%d\n",i,j,i*j));}
main.c:1:32: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
1 | j;main(i){for(;j>8?j=i++<9:++j;printf("%dx%d=%d\n",i,j,i*j));}
| ^~~~~~
main.c:1:32: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s256679751
|
p00000
|
C
|
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std;
const int MAXN=1200;
const double pi=acos(-1.0);
const double eps=e-8;
struct point{
double x,y;
};
struct node{
double a;
int ind;
};
node t[MAXN*2];
point p[MAXN];
int s[MAXN][MAXN];
int ss[MAXN][MAXN];
int seg[MAXN][MAXN],sseg[MAXN][MAXN];
double cross(point a,point b,point c){
return (c.x-a.x)*(b.y-a.y)-(b.x-a.x)*(c.y-a.y);
}
bool cmp(node a,node b){
return a.a<b.a;
}
void init(int n){
for(int i=0;i<n;i++){
int cnt=0;
for(int k=0;k<n;k++){
if(i!=k){
t[cnt].ind=k;
t[cnt++].a=atan2(p[k].y-p[i].y,p[k].x-p[i].x);
}
}
sort(t,t+n-1,cmp);
for(int k=0;k<n-1;k++)
s[i][t[k].ind]=k;
for(int k=0;k<n-1;k++){
t[n+k-1].a=t[k].a+2*pi;
t[n+k-1].ind=t[k].ind;
}
int tt=1;
for(int k=0;k<n-1;k++){
while(t[tt].a<t[k].a+pi)
tt++;
if(i<t[k].ind)
seg[i][t[k].ind]=tt-k-1;
}
}
}
void init1(int n){
for(int i=0;i<n;i++){
int cnt=0;
for(int k=0;k<n;k++){
if(i!=k){
t[cnt].ind=k;
t[cnt++].a=atan2(p[k].y-p[i].y,p[k].x-p[i].x);
}
}
sort(t,t+n-1,cmp);
for(int k=0;k<n-1;k++)
ss[i][t[k].ind]=k;
for(int k=0;k<n-1;k++){
t[n+k-1].a=t[k].a+2*pi;
t[n+k-1].ind=t[k].ind;
}
int tt=1;
for(int k=0;k<n-1;k++){
while(t[tt].a<t[k].a+pi)
tt++;
if(i<t[k].ind)
sseg[i][t[k].ind]=tt-k-1;
}
}
}
bool clockwise(point a,point b,point c){
if(cross(a,b,c)>0)
return true;
return false;
}
int compute(int a,int b,int c,int n){
double a1=atan2(p[b].y-p[a].y,p[b].x-p[a].x);
double a2=atan2(p[c].y-p[a].y,p[c].x-p[a].x);
if(a1<=0 && a2>=0)
return n-(s[a][c]-s[a][b])-2;
return s[a][b]-s[a][c]-1;
}
int compute1(int a,int b,int c,int n){
double a1=atan2(p[b].y-p[a].y,p[b].x-p[a].x);
double a2=atan2(p[c].y-p[a].y,p[c].x-p[a].x);
if(a1<=0 && a2>=0)
return n-(s[a][b]-s[a][c])-2;
return s[a][c]-s[a][b]-1;
}
int compute2(int a,int b,int c,int n){
double a1=atan2(p[b].y-p[a].y,p[b].x-p[a].x);
double a2=atan2(p[c].y-p[a].y,p[c].x-p[a].x);
if(a1<=0 && a2>=0)
return n-(ss[a][c]-ss[a][b])-2;
return ss[a][b]-ss[a][c]-1;
}
int compute3(int a,int b,int c,int n){
double a1=atan2(p[b].y-p[a].y,p[b].x-p[a].x);
double a2=atan2(p[c].y-p[a].y,p[c].x-p[a].x);
if(a1<=0 && a2>=0)
return n-(ss[a][b]-ss[a][c])-2;
return ss[a][c]-ss[a][b]-1;
}
main(){
int n,m;
int T=1;
while(scanf("%d%d",&n,&m)!=-1){
for(int i=0;i<n;i++)
scanf("%lf%lf",&p[i].x,&p[i].y);
init(n);
for(int i=0;i<m;i++)
scanf("%lf%lf",&p[i+n].x,&p[i+n].y);
init1(n+m);
int ANS=0;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
for(int k=j+1;k<n;k++){
int a=i,b=j,c=k;
int A1=0,A2=0;
if(clockwise(p[a],p[b],p[c])){
A1+=compute(a,b,c,n);
A1+=compute(b,c,a,n);
A1+=compute(c,a,b,n);
A2+=seg[a][b];
A2+=seg[b][c];
A2+=(n-seg[a][c]-2);
}
else{
A1+=compute1(a,b,c,n);
A1+=compute1(b,c,a,n);
A1+=compute1(c,a,b,n);
A2+=(n-seg[a][b]-2);
A2+=(n-seg[b][c]-2);
A2+=seg[a][c];
}
int ans1=A2+A1-2*(n-3);
A1=0,A2=0;
if(clockwise(p[a],p[b],p[c])){
A1+=compute2(a,b,c,n+m);
A1+=compute2(b,c,a,n+m);
A1+=compute2(c,a,b,n+m);
A2+=sseg[a][b];
A2+=sseg[b][c];
A2+=(n+m-sseg[a][c]-2);
}
else{
A1+=compute3(a,b,c,n+m);
A1+=compute3(b,c,a,n+m);
A1+=compute3(c,a,b,n+m);
A2+=(n+m-sseg[a][b]-2);
A2+=(n+m-sseg[b][c]-2);
A2+=sseg[a][c];
}
int ans=A2+A1-2*(n+m-3);
if((ans-ans1)%2)
ANS++;
}
}
}
printf("Case %d: %d\n",T++,ANS);
}
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s285619068
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
using namespace std;
const int Prime[16] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
const int Orz = 64;
long long N, MaxAP;
int MaxFacNum;
void DFS(int i, int FacNum, int MaxPow, long long AP)
{
if (FacNum>MaxFacNum || (FacNum==MaxFacNum && AP<MaxAP))
{
MaxFacNum = FacNum;
MaxAP = AP;
}
for (int p = 1; p <= MaxPow; ++p)
{
AP = AP * Prime[i];
if (AP > N) return;
DFS(i+1, FacNum*(p+1), p, AP);
}
}
int main()
{
//freopen("D.in", "r", stdin);
//freopen("D.out", "w", stdout);
while (~scanf("%I64d", &N))
{
MaxAP = 0;
MaxFacNum = 0;
DFS(1, 1, Orz, 1);
printf("%I64d\n%d\n", MaxAP, MaxFacNum);
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s003356722
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int gcd(int a,int b){
return b ? gcd(b, a%b) : a;
}
void ExGcd(int a,int b,int &d,int &x,int &y){
if(!b) {d = a;x = 1;y = 0;}
else {ExGcd(b, a%b, d, y, x); y -= x*(a/b);}
}
int main()
{
freopen("in.txt","r",stdin);
int T,a,m;
scanf("%d",&T);
for(int t = 0;t < T;t++){
scanf("%d %d",&a,&m);
if(gcd(a,m) != 1)
puts("Not Exist");
else{
int x,y,d;
ExGcd(a,m,d,x,y);
//printf("%d %d %d %d %d\n",a,m,d,x,y);
int st = ceil(1.0*x/m) - 1;
x += st*m;
printf("%d\n",x);
}
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s706278656
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
double dp[1010][1010][2];
double t[1010][1010][2];
struct node{
double x,c;
int id;
node(){
id=-1;
}
};
node g[1010];
int cmp(node a,node b){
return a.x<b.x;
}
main(){
int n;
double v,p;
while(scanf("%d%lf%lf",&n,&v,&p)!=-1){
memset(dp,0,sizeof(dp));
memset(t,0,sizeof(t));
g[0].x=p/v;g[0].c=0;g[0].id=0;
for(int i=1;i<=n;i++){
scanf("%lf%lf",&g[i].x,&g[i].c);
g[i].x=g[i].x/v;
}
sort(g,g+1+n,cmp);
int tmp;
for(int i=0;i<=n;i++){
if(g[i].id==0)
tmp=i;
}
int left=tmp;
int right=n-tmp;
printf("%d %d\n",left,right);
for(int i=0;i<=left;i++){
for(int j=0;j<=right;j++){
double cnt;
if((i-1)>=0){
cnt=dp[i-1][j][0]+g[tmp-i].c*(t[i-1][j][0]+fabs(g[tmp-i+1].x-g[tmp-i].x));
dp[i][j][0]=cnt;
t[i][j][0]=t[i-1][j][0]+fabs(g[tmp-i+1].x-g[tmp-i].x);
if(dp[i-1][j][1]+g[tmp-i].c*(t[i-1][j][1]+fabs(g[tmp+j].x-g[tmp-i].x))<cnt ||(cnt==dp[i-1][j][1]+g[tmp-i].c*(t[i-1][j][1]+fabs(g[tmp+j].x-g[tmp-i].x)) && t[i-1][j][1]+fabs(g[tmp+j].x-g[tmp-i].x)<t[i][j][0]) ){
dp[i][j][0]=dp[i-1][j][1]+g[tmp-i].c*(t[i-1][j][1]+fabs(g[tmp+j].x-g[tmp-i].x));
t[i][j][0]=t[i-1][j][1]+fabs(g[tmp+j].x-g[tmp-i].x);
}
}
if((j-1)>=0){
//printf("%d %d %lf\n",i,j-1,dp[i][j-1][0]);
cnt=dp[i][j-1][0]+g[tmp+j].c*(t[i][j-1][0]+fabs(g[tmp-i].x-g[tmp+j].x));
dp[i][j][1]=cnt;
t[i][j][1]=t[i][j-1][0]+fabs(g[tmp-i].x-g[tmp+j].x);
printf("%d %d %lf\n",i,j,t[i][j][1]);
if(dp[i][j-1][1]+g[tmp+j].c*(t[i][j-1][1]+fabs(g[tmp+j-1].x-g[tmp+j].x))<cnt ||(dp[i][j-1][1]+g[tmp+j].x*(t[i][j-1][1]+fabs(g[tmp+j-1].x-g[tmp+j].x))==cnt && t[i][j][1]>t[i][j-1][1]+fabs(g[tmp+j-1].x-g[tmp+j].x))){
dp[i][j][1]=dp[i][j-1][1]+g[tmp+j].c*(t[i][j-1][1]+fabs(g[tmp+j-1].x-g[tmp+j].x));
t[i][j][1]=t[i][j-1][1]+fabs(g[tmp+j-1].x-g[tmp+j].x);
}
}
printf("%lf\n",dp[i][j][1]);
}
}
double ans=dp[left][right][0];
if(dp[left][right][1]<ans)
ans=dp[left][right][1];
printf("%lf\n",ans);
}
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s705152183
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#define M (1<<15)
#define MAX (1<<16)
using namespace std;
int Tree[MAX];
void add(int s,int t) {
int i(1);
for(s = s+M-1,t = t+M+1;s^t^1;s>>=1,t>>=1,i<<=1) {
if(~s&1) Tree[s^1]+=i;
if( t&1) Tree[t^1]+=i;
}
}
int query(int s) {
int res(0);
s+=M;
while(s) res+=Tree[s], s>>=1;
return res;
}
int main() {
int _,n,Q,cd,ca(0),left;
char op[10];
queue<int> q;
cin>>_;
while(_--) {
memset(Tree,0,sizeof(Tree));
cin>>n>>Q>>cd;
left = n;
printf("Case %d:\n",++ca);
while(!q.empty()) q.pop();
for(int i(0);i!=Q;++i) {
scanf("%s",op);
if(op[0]=='A') {
int s,t;
scanf("%d%d",&s,&t);
if(q.size()==cd) left+=q.front(), q.pop();
if(t-s+1<=left) q.push(t-s+1), left-=(t-s+1);
else q.push(left), add(s+left,t), left = 0;
} else {
int s;
scanf("%d",&s);
printf("%d\n",query(s));
}
}
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s188400233
|
p00000
|
C
|
#include <cstdio>
#include <cmath>
#define eps 1e-4
double len[110],PI=acos(-1.0);
int n;
double cals(double bc)
{
int i;
double p,ans=0;
for(i=1;i<n;i++)
{
p=(len[i]+len[i+1]+bc)/2.0;
ans+=sqrt(p*(p-len[i])*(p-len[i+1])*(p-bc));
}
p=(len[1]+len[n]+bc)/2.0;
ans+=sqrt(p*(p-len[1])*(p-len[n])*(p-bc));
return ans;
}
int main()
{
int nt,z,flag;
int i,j;
double l,r,mid,midmid,s,ss,midv,midmidv,tmp;
double ans,nowans;
double a,b,c,t;
scanf("%d",&nt);
for(z=1;z<=nt;z++)
{
scanf("%d",&n);
for(i=1;i<=n;i++) scanf("%lf",&len[i]);
l=0,r=20000,mid=30000;
while(r-l>eps)
{
mid=(l+r)/2.0;
tmp=0;
for(i=1;i<n;i++)
tmp+=acos((len[i]*len[i]+len[i+1]*len[i+1]-mid*mid)/2.0/len[i]/len[i+1]);
tmp+=acos((len[1]*len[1]+len[n]*len[n]-mid*mid)/2.0/len[1]/len[n]);
if(tmp>2*PI) r=mid-eps;
else l=mid+eps;
}
ans=mid;
flag=1;
if(mid<eps||mid>20000-eps) flag=0;
for(i=1;i<n&&flag;i++)
{
a=len[i],b=len[i+1],c=ans;
if(a<b) t=a,a=b,b=t;
if(a<c) t=a,a=c,c=t;
if(b<c) t=b,b=c,c=t;
if(b+c<=a) flag=0;
}
a=len[1],b=len[n],c=ans;
if(a<b) t=a,a=b,b=t;
if(a<c) t=a,a=c,c=t;
if(b<c) t=b,b=c,c=t;
if(b+c<=a) flag=0;
if(1) printf("Case %d: %.3lf\n",z,ans);
else printf("Case %d: impossible\n",z);
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s959561428
|
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×%d=%d",i,j,i*j)
}
}
return 0;
}
|
main.c: In function 'main':
main.c:6:31: error: expected ';' before '}' token
6 | printf("%d×%d=%d",i,j,i*j)
| ^
| ;
7 | }
| ~
|
s657599906
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
typedef double DB;
const int N = 100010;
set<pair<int,int> > st;
set<pair<int,int> >::iterator it;
pair<int,int> a[N],b;
int main(void) {
int n,t,res;
scanf("%d",&t);
while(t--) {
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%d%d",&a[i].first,&a[i].second);
st.clear();
for(int i=0;i<n;i++) {
scanf("%d%d",&b.first,&b.second);
st.insert(b);
}
for(int i=res=0;i<n;i++) {
it=st.lower_bound(a[i]);
if(it==st.begin()) {
if(!(a[i].first>=(*it).first&&a[i].second>=(*it).second)) continue;
}
else it--;
if(a[i].first>=(*it).first && a[i].second>=(*it).second ) {
res++;
st.erase(it);
}
}
printf("%d\n",res);
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s451318400
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#include <map>
using namespace std;
const int MAX = 100010;
int arr[MAX],n,tot;
int low(int x)
{
return x&(-x);
}
void add(int pos,int v)
{
for(int i=pos; i<=tot; i+=low(i))
arr[i] += v;
}
int sum(int pos)
{
int ret = 0;
for(int i=pos; i; i-=low(i))
ret += arr[i];
return ret;
}
#define clr(a,b) memset(a,b,sizeof(a))
int T;
struct st
{
int h,w;
}a[MAX],b[MAX];
bool cmp(const st&a, const st& b)
{
if(a.h == b.h) return a.w < b.w;
return a.h < b.h;
}
int num[MAX*2];
map<int,int> hash;
int main()
{
//freopen("in","r",stdin);
scanf("%d",&T);
while(T--)
{
hash.clear();
scanf("%d",&n);
for(int i=1; i<=n; i++) scanf("%d%d",&a[i].h, &a[i].w);
for(int i=1; i<=n; i++) scanf("%d%d",&b[i].h, &b[i].w);
sort(a+1,a+1+n,cmp);
sort(b+1,b+1+n,cmp);
for(int i=1; i<=n; i++) num[i] = a[i].w;
for(int i=1; i<=n; i++) num[i+n] = b[i].w;
sort(num+1,num+1+2*n);
// for(int i=1; i<=2*n; i++)
// printf("%d ",num[i]);
// puts("");
int q = unique(num+1,num+1+2*n) - (num+1);
tot = q;
// printf("q:%d\n",q);
// for(int i=1; i<=q; i++)
// printf("%d ",num[i]);
// puts("");
for(int i=1; i<=q; i++) hash.insert( make_pair(num[i],i) );
int ans = 0;
clr(arr,0);
int p = 1, pre = 1;
for(int i=1; i<=n; )
{
while(a[i].h == a[i+1].h) i++;
for(; p<=n && b[p].h <= a[i].h; p++)
{
int t = hash[b[p].w];
add(t, 1);
}
for(; pre<=i; pre++)
{
int t = hash[ a[pre].w ];
int s = sum( t );
if(s > 0)
{
ans ++;
add(t, -1);
}
}
i++;
pre=i;
}
printf("%d\n",ans);
}
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s720339611
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#include <map>
using namespace std;
const int MAX = 100010;
int arr[2*MAX],arr2[2*MAX],n,tot;
int low(int x)
{
return x&(-x);
}
void add(int arr[], int pos,int v)
{
for(int i=pos; i<=tot; i+=low(i))
arr[i] += v;
}
int sum(int arr[], int pos)
{
int ret = 0;
for(int i=pos; i; i-=low(i))
ret += arr[i];
return ret;
}
int find(int arr[], int x)
{
int pos = 0;
for(int i=1<<18; i>=1; i>>=1)
{
if(pos+i < n && arr[i+pos])
{
x-=arr[i+pos];
pos += i;
}
}return pos+1;
}
#define clr(a,b) memset(a,b,sizeof(a))
int T;
struct st
{
int h,w;
}a[MAX],b[MAX];
bool cmp(const st&a, const st& b)
{
if(a.h == b.h) return a.w < b.w;
return a.h < b.h;
}
int num[MAX*2];
map<int,int> hash;
int main()
{
//freopen("in","r",stdin);
scanf("%d",&T);
while(T--)
{
hash.clear();
scanf("%d",&n);
for(int i=1; i<=n; i++) scanf("%d%d",&a[i].h, &a[i].w);
for(int i=1; i<=n; i++) scanf("%d%d",&b[i].h, &b[i].w);
sort(a+1,a+1+n,cmp);
sort(b+1,b+1+n,cmp);
for(int i=1; i<=n; i++) num[i] = a[i].w;
for(int i=1; i<=n; i++) num[i+n] = b[i].w;
sort(num+1,num+1+2*n);
int q = unique(num+1,num+1+2*n) - (num+1);
tot = q;
for(int i=1; i<=q; i++) hash.insert( make_pair(num[i],i) );
int ans = 0;
clr(arr,0),clr(arr2,0);
int p = 1, pre = 1;
for(int i=1; i<=n; )
{
while(a[i].h == a[i+1].h) i++;
for(; p<=n && b[p].h <= a[i].h; p++)
{
int t = hash[b[p].w];
add(arr, t, 1);
if(sum(arr,t) - sum(arr,t-1) == 1)
add(arr2, t, 1);
}
for(; pre<=i; pre++)
{
int t = hash[ a[pre].w ];
int cnt = sum(arr2,t);
if(cnt > 0)
{
int pp = find(arr2, cnt);
add(arr,pp,-1);
if(sum(arr,pp)-sum(arr,pp-1) == 0)
add(arr2,pp,-1);
ans++;
}
}
i++;
pre=i;
}
printf("%d\n",ans);
}
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s007684160
|
p00000
|
C
|
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<set>
#include<iostream>
using namespace std;
int a[20],c[3],n,t;
typedef pair<int,int>p;
set<p>s;
void dfs(int k)
{
if(k==n)
{
int d[3];
for(int i=0;i<3;i++) d[i]=c[i];
sort(d,d+3);
for(int i=0;i<3;i++) if(c[i]!=d[i]) return;
if(d[2]>=d[1]+d[0]||d[0]==0||d[1]==0||d[2]==0) return;
s.insert(p(d[0],d[1]));
return;
}
for(int i=0;i<3;i++)
{
c[i]+=a[k];
dfs(k+1);
c[i]-=a[k];
}
}
int main()
{
cin>>t;
while(t--)
{
s.clear();
cin>>n;
memset(c,0,sizeof(c));
for(int i=0;i<n;i++) cin>>a[i];
dfs(0);
cout<<s.size()<<endl;
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s390244469
|
p00000
|
C
|
200
0 1 0 0
0 2 0 0
0 3 0 0
0 4 0 0
0 5 0 0
1 6 1 1
0 7 0 1
1 8 1 2
1 9 1 3
1 10 3 4
0 11 0 4
1 12 3 5
0 13 0 5
1 14 5 6
0 15 4 6
0 16 4 6
0 17 0 6
1 18 7 7
0 19 0 7
1 20 7 8
0 21 6 8
1 22 9 9
0 23 0 9
1 24 9 10
1 25 3 11
1 26 11 12
0 27 6 12
1 28 11 13
0 29 0 13
1 30 15 14
0 31 0 14
1 32 11 15
0 33 10 15
1 34 15 16
0 35 8 16
0 36 16 16
0 37 0 16
1 38 17 17
0 39 12 17
1 40 17 18
0 41 0 18
1 42 23 19
0 43 0 19
1 44 19 20
0 45 16 20
1 46 21 21
0 47 0 21
1 48 23 22
1 49 5 23
1 50 25 24
0 51 16 24
1 52 23 25
0 53 0 25
1 54 29 26
0 55 12 26
1 56 25 27
0 57 18 27
1 58 27 28
0 59 0 28
1 60 33 29
0 61 0 29
1 62 29 30
0 63 22 30
0 64 26 30
0 65 14 30
1 66 39 31
0 67 0 31
1 68 31 32
0 69 22 32
1 70 39 33
0 71 0 33
1 72 37 34
0 73 0 34
1 74 35 35
0 75 30 35
1 76 35 36
0 77 14 36
1 78 47 37
0 79 0 37
1 80 39 38
1 81 23 39
1 82 39 40
0 83 0 40
1 84 49 41
0 85 18 41
1 86 41 42
0 87 28 42
1 88 41 43
0 89 0 43
1 90 55 44
0 91 16 44
1 92 43 45
0 93 30 45
1 94 45 46
0 95 20 46
1 96 53 47
0 97 0 47
1 98 51 48
0 99 34 48
0 100 52 48
0 101 0 48
1 102 63 49
0 103 0 49
1 104 49 50
0 105 50 50
1 106 51 51
0 107 0 51
1 108 61 52
0 109 0 52
1 110 63 53
0 111 36 53
1 112 55 54
0 113 0 54
1 114 71 55
0 115 24 55
1 116 55 56
0 117 40 56
1 118 57 57
0 119 20 57
1 120 73 58
1 121 9 59
1 122 59 60
0 123 40 60
1 124 59 61
0 125 22 61
1 126 79 62
0 127 0 62
1 128 57 63
0 129 42 63
1 130 75 64
0 131 0 64
1 132 81 65
0 133 22 65
1 134 65 66
0 135 56 66
1 136 65 67
0 137 0 67
1 138 87 68
0 139 0 68
1 140 81 69
0 141 46 69
1 142 69 70
0 143 20 70
0 144 82 70
0 145 30 70
1 146 71 71
0 147 58 71
1 148 71 72
0 149 0 72
1 150 99 73
0 151 0 73
1 152 73 74
0 153 52 74
1 154 87 75
0 155 32 75
1 156 97 76
0 157 0 76
1 158 77 77
0 159 52 77
1 160 85 78
0 161 26 78
1 162 99 79
0 163 0 79
1 164 79 80
0 165 78 80
1 166 81 81
0 167 0 81
1 168 105 82
1 169 11 83
1 170 99 84
0 171 58 84
1 172 83 85
0 173 0 85
1 174 111 86
0 175 50 86
1 176 87 87
0 177 58 87
1 178 87 88
0 179 0 88
1 180 115 89
0 181 0 89
1 182 103 90
0 183 60 90
1 184 89 91
0 185 38 91
1 186 119 92
0 187 24 92
1 188 91 93
0 189 74 93
1 190 111 94
0 191 0 94
1 192 115 95
0 193 0 95
1 194 95 96
0 195 92 96
0 196 104 96
0 197 0 96
1 198 127 97
0 199 0 97
1 200 109 98
0
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 200
| ^~~
|
s626001412
|
p00000
|
C
|
1 0
2 0
3 0
4 0
5 0
6 1
7 1
8 2
9 3
10 4
11 4
12 5
13 5
14 6
15 6
16 6
17 6
18 7
19 7
20 8
21 8
22 9
23 9
24 10
25 11
26 12
27 12
28 13
29 13
30 14
31 14
32 15
33 15
34 16
35 16
36 16
37 16
38 17
39 17
40 18
41 18
42 19
43 19
44 20
45 20
46 21
47 21
48 22
49 23
50 24
51 24
52 25
53 25
54 26
55 26
56 27
57 27
58 28
59 28
60 29
61 29
62 30
63 30
64 30
65 30
66 31
67 31
68 32
69 32
70 33
71 33
72 34
73 34
74 35
75 35
76 36
77 36
78 37
79 37
80 38
81 39
82 40
83 40
84 41
85 41
86 42
87 42
88 43
89 43
90 44
91 44
92 45
93 45
94 46
95 46
96 47
97 47
98 48
99 48
100 48
101 48
102 49
103 49
104 50
105 50
106 51
107 51
108 52
109 52
110 53
111 53
112 54
113 54
114 55
115 55
116 56
117 56
118 57
119 57
120 58
121 59
122 60
123 60
124 61
125 61
126 62
127 62
128 63
129 63
130 64
131 64
132 65
133 65
134 66
135 66
136 67
137 67
138 68
139 68
140 69
141 69
142 70
143 70
144 70
145 70
146 71
147 71
148 72
149 72
150 73
151 73
152 74
153 74
154 75
155 75
156 76
157 76
158 77
159 77
160 78
161 78
162 79
163 79
164 80
165 80
166 81
167 81
168 82
169 83
170 84
171 84
172 85
173 85
174 86
175 86
176 87
177 87
178 88
179 88
180 89
181 89
182 90
183 90
184 91
185 91
186 92
187 92
188 93
189 93
190 94
191 94
192 95
193 95
194 96
195 96
196 96
197 96
198 97
199 97
200 98
|
main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 1 0
| ^
|
s420496646
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
using namespace std;
#define F first
#define S second
#define MP(x, y) make_pair(x, y)
typedef unsigned long long LL;
LL cal(LL x)
{
if (x<=2) return 0;
LL y=(LL)sqrt(x*1.0);
if ((y+1)*(y+1)<=x) y++;
LL res=x/2-y/2+(y-1)/2-1;
//cout<<x<<' '<<res<<endl;
return res;
}
int main()
{
LL l,r;
int o;
//asdfasdfasdf
/*for(int i = 2; i <= 1000; i++)
cout << i<<" " <<cal((LL)i) << endl;
*/
scanf("%d",&o);
while (o--)
{
//scanf("%I64u%I64u",&l,&r);
//printf("%I64u\n",cal(r)-cal(l-1));
long long ll, rr;
//cin >>ll>>rr;
scanf("%I64d%I64d", &ll, &rr);
//cin>>l>>r;
//cout<<cal(r)-cal(l-1)<<endl;
l = ll, r = rr;
long long ans = (long long)(cal(r)-cal(l-1));
printf("%I64d\n", ans);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s295826964
|
p00000
|
C
|
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int num[50];
double dp[50];
double dfs(int l,bool e)
{
if(l==-1) return 1;
if(!e&&dp[l]!=-1) return dp[l];
int u=e?num[l]:1;
double res=0;
for(int i=0;i<=u;i++)
{
res+=((double)1/((double)2*l)+(double)(l-1)/l*dfs(l-1,e&&i==u));
}
return e? res:dp[l];
}
double solve(int n)
{
int l=0;
while(n)
{
num[l++]=(n&1);
n>>=1;
}
return dfs(l-1,1);
}
int main()
{
int t,a,b;
scanf("%d",&t);
memset(dp,-1,sizeof(dp));
while(t--)
{
scanf("%d%d",&a,&b);
printf("%.6f",(a*solve(a)+b*solve(b))/(double)(a-b));
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s066882639
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<string.h>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;
#define maxn 1009
#define maxm 300000
#define inf (1<<29)
struct edge{
int v,flow;
int next;
};
edge e[maxm];
int start[maxn];
int nn,n,m,s,t;
int sum;
void init(){
memset(start,-1,sizeof(start));
nn=0;
}
void addedge(int u,int v,int flow){
e[nn].v=v;
e[nn].flow=flow;
e[nn].next=start[u];
start[u]=nn++;
e[nn].v = u;
e[nn].flow = 0;
e[nn].next = start[v];
start[v] = nn++;
}
int h[maxn],gap[maxn];
int dfs(int pos,int cost){
if(pos==t) return cost;
int mi=sum-1;
int lv=cost,d;
for(int i=start[pos];i!=-1;i=e[i].next){
int v=e[i].v;
int fl=e[i].flow;
if(fl>0){
if(h[v]+1==h[pos]){
d=min(fl,lv);
d=dfs(v,d);
e[i].flow-=d;
e[i^1].flow+=d;
lv-=d;
if(h[s]>=sum) return cost-lv;
if(!lv) break;
}
mi=min(mi,h[v]);
}
}
if(lv==cost){
--gap[h[pos]];
if(!gap[h[pos]]) h[s]=sum;
h[pos]=mi+1;
++gap[h[pos]];
}
return cost-lv;
}
int sap(){
memset(gap,0,sizeof(gap));
memset(h,0,sizeof(h));
gap[s]=sum;
int res=0;
while(h[s]<sum) res+=dfs(s,inf);
return res;
}
char str[309];
int main(){
int F,D;
while(scanf("%d %d %d",&n,&F,&D)==3){
init();
s = 0;t = F+D+n+1;
sum = t+1;
for(int i=1;i<=F;i++){
int w;
scanf("%d",&w);
addedge(s,i,w);
}
for(int i=1;i<=D;i++){
int w;
scanf("%d",&w);
addedge(F+n+i,t,w);
}
for(int i=1;i<=n;i++){
scanf("%s",str);
for(int j=1;j<=F;j++){
if(str[j-1]=='Y') addedge(j,F+i,1);
}
}
for(int i=1;i<=n;i++){
scanf("%s",str);
for(int j=1;j<=D;j++){
if(str[j-1]=='Y') addedge(F+i,F+n+j,1);
}
}
int res = sap();
printf("%d\n",res);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s832122074
|
p00000
|
C
|
#include<stdio.h>
#include<string.h>
#define clr(x,y) memset(x,y,sizeof(x))
#include<algorithm>
#define ll long long
using namespace std;
const int inf=2000000000;
int i,j,n;
struct item{
int l,r,num;
bool flag;
}a[1000];
int idx[1000];
bool cmp(const item &a,const item &b){
if(a.flag!=b.flag) return a.flag<b.flag;
else return a.r<b.r;
}
int main(){
// freopen("d:\\in.txt","r",stdin);
while(scanf("%d",&n)!=EOF){
clr(a,0);
for(i=1;i<=n;i++){
int l,r;
scanf("%d%d",&l,&r);
a[i].l=l+1;
a[i].r=n-r;
a[i].num=1;
a[i].flag=0;
}
for(i=1;i<=n;i++){
if(a[i].flag) continue;
for(j=i+1;j<=n;j++){
if(a[j].flag) continue;
if(a[i].l==a[j].l&&a[i].r==a[j].r){
a[i].num++;
a[j].flag=1;
}
}
}
for(i=1;i<=n;i++){
if(a[i].flag) continue;
if(a[i].l<=0||a[i].r>n){
a[i].flag=1;
continue;
}
if(a[i].num>(a[i].r-a[i].l+1)){
a[i].num=a[i].r-a[i].l+1;
}
}
clr(idx,0);
sort(a+1,a+n+1,cmp);
for(i=1;i<=n;i++){
if(a[i].flag) break;
int maxx=0;
for(j=1;j<a[i].l;j++)
maxx=max(maxx,idx[j]);
idx[a[i].r]=maxx+a[i].num;
}
int maxx=0;
for(i=1;i<=n;i++) maxx=max(idx[i],maxx);
printf("%d\n",n-maxx);
}
return 0;
}
|
main.c:4:9: fatal error: algorithm: No such file or directory
4 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s350923104
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <queue>
#include <ctime>
using namespace std;
template <class T> void checkmin(T &t,T x){if (x < t) t = x;}
template <class T> void checkmax(T &t,T x){if (x > t) t = x;}
template <class T> void _checkmin(T &t, T x){if (t == -1) t = x; if (x < t) t = x;}
template <class T> void _checkmax(T &t, T x){if (t == -1) t = x; if (x > t) t = x;}
typedef pair <int,int> PII;
typedef pair <double,double> PDD;
typedef long long lld;
#define foreach(it,v) for (__typeof((v).begin()) it = (v).begin();it != (v).end();it++)
#define DEBUG(a) cout << #a" = " << (a) << endl;
#define DEBUGARR(a, n) for (int i = 0; i < (n); i++) { cout << #a"[" << i << "] = " << (a)[i] << endl; }
const int full = 1 << 4;
char s[4100];
int len[4];
char st[4][70];
bool ok[4100][4];
int f[4100][70][1 << 4];
int main(){
#ifdef cwj
freopen("in", "r", stdin);
#endif
while (scanf("%s", s + 1) != EOF) {
int m = 0;
for (int i = 0; i < 4; i++) {
scanf("%s", st[i]);
len[i] = strlen(st[i]);
checkmax(m, len[i]);
}
memset(ok, 0, sizeof(ok));
int n = strlen(s + 1);
for (int i = 1; i <= n; i++) {
for (int j = 0; j < 4; j++) {
bool o = 1;
for (int k = 0; k < len[j]; k++) {
if (st[j][k] != s[i + k]) {
o = 0;
break;
}
}
ok[i][j] = o;
}
}
for (int i = 0; i < 4; i++) {
for (int j = 1; j <= n; j++) {
printf("%d", ok[j][i]);
}
puts("");
}
int ansmin = -1;
int ansmax = -1;
for (int i = 0; i <= n; i++) {
for (int j = 0; j < m; j++) {
for (int k = 0; k < full; k++) {
f[i][j][k] = -1;
}
}
}
f[0][0][0] = 0;
for (int i = 0; i <= n; i++) {
for (int j = 0; j < m; j++) {
for (int k = 0; k < full; k++) {
if (f[i][j][k] != -1) {
if (i == n) continue;
for (int o = 0; o < 4; o++) {
if (!(k & 1 << o) && ok[i + 1][o]) {
_checkmax(f[i + 1][max(j - 1, len[o] - 1)][k | 1 << o]
, f[i][j][k] + 1);
}
if (!(k & 1 << o) && ok[i][o]) {
_checkmax(f[i][max(j, len[o] - 1)][k | 1 << o], f[i][j][k]);
}
}
if (j) {
_checkmax(f[i + 1][j - 1][k], f[i][j][k] + 1);
} else {
_checkmax(f[i + 1][0][k], f[i][j][k]);
}
}
}
}
}
for (int i = 0; i <= n; i++) {
if (f[i][0][full - 1] != -1)
_checkmax(ansmax, f[i][0][full - 1]);
}
for (int i = 0; i <= n; i++) {
for (int j = 0; j < m; j++) {
for (int k = 0; k < full; k++) {
f[i][j][k] = -1;
}
}
}
f[0][0][0] = 0;
for (int i = 0; i <= n; i++) {
for (int j = 0; j < m; j++) {
for (int k = 0; k < full; k++) {
if (f[i][j][k] != -1) {
if (i == n) continue;
for (int o = 0; o < 4; o++) {
if (!(k & 1 << o) && ok[i + 1][o]) {
_checkmin(f[i + 1][max(j - 1, len[o] - 1)][k | 1 << o]
, f[i][j][k] + 1);
}
if (!(k & 1 << o) && ok[i][o]) {
_checkmin(f[i][max(j, len[o] - 1)][k | 1 << o], f[i][j][k]);
}
}
if (j) {
_checkmin(f[i + 1][j - 1][k], f[i][j][k] + 1);
} else {
_checkmin(f[i + 1][0][k], f[i][j][k]);
}
}
}
}
}
for (int i = 0; i <= n; i++) {
if (f[i][0][full - 1] != -1) {
_checkmin(ansmin, f[i][0][full - 1]);
cout << i << " " << 0 << " " << full - 1 << " " << f[i][0][full - 1] << endl;
}
}
printf("%d %d\n", ansmin, ansmax);
}
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s347648666
|
p00000
|
C
|
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N = 3;
typedef long long LOL;
LOL a[N][N],b[N][N],g[N][N],c[N][N];
LOL dp[100];
LOL mod1=1000000007ll;
LOL mod2=1000000006ll;
LOL mod3=500000002ll;
int sz;
//17
void matcopy(LOL a[N][N],LOL b[N][N])
{
for(int i=1;i<=sz;i++){
for(int j=1;j<=sz;j++){
a[i][j]=b[i][j];
}
}
}
void matmul(LOL a[N][N],LOL b[N][N],LOL mod)
{
memset(c,0,sizeof(c));
for(int i=1;i<=sz;i++){
for(int j=1;j<=sz;j++){
if(a[i][j]){
for(int k=1;k<=sz;k++){
c[i][k]+=a[i][j]*b[j][k];
if(c[i][k]>mod) c[i][k]%=mod;
}
}
}
}
matcopy(a,c);
}
void Debug(LOL a[N][N])
{
for(int i=1;i<=sz;i++)
{
for(int j=1;j<=sz;j++)
{
cout<<a[i][j]<<" ";
}
printf("\n");
}
}
void matpow(LOL a[N][N],LOL x,LOL mod)
{
memset(b,0,sizeof(b));
for(int i=1;i<=sz;i++){
b[i][i]=1;
}
while(x!=0)
{
if(x%2) matmul(b,a,mod);
matmul(a,a,mod);
x/=2;
}
matcopy(a,b);
}
void init()
{
a[1][1]=3;a[1][2]=1;
a[2][1]=1;a[2][2]=0;
g[1][1]=1,g[1][2]=0;
g[2][1]=0;g[2][2]=0;
}
//36816094379414890
int main(void)
{
dp[0]=0;dp[1]=1;
for(int i=2;i<=20;i++){
dp[i]=dp[i-1]*3+dp[i-2];
}
sz=2;
init();
LOL n;
while(cin>>n){
LOL x,y;
init();
if(n<=17){
x=dp[n]%mod3;
}else{
matpow(a,n-1,mod3);
matmul(g,a,mod3);
x=g[1][1];
}
init();
cout<<x<<endl;
if(x<=17){
y=dp[x]%mod2;
}else{
matpow(a,(x-1)%mod3+mod3,mod2);
matmul(g,a,mod2);
y=g[1][1];
}
cout<<y<<endl;
init();
if(y<=17){
cout<<dp[y]%mod1<<endl;
}else{
matpow(a,(y-1)%mod2+mod2,mod1);
matmul(g,a,mod1);
cout<<g[1][1]<<endl;
}
}
return 0;
}
/*
* 4
33
658518329
965544979*/
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s951945659
|
p00000
|
C
|
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
struct Node {
int x, y;
friend bool operator <(struct Node a, struct Node b) {
if (a.y != b.y)
return a.y > b.y;
return a.x < b.x;
}
friend bool operator ==(struct Node a, struct Node b) {
return a.x == b.x && a.y == b.y;
}
};
#define N 510
#define INF 1000100
int dp[N];
struct Node d[N];
void init(int n) {
for (int i = 0; i < n; i++) {
dp[i] = -INF;
}
dp[n] = 0;
}
int main() {
setvbuf(stdout,NULL,_IONBF,0);
int n;
while (scanf(" %d", &n) == 1) {
init(n);
memset(d,-1,sizeof(d));
for (int i = 0; i < n; i++) {
scanf(" %d %d", &d[i].x, &d[i].y);
}
sort(d, d + n);
for (int i = 0, j = n - 1; i < n&&d[i].y>=0; i++) {
// if (d[i].x + d[i].y >= n) {
// continue;
// }
while (j > d[i].y) {
dp[j] = max(dp[j],dp[j+1]);
// printf("j:%d\n",j);
// dp[j]=dp[j+1];
j--;
}
int k = 1;
while (d[i] == d[i + 1] && i < n - 1) {
k++;
i++;
}
for (int e = 1; e + j <= n && e <= k&&e<=n-d[i].x-d[i].y; e++) {
//printf("%d %d\n",j,j+e);
dp[j] = max(dp[j + e]+e, dp[j]);
}
// printf("(%d,%d)---",d[i].x,d[i].y);
// printf("(%d,%d) (%d,%d)\n",d[i].x,d[i].y,d[i+1].x,d[i+1].y);
// printf("dp[%d]:%d\n",j,dp[j]);
// if(d[i].y != d[i+1].y){
// printf("(%d,%d) (%d,%d)\n",d[i].x,d[i].y,d[i+1].x,d[i+1].y);
// j --;
// }
}
int ans = 0;
for (int i = 0; i <= n; i++) {
// printf("dp[%d]:%d\n",i,dp[i]);
ans = max(ans, dp[i]);
}
printf("%d\n", ans);
}
return 0;
}
/*
5
4 0
3 1
2 2
3 1
4 0
5
4 0
3 1
2 2
1 3
0 4
5
0 4
1 3
2 0
2 0
2 0
5
0 4
1 0
1 0
1 0
1 0
5
0 4
1 1
1 1
1 1
4 0
5
0 1
1 1
1 1
1 1
4 0
5
0 4
1 3
2 0
2 1
2 0
3
0 0
0 0
0 0
*/
|
main.c:2:9: fatal error: algorithm: No such file or directory
2 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s966496869
|
p00000
|
C
|
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define N 510
using namespace std;
int n;
int dp[N];
struct nd
{
int a,b;
int v;
bool operator == (const nd &p) const
{
return a==p.a&&b==p.b;
}
}nod[N];
bool cmp(nd a,nd b)
{
if(a.b!=b.b)
return a.b<b.b;
return a.a>b.a;
}
int main()
{
//freopen("in","r",stdin);
while(scanf("%d",&n)!=EOF)
{
int cp=0;
for(int i=1;i<=n;i++)
{
int p,q;
scanf("%d%d",&p,&q);
if(p+q+1>n)continue;
nod[cp].a=p+1;
nod[cp].b=n-q;
nod[cp++].v=0;
}
sort(nod,nod+cp,cmp);
int yu=unique(nod,nod+cp)-nod;
for(int i=0;i<yu;i++)
{
int cnt=0;
for(int j=0;j<cp;j++) cnt+=nod[i]==nod[j];
nod[i].v=cnt;
}
memset(dp,0,sizeof(dp));
for(int i=0;i<=n;i++)
{
for(int j=yu-1;j>=0;j--)
{
if(nod[j].b<=i)
{
dp[i]=max(dp[i],dp[nod[j].a-1]+nod[j].v);
}
}
}
printf("%d\n",dp[n]);
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s893491041
|
p00000
|
C
|
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string.h>
#include <vector>
#include <map>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define MP make_pair
const int V = 100000;
int a[V];
struct Node {
int ugly;
char direct;
int next;
};
Node data[100][2];
int main() {
//freopen("beavers.in","r",stdin);
//freopen("beavers.out","w",stdout);
char str[100];
for (int i = 0; i < 5; ++i) {
for (int j = 0; j < 2; ++j) {
scanf("%s",str);
data[i][j].ugly = (str[0] == '1');
data[i][j].direct = str[1];
data[i][j].next = str[2]-'A';
//printf("data[%d][%d] = %d %c %d\n",i,j,data[i][j].ugly, data[i][j].direct, data[i][j].next);
}
}
for (int i = 0; i < V; ++i) a[i] = 0;
const int zero = V / 2;
int pos = zero, state = 0;
bool find = false;
for (int run = 0; run < 10000; ++run) {
if (state >= 5) {
find = true;
break;
}
const Node& v = data[state][a[pos]];
//printf("run[%d] = %d %c %d\n",run, pos-zero, state+'A', a[pos]);
state = v.next;
a[pos] = v.ugly;
pos = (v.direct == 'R')? pos+1 : pos-1;
}
if (find)
puts("happy beaver");
else
puts("unhappy beaver");
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s076853562
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <climits>
#define clr(x) memset ( (x) , 0 , sizeof ( x ) )
#define Mp make_pair
#define Pb push_back
using namespace std ;
typedef long long LL ;
typedef pair<int,int> Pr ;
const double eps = 1e-6 ;
const int Inf = INT_MAX ;
const int N = 400005 ;
const int M = 400000 ;
int q[N] , a[N] , vis[N] ;
int cases , n , m , num ;
LL sum[N] ;
vector<int> vec ;
void init() {
vec.clear() ;
clr ( q ) , clr ( a ) , clr ( vis ) ;
num = 0 ;
}
LL calc ( int x , int y , int t ) {
if ( t > y || t < x ) return 0 ;
LL res = 0 ;
int l = x / t * t ;
if ( l < x ) l += t ;
int r = y / t * t ;
if ( r > y ) r -= t ;
if ( l <= r ) {
int num = ( r - l ) / t + 1 ;
res += (LL)( l + r ) * num / 2 ;
}
return res ;
}
LL dfs ( int u , int num , vector<int>& vec , int x , int y , int cur , int sum ) {
if ( u >= vec.size() ) {
if ( num == cur ) return calc ( x , y , sum ) ;
return 0 ;
}
if ( num == cur ) return 0 ;
return dfs ( u + 1 , num , vec , x , y , cur , sum ) + dfs ( u + 1 , num , vec , x , y , cur + 1 , sum * vec[u] ) ;
}
bool check ( int x , vector<int>& vec ) {
for ( int i = 0 ; i < vec.size() ; ++i ) {
if ( x % vec[i] == 0 ) return 0 ;
}
return 1 ;
}
LL solve ( int x , int y , int z , int cur ) {
vec.clear() ;
int t = z ;
for ( int i = 2 ; i * i <= t ; ++i )
if ( t % i == 0 ) {
vec.Pb ( i ) ;
while ( t % i == 0 ) t /= i ;
}
if ( t > 1 ) vec.Pb ( t ) ;
int l , r ;
LL res = 0 ;
for ( int i = 0 ; i < vec.size() ; ++i ) {
res += calc ( x , y , vec[i] ) ;
}
res = (LL)( x + y ) * ( y - x + 1 ) / 2 - res ;
int sgn = 1 ;
for ( int i = 2 ; i <= vec.size() ; ++i ) {
res += sgn * dfs ( 0 , i , vec , x , y , 0 , 1 ) ;
sgn *= -1 ;
}
for ( int i = 1 ; i < cur ; ++i )
if ( q[i] > 0 && vis[ q[i] ] == i ) {
if ( check ( q[i] , vec ) ) res -= q[i] ;
if ( check ( a[ q[i] ] , vec ) ) res += a[ q[i] ] ;
// res = res - q[i] + a[ q[i] ] ;
}
return res ;
}
int main() {
freopen ( "input.txt" , "r" , stdin ) ;
// initSum() ;
for ( int i = 1 ; i <= M ; ++i ) {
int j = M / i ;
sum[i] = (LL)( j + 1 ) * j / 2 * i ;
}
scanf ( "%d" , &cases ) ;
num = 0 ;
while ( cases -- ) {
init() ;
int i , u , x , y , z ;
scanf ( "%d%d" , &n , &m ) ;
for ( i = 1 ; i <= n ; ++i ) a[i] = i ;
for ( i = 1 ; i <= m ; ++i ) {
scanf ( "%d" , &u ) ;
if ( u == 1 ) {
scanf ( "%d%d%d" , &x , &y , &z ) ;
cout << solve ( x , y , z , i ) << '\n' ;
}
else {
scanf ( "%d%d" , &x , &y ) ;
q[i] = x ;
vis[x] = i ;
a[x] = y ;
}
}
}
return 0 ;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s413635270
|
p00000
|
C
|
#include<cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
struct st
{
int l,r,num;
int id;
}q[100010];
int num[200010];
int s[100010];
int T;
int n,m;
map<int,int> hash;
int tot;
int low(int x)
{
return x&(-x);
}
const int N= 200000;
int arr1[200010];
int arr2[200010];
void add(int arr[],int pos,int v)
{
for(int i=pos; i<=N; i+=low(i))
arr[i] += v;
}
int sum(int arr[],int pos)
{
int ret = 0;
for(int i=pos; i; i-=low(i) )
ret += arr[i];
return ret;
}
bool cmp(const st& a,const st& b)
{
return a.r < b.r;
}
bool cmp3(const st& a,const st& b)
{
return a.l < b.l;
}
struct st2
{
int num,id;
}ans1[100010],ans2[100010];
bool cmp2(const st2& a,const st2& b)
{
return a.id < b.id;
}
int main()
{
freopen("in","r",stdin);
scanf("%d",&T);
while(T--)
{
hash.clear();
scanf("%d%d",&n,&m);
for(int i=1; i<=n; i++)
{
scanf("%d",&num[i]);
s[i] = num[i];
}
for(int i=1; i<=m; i++)
{
q[i].id = i;
scanf("%d%d",&q[i].l,&q[i].r);
q[i].l++;
q[i].r++;
scanf("%d",&q[i].num);
num[i+n] = q[i].num;
}
sort(num+1,num+1+n+m);
tot = unique(num+1,num+1+n+m) - (num+1);
for(int i=1; i<=tot; i++)
hash.insert( make_pair(num[i],i) );
for(int i=1; i<=n; i++)
s[i] = hash[ s[i] ];
for(int i=1; i<=m; i++)
q[i].num = hash[ q[i].num ];
int cur1 = 1,cur2 = 1;
int c1 = 0,c2 = 0;
memset(arr1,0,sizeof(arr1));
sort(q+1,q+1+m,cmp);
for(int i=1; i<=n; i++)
{
int pos = s[i];
add(arr1,pos, 1);
while(cur1 <= m && q[cur1].r == i)
{
int res = sum(arr1, q[cur1].num);
ans1[++c1].id = q[cur1].id;
ans1[c1].num = res;
cur1++;
}
}
memset(arr2,0,sizeof(arr2));
sort(q+1,q+1+m,cmp3);
for(int i=1; i<=n; i++)
{
int pos = s[i];
add(arr2, pos, 1);
while(cur2 <= m && q[cur2].l-1 == i)
{
int res = sum(arr2, q[cur2].num);
ans2[++c2].id = q[cur2].id;
ans2[c2].num = res;
cur2++;
}
}
sort(ans1+1,ans1+1+m,cmp2);
sort(ans2+1,ans2+1+m,cmp2);
for(int i=1; i<=m; i++)
printf("%d\n",ans1[i].num-ans2[i].num);
//for(int i=1; i<=m; i++)
// printf("%d\n",ans[i]);
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s284222604
|
p00000
|
C
|
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define N 100100
const int inf=0x3f3f3f3f;
using namespace std;
struct nd
{
int a,b;
}nod[N],ndd[N];
bool cmp(nd a,nd b)
{
if(a.b!=b.b)return a.b<b.b;
return a.a<b.a;
}
int T,tt,n,m;
int main()
{
//freopen("in","r",stdin);
tt=0;
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
{
scanf("%d%d",&nod[i].a,&nod[i].b);
}
sort(nod,nod+n,cmp);
int pos=-1;
for(int i=0;i<n;i++)
{
if(nod[i].b>0)
{
pos=i;
break;
}
}
if(pos<n)
{
int ans=0,ans2=0;
int sa=inf,sb=0;
for(int i=pos;i<n;i++)
{
sa=min(sa,nod[i].a);
sb+=nod[i].b;
}
if(sa<=m)
{
ans+=sa;
ans2+=n-pos;
int ss=sb-(n-pos)+1;
ans2+=min(ss,pos);
int yu=min(pos-ss-1,pos-1);
for(int i=yu;i>=0;i--)
{
if(ans+nod[i].a<=m)
{
ans+=nod[i].a;
ans2++;
}
else break;
}
printf("Case %d: %d %d\n",++tt,ans2,ans);
}
else
{
for(int i=0;i<pos;i++)
{
if(ans+nod[i].a<=m)
{
ans+=nod[i].a;
ans2++;
}
else break;
}
printf("Case %d: %d %d\n",++tt,ans2,ans);
}
}
else if(pos==n)
{
int ans=0,ans2=0;
for(int i=0;i<n;i++)
{
if(ans+nod[i].a<=m)
{
ans+=nod[i].a;
ans2++;
}
else break;
}
printf("Case %d: %d %d\n",++tt,ans2,ans);
}
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s823256244
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define see(x) cout<<#x<<":"<<x<<endl;
using namespace std;
const int maxn = 100005;
struct Node{
int a, b;
}p0[maxn],p1[maxn];
bool cmp(Node x, Node y){
return x.a<y.a;
}
int main(){
int T, t, i, j, k, n0, n1, n, m;
int num, cost, num1, cost1;
int ansn, ansc;
scanf("%d",&T);
for(t=1;t<=T;t++){
scanf("%d%d",&n,&m);
i = j = 0;
for(k=0;k<n;k++){
int aa,bb;
scanf("%d%d",&aa,&bb);
if(bb){
p1[i].a = aa; p1[i].b = bb;
i++;
}
else{
p0[j].a = aa; p0[j].b = bb;
j++;
}
}
n0 = j; n1 = i;
//see(n0) see(n1)
sort(p0,p0+n0,cmp);
int tmp = m;
num1 = cost1 = 0;
for(i=0;i<n0;i++){
if(p0[i].a<=tmp){
num1++;
cost1 += p0[i].a;
tmp -= p0[i].a;
}
else{
break;
}
}
sort(p1,p1+n1,cmp);
int sword = 0;
num = cost = 0;
if(p1[0].a<=m){
cost = p1[0].a;
m -= p1[0].a;
for(i=0;i<n1;i++){
sword += p1[i].b;
num++;
}
sword -= (n1-1);
for(i=n0-1;sword>0&&i>=0;i--,sword--){
num++;
}
for(j=0;j<=i;j++){
if(p0[j].a<=m){
num++;
cost += p0[j].a;
m -= p0[j].a;
}
else{
break;
}
}
}
if(num>num1){
ansn = num;ansc = cost;
}
else if(num<num1){
ansn = num1; ansc = cost1;
}
else{
ansn = num; ansc = min(cost,cost1);
}
printf("Case %d: %d %d\n",t,ansn,ansc);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s958496931
|
p00000
|
C
|
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define N 100100
#define ll long long
const ll inf=0x3f3f3f3f3f3f3f3fll;
using namespace std;
struct nd
{
ll a,b;
}nod[N],ndd[N];
bool cmp(nd a,nd b)
{
if(a.b!=b.b)return a.b<b.b;
return a.a<b.a;
}
ll T,tt,n,m;
int main()
{
freopen("in","r",stdin);
tt=0;
scanf("%I64d",&T);
while(T--)
{
//scanf("%I64d%I64d",&n,&m);
for(ll i=0;i<n;i++)
{
scanf("%I64d%I64d",&nod[i].a,&nod[i].b);
}
sort(nod,nod+n,cmp);
ll pos=-1;
for(ll i=0;i<n;i++)
{
if(nod[i].b>0)
{
pos=i;
break;
}
}
if(pos<n)
{
ll ans=0,ans2=0;
ll sa=inf,sb=0;
for(ll i=pos;i<n;i++)
{
sa=min(sa,nod[i].a);
sb+=nod[i].b;
}
if(sa<=m)
{
ans+=sa;
ans2+=n-pos;
ll ss=sb-(n-pos)+1;
ans2+=min(ss,pos);
ll yu=min(pos-ss-1,pos-1);
for(ll i=yu;i>=0;i--)
{
if(ans+nod[i].a<=m)
{
ans+=nod[i].a;
ans2++;
}
else break;
}
printf("Case %I64d: %I64d %I64d\n",++tt,ans2,ans);
}
else
{
for(ll i=0;i<pos;i++)
{
if(ans+nod[i].a<=m)
{
ans+=nod[i].a;
ans2++;
}
else break;
}
printf("Case %I64d: %I64d %I64d\n",++tt,ans2,ans);
}
}
else if(pos==n)
{
ll ans=0,ans2=0;
for(ll i=0;i<n;i++)
{
if(ans+nod[i].a<=m)
{
ans+=nod[i].a;
ans2++;
}
else break;
}
printf("Case %I64d: %I64d %I64d\n",++tt,ans2,ans);
}
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s832994208
|
p00000
|
C
|
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define clr(a,b) memset(a,b,sizeof(a))
using namespace std;
//int t,n,m;
//int a[100010];
//int ti=1;
//int main(){
//// freopen("d:\\in.txt","r",stdin);
// scanf("%d",&t);
// while(t--){
// scanf("%d%d",&n,&m);
// int mi=1<<30;
// int j=0;
// int s=0;
// int num=0,mm=m;
// int flag=0;
// for(int i=0;i<n;i++){
// int b,c;
// scanf("%d%d",&b,&c);
// if(c){
// s+=c;
// if(b<mi)mi=b;
// num++;
// flag=1;
// }
// else a[j++]=b;
// }
// printf("Case %d: ",ti++);
//
// if(flag&&mi<=m){
// s-=(num-1);
// m-=mi;
// }
// else s=0,num=0;
//
// sort(a,a+j);
//
// int tmpn=0,tmpm=mm;
// for(int i=0;i<j;i++)if(a[i]<=tmpm)tmpm-=a[i],tmpn++;
//
// num+=min(j,s);
// j-=s;
// for(int i=0;i<j;i++)if(a[i]<=m)m-=a[i],num++;
//
// if(num<tmpn)num=tmpn,m=tmpm;
// else if(num==tmpn&&m<tmpm)m=tmpm;
// printf("%d %d\n",num,mm-m);
// }
//}
int i,j,n,m;
int p[200000],l;
int main(){
// freopen("d:\\in.txt","r",stdin);
int T,cas=0;
scanf("%d",&T);
while(T--){
cas++;
scanf("%d%d",&n,&m);
l=0;
int num=0,exp=0,minn=2000000000;
for(i=1;i<=n;i++){
int a,b;
scanf("%d%d",&a,&b);
if(b!=0){
num++;
exp+=b;
minn=min(minn,a);
}
else p[l++]=a;
}
sort(p,p+l);
int x=0,y=m;
for(i=0;i<l;i++) if(p[i]<=y){y-=p[i];x++;}
int x2=0,y2=m;
if(minn<=m){
x2+=num+min(l,exp-(num-1));
l-=(exp-(num-1));
y2-=minn;
for(i=0;i<l;i++) if(p[i]<=y2){y2-=p[i];x2++;}
}
else x2=0,y2=m;
if(x<x2) x=x2,y=y2;
else if(x==x2&&y<y2) x=x2,y=y2;
printf("Case %d: %d %d\n",cas,x,m-y);
}
return 0;
}
|
main.c:3:10: fatal error: algorithm: No such file or directory
3 | #include <algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s515035337
|
p00000
|
C
|
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
struct snode {
int x;
double p;
bool operator<(const snode &rhs) const {
return x<rhs.x;
}
}node[1000010];
int N, M;
double cost[1010][1010];
double f[1010][55];
int main() {
int i, j, k;
while (cin>>N>>M, N) {
int cnt = 0;
for (i = 0; i < N; ++i) {
scanf("%d", &j);
while (j--) {
scanf("%d%lf", &node[cnt].x, &node[cnt].p);
cnt++;
}
}
sort(node, node+cnt);
i = j = 0;
while (++i != cnt) {
if (node[j].x != node[i].x)
node[++j] = node[i];
else
node[j].p += node[i].p;
}
N = j+1;
/*
printf("%d\n", N);
for (i = 0; i < N; ++i)
printf("%d %f\n", node[i].x, node[i].p);
*/
for (i = 1; i <= N; ++i) {
cost[i][i] = 0;
k = i;
double lsum, rsum, res;
lsum = rsum = res = 0;
for (j = i+1; j <= N; ++j) {
rsum += node[j-1].p;
res += node[j-1].p*(node[j-1].x-node[k-1].x);
while (k<j && 0>(lsum+node[k-1].p-rsum)*(node[k].x-node[k-1].x)) {
res += (lsum+node[k-1].p-rsum)*(node[k].x-node[k-1].x);
lsum += node[k-1].p;
rsum -= node[k].p;
k++;
}
cost[i][j] = res;
//printf("%f ", cost[i][j]);
}
//puts("");
}
//f[0][0] = 0;
for (i = 1; i <= N; ++i)
f[i][1] = cost[1][i];
for (j = 2; j <= M; ++j)
for (i = j; i <= N; ++i) {
f[i][j] = 1e9;
for (k = j-1; k < i; ++k)
f[i][j] = min(f[i][j], f[k][j-1]+cost[k+1][i]);
}
/*
for (i = 0; i <= N; ++i) {
for (j = 0; j <= M; ++j)
printf("%f ", f[i][j]);
puts("");
}
*/
printf("%.2f\n", f[N][M]);
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s446256257
|
p00000
|
C
|
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<map>
#include<queue>
#define ll long long
#define clr(x,y) memset(x,y,sizeof(x))
using namespace std;
const int inf=100000000;
int i,j,n,m,l,k,h;
int g[100][100];
int x1,y1,x2,y2;
int boss[60][60];
bool vis[60][60][1<<5],flag[60][60];
int d[60][60][1<<5],dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
struct item{
int x,y,rt,d;
item(int x,int y,int rt,int d):x(x),y(y),rt(rt),d(d){}
bool operator<(const item &a)const{
return d>a.d;
}
};
std::priority_queue<item> q;
struct cpoint{
int x,y,l;
cpoint(int x,int y,int l):x(x),y(y),l(l){}
};
std::queue<cpoint> que;
bool has(int rt,int x){
return (rt>>x)&1;
}
void bfs(int sx,int sy,int rt,int sl,int w){
clr(flag,0);
que.push(cpoint(sx,sy,sl));
while(!q.empty()){
int x=que.front().x,y=que.front().y,l=que.front().l;
que.pop();
for(int i=0;i<4;i++){
int nx=x+dx[i],ny=y+dy[i];
if(nx<0||nx>=n||ny<0||ny>=m) continue;
if(g[nx][ny]==-1||flag[nx][ny]) continue;
flag[nx][ny]=1;
if(g[nx][ny]==0||has(rt,g[nx][ny]-1)){
que.push(cpoint(nx,ny,l-1));
if(!vis[nx][ny][rt]&&w+1<d[nx][ny][rt])
q.push(item(nx,ny,rt,w+1));
continue;
}
if(boss[nx][ny]!=-1&&!has(rt,boss[nx][ny])){
int nrt=(rt|(1<<boss[nx][ny]));
if(!vis[nx][ny][nrt]&&w+1<d[nx][ny][rt]) q.push(item(nx,ny,nrt,w+1));
}
else{
if(!vis[nx][ny][rt]&&w+1<d[nx][ny][rt]) q.push(item(nx,ny,rt,w+1));
}
}
}
}
int dij(){
while(!q.empty()) q.pop();
for(i=0;i<n;i++) for(j=0;j<m;j++) for(h=0;h<(1<<k);h++)
vis[i][j][h]=0,d[i][j][h]=inf;
vis[x1][y1][0]=1;d[x1][y1][0]=0;
q.push(item(x1,y1,0,0));
while(!q.empty()){
int x=q.top().x,y=q.top().y,rt=q.top().rt;
vis[x][y][rt]=1;
if(x==x2&&y==y2) return d[x][y][rt];
clr(flag,0);
bfs(x,y,rt,l,d[x][y][rt]);
}
return inf;
}
int main(){
freopen("d:\\in.txt","r",stdin);
while(scanf("%d%d%d",&n,&m,&l)!=EOF){
for(i=0;i<n;i++) for(j=0;j<m;j++) scanf("%d",&g[i][j]);
scanf("%d",&k);
clr(boss,-1);
for(i=0;i<k;i++){
int x,y;
scanf("%d%d",&x,&y);
boss[x-1][y-1]=i;
}
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
x1--;y1--;x2--;y2--;
int ans=dij();
if(ans==inf) printf("We need God's help!\n");
else printf("%d\n",ans);
}
return 0;
}
|
main.c:3:9: fatal error: algorithm: No such file or directory
3 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s024821675
|
p00000
|
C
|
/*
HDU 4055
DP
隶セdp[i][j]陦ィ遉コ莉・j蠑?、エ逧?シ碁柄蠎ヲ荳コi逧?賜蛻礼噪謨ー逶ョ縲?
莉主ュ礼ャヲ荳イ逧?錘髱「蛻ー蜑埼擇DP蟆ア蠕怜?遲疲。井コ??
A
G++ 1437ms
*/
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
const int MAXN=1010;
const int MOD=1000000007;
char str[MAXN];
int dp[MAXN][MAXN];
int main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
while(scanf("%s",&str)!=EOF)
{
memset(dp,0,sizeof(dp));
int n=strlen(str)+1;
dp[1][1]=1;
for(int i=2;i<=n;i++)
{
char ch=str[n-i];
if(ch=='?')
{
for(int j=1;j<=i-1;j++)
{
dp[i][1]+=dp[i-1][j];
dp[i][1]%=MOD;
}
for(int j=2;j<=i;j++)
{
dp[i][j]=dp[i][j-1];
//dp[i][j]%=MOD;
}
}
else if(ch=='I')
{
dp[i][i]=0;
for(int j=i-1;j>=1;j--)
{
dp[i][j]=dp[i][j+1]+dp[i-1][j];
dp[i][j]%=MOD;
}
}
else if(ch=='D')
{
dp[i][1]=0;
for(int j=2;j<=i;j++)
{
dp[i][j]=dp[i][j-1]+dp[i-1][j-1];
dp[i][j]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<=n;i++)
{
ans+=dp[n][i];
ans%=MOD;
}
printf("%d\n",ans);
}
return 0;
}
|
main.c:11:9: fatal error: algorithm: No such file or directory
11 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s104580468
|
p00000
|
C
|
#include<stdio.h>
int main()
{
int m,n,l;
l = m*n
for(m=1;m<10;m++)
{
for(n=1;n<10;n++)
{
printf("%dx%d=%d\n",m,n,l);
}
}
return 0;
}
|
main.c: In function 'main':
main.c:5:8: error: expected ';' before 'for'
5 | l = m*n
| ^
| ;
6 | for(m=1;m<10;m++)
| ~~~
|
s220149133
|
p00000
|
C
|
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
ll x,y,ans;
ll _pow(ll k,int r)
{
ll b=1;
while(r)
{
if(r%2) b=b*k;
k=k*k;r/=2;
}
return b;
}
ll g(ll k,int r)
{
return k*(_pow(k,r)-1)/(k-1);
}
void cal(ll n,int r,ll low,ll up)
{
while(low<=up)
{
ll mid=(low+up)/2;
ll tmp=g(mid,r);
if(tmp<=n)
{
low=mid+1;
if(tmp==n&&ans>mid*r) ans=mid*r,x=r,y=mid;
}
else up=mid-1;
}
}
int main()
{
int n;
while(cin>>n)
{
ans=n-1;x=1;y=n-1;
cal(n-1,2,1,111111);cal(n,2,1,111111);
cal(n-1,3,1,11111);cal(n,3,1,11111);
cal(n-1,4,1,1111);cal(n,4,1,1111);
cal(n-1,5,1,300);cal(n,5,1,300);
for(int r=6;_pow(2,r)<=n;r++)
{
ll sum=0;int k=2;
while(sum<=n)
{
if(sum==n&&ans>k*r) ans=k*r,x=r,y=k;
sum+=_pow(++k,r);
}
}
cout<<x<<' '<<y<<endl;
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s816396666
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<string.h>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
#define inf (1ll<<62)
long long f[42];
void init(){
f[0]=1;
for(int i=1;i<=41;i++){
f[i]=f[i-1]*2;
}
}
long long qpow(long long x,long long y){
if(y==0) return 1;
if(y==1) return y;
long long res = qpow(x,y/2);
if(y&1) return res*res*x;
else return res*res;
}
long long sum1(int R,int k){
return (qpow(k,R+1)-1)/(k-1);
}
long long sum2(int R,int k){
return (qpow(k,R+1)-k)/(k-1);
}
int main(){
long long n;
init();
cout << "inf: " << inf << endl;
while(scanf("%lld",&n)!=-1){
long long R = 0,k = 0;
long long res = inf;
R = 1;
k = n-1;
res = n-1;
cout << "x: " << sum1(3,10) << " y: " << sum2(3,10) << endl;
for(long long i=2;i<=40;i++){
long long l = 2;
long long r = (long long)(pow(1.0*inf,1.0/(i+1)))+1;
//cout << "i: " << i << endl;
while(l<r-1){
long long mid = (l+r)>>1;
cout << "tmp: " << sum1(i,mid) << endl;
if(sum1(i,mid)>n) r = mid;
else l = mid;
}
cout << "i: " << i << endl;
cout << "=r: " << r << endl;
if(sum1(i,r)==n){
cout << "R: " << i << " k: " << r << endl;
if(res>i*r){
res = i*r;
R = i;
k = r;
}
}
l = 2;
r = (long long) (pow(1.0*inf,1.0/(i+1)))+1;
while(l<r-1){
long long mid = (l+r)>>1;
if(sum2(i,mid)>n) r = mid;
else l = mid;
}
if(sum2(i,r)==n){
cout << "R2: " << i << " k2: " << r << endl;
if(res>i*r){
res = i*r;
R = i;
k = r;
}
}
}
printf("%lld %lld\n",R,k);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s145690796
|
p00000
|
C
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#define DBLE 1e-8
#define PI 3.1415926535898
#define MAXN (1<<8)
#define INF 500000000
using namespace std;
int dp[55][MAXN][MAXN];
bool visit[55][MAXN][MAXN];
int ma[MAXN][MAXN];
struct _node
{
int have,is,fi,ti;
};
_node node[55];
inline int mul(int a,int b,int c)
{
return a*MAXN*MAXN+b*MAXN+c;
}
inline int gotn(int n,int &a,int &b,int &c)
{
a=n/MAXN/MAXN;
b=n/MAXN%MAXN;
c=n%MAXN;
return true;
}
int SPFA(int n)
{
int a,b,c;
queue<int> que;
que.push(mul(1,0,0));
while(que.empty()!=1)
{
gotn(que.front(),a,b,c);
que.pop();
visit[a][b][c]=0;
for(int i=1;i<=n;++i)
{
int nb=b|node[a].have,nc=c;
if(dp[a][b][c]+ma[a][i]<dp[i][nb][nc])
{
dp[i][nb][nc]=dp[a][b][c]+ma[a][i];
if(visit[i][nb][nc]==0)
visit[i][nb][nc]=1,que.push(mul(a,nb,nc));
}
if(node[i].is>=0)
{
int dtime;
nc=nc|(1<<node[i].is);
if(b&(1<<node[i].is)) dtime=node[i].fi;
else dtime=node[i].ti;
if(dp[a][b][c]+ma[a][i]+dtime<dp[i][nb][nc])
{
dp[i][nb][nc]=dp[a][b][c]+ma[a][i]+dtime;
if(visit[i][nb][nc]==0)
visit[i][nb][nc]=1,que.push(mul(a,nb,nc));
}
}
}
}
return 0;
}
int main()
{
FILE *fptr=fopen("/home/moor/Code/input.txt","r");
if(fptr==NULL)
{
printf("NOT exist!");
return 0;
}
fclose(fptr);
freopen("/home/moor/Code/input.txt","r",stdin);
int ncase,n,m,k,ans;
scanf("%d",&ncase);
for(int h=1;h<=ncase;++h)
{
scanf("%d%d%d",&n,&m,&k);
for(int i=0;i<=n;++i)
for(int j=0;j<MAXN;++j)
for(int l=0;l<MAXN;++l)
dp[i][j][l]=INF;
memset(node,0,sizeof(node));
memset(visit,0,sizeof(visit));
for(int i=0;i<=n;++i) node[i].is=-1;
for(int i=0;i<=n;++i)
for(int j=0;j<=n;++j)
ma[i][j]=INF;
for(int i=0;i<m;++i)
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
ma[a][b]=ma[b][a]=c;
}
for(int i=0;i<k;++i)
{
int p,ni,tmp,nij;
scanf("%d",&p);
node[p].is=i;
scanf("%d%d",&node[p].ti,&node[p].fi);
tmp=1<<i;
scanf("%d",&ni);
for(int j=0;j<ni;++j)
{
scanf("%d",&nij);
node[nij].have|=tmp;
}
}
dp[1][0][0]=0;
SPFA(n);
ans=INF;
for(int i=0;i<MAXN;++i)
ans=min(ans,dp[1][i][MAXN-1]);
printf("Case #%d: %d\n",h,ans);
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s680052734
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<string.h>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
string a,b,c;
int w[10];
int main(){
int T;
scanf("%d",&T);
while(T--){
cin >> a >> b >> c;
int d[6];
int res = 0;
for(int i=0;i<5;i++) w[i] = 1;
for(int i=0;i<a.size();i++)
w[a[i]-'A'] = 10;
for(int j=0;j<b.size();j++)
w[b[j]-'A'] = 10;
for(int i=0;i<c.size();i++)
w[c[i]-'A'] = 10;
for(d[0]=0;d[0]<w[0];d[0]++){
if(w[0]==1) d[0] = 100;
for(d[1]=0;d[1]<w[1];d[1]++){
if(w[1]>1&&d[0]==d[1]) continue;
if(w[1]==1) d[1] = 100;
for(d[2]=0;d[2]<w[2];d[2]++){
if(w[2]>1&&(d[0]==d[2]||d[1]==d[2])) continue;
if(w[2]==1) d[2] = 100;
for(d[3]=0;d[3]<w[3];d[3]++){
if(w[3]>1&&(d[3]==d[0]||d[3]==d[1]||d[3]==d[2])) continue;
if(w[3]==1) d[3] = 100;
for(d[4]=0;d[4]<w[4];d[4]++){
if(w[4]>1&&(d[4]==d[0]||d[4]==d[1]||d[4]==d[2]||d[4]==d[3])) continue;
if(w[4]==1) d[4] = 100;
int x = 0,y = 0,z = 0;
for(int p=0;p<a.size();p++){
x *= 10;
x += d[a[p]-'A'];
}
for(int p=0;p<b.size();p++){
y *= 10;
y += d[b[p]-'A'];
}
for(int p=0;p<c.size();p++){
z *= 10;
z += d[c[p]-'A'];
}
if((x/a.size()==0&&a.size()!=1)||(y/b.size()==0&&b.size()!=1)||(z/c.size()==0&&c.size()!=1)) continue;
if(x+y==z) res++;
if(x-y==z) res++;
if(x*y==z) res++;
if(y) if(x/y==z) res++;
}
}
}
}
}
printf("%d\n",res);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s916017179
|
p00000
|
C
|
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include <vector>
#include<queue>
#include<map>
#define L(a) ((a)<<1)
#define R(a) ((a)<<1|1)
#define clr(x,y) memset(x,y,sizeof(x))
#define ll long long
using namespace std;
const int inf=1<<30;
int a[6][6],b[6][6];
int t;
int x[]={1,0,0,-1},y[]={0,-1,1,0};
char c[]="DLRU";
int p[]={1,0,2,3};
struct my{
int x,y,d;
my(){}
my(int x,int y,int d):x(x),y(y),d(d){}
};
int txa,tya,txb,tyb;
bool in(int x,int y){
return x>=0&&x<6&&y>=0&&y<6;
}
int h(int xa,int ya,int xb,int yb){
queue <my> que;
que.push(my(xa,ya,0));
bool vis[6][6];
clr(vis,0);
vis[xa][ya]=1;
int ans=inf;
while(!que.empty()){
my now=que.front();que.pop();
int q=now.x,w=now.y,d=now.d;
if(q==txa&&w==tya){
ans=d;
break;
}
for(int i=0;i<4;i++){
int xx=q+x[i],yy=w+y[i];
if(in(xx,yy)&&(a[q][w]&(1<<p[i]))==0&&(a[xx][yy]&(1<<4))){
vis[xx][yy]=1;
que.push(my(xx,yy,d+1));
}
}
}
while(!que.empty())que.pop();
clr(vis,0);
que.push(my(xb,yb,0));
vis[xb][yb]=1;
while(!que.empty()){
my now=que.front();que.pop();
int q=now.x,w=now.y,d=now.d;
if(q==txb&&w==tyb){
if(ans==inf)ans=d;
else ans=max(ans,d);
break;
}
for(int i=0;i<4;i++){
int xx=q+x[i],yy=w+y[i];
if(in(xx,yy)&&(b[q][w]&(1<<p[i]))==0&&(b[xx][yy]&(1<<4))){
vis[xx][yy]=1;
que.push(my(xx,yy,d+1));
}
}
}
return ans;
}
map<int,int> mapa;
char o[10000],ans[10000];
int lim;
int tmp;
void dfs(int xa,int ya,int xb,int yb,int d){
if(xa==txa&&ya==tya&&xb==txb&&yb==tyb){
o[d]=0;
strcpy(ans,o);
lim=d;
return ;
}
if(d>=lim)return;
tmp=xa*1000+ya*100+xb*10+yb;
if(mapa.find(tmp)==mapa.end())mapa[tmp]=d;
else if(mapa[tmp]>d)mapa[tmp]=d;
else return ;
if(d+h(xa,ya,xb,yb)>=lim)return ;
for(int i=0;i<4;i++){
int xxa=xa+x[i],yya=ya+y[i],xxb=xb+x[i],yyb=yb+y[i];
if(in(xxa,yya)&&in(xxb,yyb)){
if((a[xa][ya]&(1<<p[i])))xxa=xa,yya=ya;
else if((a[xxa][yya]&(1<<4))==0)continue;
if((b[xb][yb]&(1<<p[i])))xxb=xb,yyb=yb;
else if((b[xxb][yyb]&(1<<4))==0)continue;
o[d]=c[i];
dfs(xxa,yya,xxb,yyb,d+1);
}
}
}
int sxa,sya,sxb,syb;
int main(){
freopen("in","r",stdin);
scanf("%d",&t);
for(int ti=0;ti<t;ti++){
if(ti==0){
for(int i=0;i<6;i++)for(int j=0;j<6;j++){
scanf("%d",&a[i][j]);
if(a[i][j]&(1<<5))sxa=i,sya=j;
if(a[i][j]&(1<<6))txa=i,tya=j;
}
continue;
}
for(int i=0;i<6;i++)for(int j=0;j<6;j++){
scanf("%d",&b[i][j]);
if(b[i][j]&(1<<5))sxb=i,syb=j;
if(b[i][j]&(1<<6))txb=i,tyb=j;
}
lim=10000;
mapa.clear();
dfs(sxa,sya,sxb,syb,0);
if(lim==10000)puts("-1");
else puts(ans);
memcpy(a,b,sizeof(a));
sxa=sxb,sya=syb,txa=txb,tya=tyb;
}
}
|
main.c:2:9: fatal error: algorithm: No such file or directory
2 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s452564266
|
p00000
|
C
|
#include <iostream>
#include <string.h>
#include <queue>
#include <algorithm>
#include <cstdio>
using namespace std;
int r[2][6][6],l[2][6][6],up[2][6][6],dn[2][6][6],hole[2][6][6];
int mab1[6][6],mab2[6][6];
int x[4]={1,0,0,-1};
int y[4]={0,-1,1,0};
int vis[6][6][6][6];
struct nd
{
int x,y;
}st,ed,st1,ed1;
struct ndd
{
int x,y,x1,y1;
char op;
}pre[6][6][6][6];
char load[10000];
queue<ndd>q;
int T;
void copy(int a[6][6],int b[6][6])
{
for(int i=0;i<6;i++)for(int j=0;j<6;j++)a[i][j]=b[i][j];
}
void read(int a[6][6],int r[6][6],int l[6][6],int up[6][6],int dn[6][6],int hole[6][6],nd &st,nd &ed)
{
for(int i=0;i<6;i++)for(int j=0;j<6;j++)scanf("%d",&a[i][j]);
for(int i=0;i<6;i++)
{
for(int j=0;j<6;j++)
{
int k;
k=1<<0;
if(k&a[i][j])l[i][j]=1;
else l[i][j]=0;
k=1<<1;
if(k&a[i][j])dn[i][j]=1;
else dn[i][j]=0;
k=1<<2;
if(k&a[i][j])r[i][j]=1;
else r[i][j]=0;
k=1<<3;
if(k&a[i][j])up[i][j]=1;
else up[i][j]=0;
k=1<<4;
if(k&a[i][j])hole[i][j]=1;
else hole[i][j]=0;
k=1<<5;
if(k&a[i][j])st.x=i,st.y=j;
k=1<<6;
if(k&a[i][j])ed.x=i,ed.y=j;
}
}
}
int judge(ndd pt)
{
if(pt.x==-1&&pt.y==-1&&pt.x1==-1&&pt.y1==-1)return 0;
return 1;
}
void dfs(ndd pt)
{
int cp=0;
while(judge(pt))
{
load[cp++]=pre[pt.x][pt.y][pt.x1][pt.y1].op;
pt=pre[pt.x][pt.y][pt.x1][pt.y1];
}
for(int i=cp-1;i>=0;i--) cout<<(char)load[i];
cout<<endl;
}
void solve()
{
memset(vis,0,sizeof(vis));
memset(pre,-1,sizeof(pre));
while(!q.empty()) q.pop();
ndd gg;
gg.x=st.x,gg.y=st.y;
gg.x1=st1.x,gg.y1=st1.y;
q.push(gg);
vis[gg.x][gg.y][gg.x1][gg.y1]=1;
int f=0,f1=0;
int flag=0;
ndd dd;
while(!q.empty())
{
ndd pp=q.front();
q.pop();
if(pp.x==ed.x&&pp.y==ed.y)f=1;
if(pp.x1==ed1.x&&pp.y1==ed1.y)f1=1;
if(f&&f1)
{
flag=1;
dd=pp;
break;
}
for(int i=0;i<4;i++)
{
int dx=x[i];
int dy=y[i];
ndd tt;
if(dx==0&&dy==1)///r
{
if(f||r[0][pp.x][pp.y])tt.x=pp.x,tt.y=pp.y;
else tt.x=pp.x+dx,tt.y=pp.y+dy;
if(f1||r[1][pp.x1][pp.y1])tt.x1=pp.x1,tt.y1=pp.y1;
else tt.x1=pp.x1+dx,tt.y1=pp.y1+dy;
tt.op='R';
}
else if(dx==0&&dy==-1)///l
{
if(f||l[0][pp.x][pp.y])tt.x=pp.x,tt.y=pp.y;
else tt.x=pp.x+dx,tt.y=pp.y+dy;
if(f1||l[1][pp.x1][pp.y1])tt.x1=pp.x1,tt.y1=pp.y1;
else tt.x1=pp.x1+dx,tt.y1=pp.y1+dy;
tt.op='L';
}
else if(dx==1&&dy==0)///dn
{
if(f||dn[0][pp.x][pp.y])tt.x=pp.x,tt.y=pp.y;
else tt.x=pp.x+dx,tt.y=pp.y+dy;
if(f1||dn[1][pp.x1][pp.y1])tt.x1=pp.x1,tt.y1=pp.y1;
else tt.x1=pp.x1+dx,tt.y1=pp.y1+dy;
tt.op='D';
}
else if(dx==-1&&dy==0)///up
{
if(f||up[0][pp.x][pp.y])tt.x=pp.x,tt.y=pp.y;
else tt.x=pp.x+dx,tt.y=pp.y+dy;
if(f1||up[1][pp.x1][pp.y1])tt.x1=pp.x1,tt.y1=pp.y1;
else tt.x1=pp.x1+dx,tt.y1=pp.y1+dy;
tt.op='U';
}
if(!vis[tt.x][tt.y][tt.x1][tt.y1]&&hole[tt.x][tt.y]&&hole[tt.x1][tt.y1]
&&0<=tt.x&&tt.x<=5&&0<=tt.y&&tt.y<=5&&0<=tt.x1&&tt.x1<=5&&0<=tt.y1&&tt.y1<=5)
{
pre[tt.x][tt.y][tt.x1][tt.y1]=pp;
q.push(tt);
vis[tt.x][tt.y][tt.x1][tt.y1]=1;
}
}
}
if(flag)
{
dfs(dd);
}
else printf("-1\n");
}
int main()
{
freopen("in","r",stdin);
scanf("%d",&T);
read(mab1,r[0],l[0],up[0],dn[0],hole[0],st,ed);
T--;
while(T--)
{
read(mab2,r[1],l[1],up[1],dn[1],hole[1],st1,ed1);
solve();
copy(mab1,mab2);
copy(r[0],r[1]);
copy(l[0],l[1]);
copy(up[0],up[1]);
copy(dn[0],dn[1]);
copy(hole[0],hole[1]);
st=st1,ed=ed1;
}
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s536220690
|
p00000
|
C
|
//============================================================================
// Name : main.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
struct Data{
long long r,k;
}tmp,ans1,ans2,ans;
long long inf = 1000000,n;
long long fun(long long x,long long r,long long val ){
long long sum = val,tmp = 1;
int i;
for(i=1;i<=r;i++){
tmp*=x,sum+=tmp;
if(sum > n) return inf;
}
return sum;
}
bool check(Data tmp,Data ans1){
return (ans1.k == 1 || (ans1.k*ans1.r > tmp.r*tmp.k)
||(ans1.k*ans1.r == tmp.r*tmp.k && ans1.r>tmp.r) );
}
int main() {
long long r;
inf = inf*inf;
while(cin>>n){
ans1.k=ans2.k=ans.k = -1;
for(r=1;r<=1000;r++){
long long left = 2,right = inf,mid;
while(left+1<right){
mid = (left+right)/2;
if(fun(mid,r,0) >n) right = mid;
else left = mid;
}
if(fun(left,r,0) == n) tmp.r=r,tmp.k = left;
else tmp.r=r,tmp.k = right;
if(check(tmp,ans1))
ans1 = tmp;
}
for(r=1;r<=1000;r++){
long long left = 2,right = inf,mid;
while(left+1<right){
mid = (left+right)/2;
if(fun(mid,r,1) >n) right = mid;
else left = mid;
}
if(fun(left,r,1) == n) tmp.r=r,tmp.k = left;
else tmp.r=r,tmp.k = right;
if(check(tmp,ans1))
ans2 = tmp;
}
if(check(ans1,ans)) ans = ans1;
if(check(ans2,ans)) ans = ans2;
printf("%lld %lld\n",ans.r,ans.k);
}
return 0;
}
|
main.c:9:10: fatal error: iostream: No such file or directory
9 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s016551474
|
p00000
|
C
|
//============================================================================
// Name : main.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
struct Data{
long long r,k;
}tmp,ans1,ans2,ans;
long long inf = 1000000,n;
long long fun(long long x,long long r,long long val ){
long long sum = val,tmp = 1;
int i;
for(i=1;i<=r;i++){
//tmp*=x,sum+=tmp;
if(n/x +3 < tmp) return inf;
tmp*=x,sum+=tmp;
if(sum > n) return inf;
}
return sum;
}
bool check(Data tmp,Data ans1){
return ((ans1.k*ans1.r > tmp.r*tmp.k)
||(ans1.k*ans1.r == tmp.r*tmp.k && ans1.r>tmp.r) );
}
int main() {
long long r;
inf = inf*inf;
while(cin>>n){
ans1.k=ans2.k=ans.k = n-1;
ans1.r = ans2.r = ans.r = 1;
for(r=1;r<=1000;r++){
long long left = 2,right = inf,mid;
while(left+1<right){
mid = (left+right)/2;
if(fun(mid,r,0) >n) right = mid;
else left = mid;
}
if(fun(left,r,0) == n) tmp.r=r,tmp.k = left;
else if(fun(right,r,0) == n) tmp.r=r,tmp.k = right;
else continue;
if(check(tmp,ans1))
ans1 = tmp;
}
for(r=1;r<=1000;r++){
long long left = 2,right = inf,mid;
while(left+1<right){
mid = (left+right)/2;
if(fun(mid,r,1) >n) right = mid;
else left = mid;
}
if(fun(left,r,1) == n) tmp.r=r,tmp.k = left;
else if(fun(right,r,1) == n) tmp.r=r,tmp.k = right;
else continue;
if(check(tmp,ans1))
ans2 = tmp;
}
if(check(ans1,ans)) ans = ans1;
if(check(ans2,ans)) ans = ans2;
printf("%lld %lld\n",ans.r,ans.k);
}
return 0;
}
|
main.c:9:10: fatal error: iostream: No such file or directory
9 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s903159001
|
p00000
|
C
|
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;
const int N=50005,M=N*4;
int n;
struct Node{
int x1,x2,y1,y2;
Node(){}
Node(int a,int b,int c,int d):x1(a),y1(b),x2(c),y2(d){}
}node[N*5];
int le[M],ri[M],sum[M],c[M];
vector<int>in[N],ou[N];
void build(int rt,int l,int r){
le[rt]=l;ri[rt]=r;int mid=(l+r)>>1;
sum[rt]=0;c[rt]=0;
if(l==r-1)return ;
build(rt<<1,l,mid);
build(rt<<1|1,mid,r);
}
void pushup(int rt){
if(le[rt]==ri[rt]-1){
sum[rt]=0;
}
else{
sum[rt]=sum[rt<<1]+sum[rt<<1|1];
}
if(c[rt])sum[rt]=ri[rt]-le[rt];
}
void update(int rt,int l,int r,int v){
if(le[rt]==l&&ri[rt]==r){
c[rt]+=v;
pushup(rt);return ;
}
int mid=(le[rt]+ri[rt])>>1;
if(r<mid)update(rt<<1,l,r,v);
else if(l>=mid)update(rt<<1|1,l,r,v);
else{
update(rt<<1,l,mid,v);
update(rt<<1|1,mid,r,v);
}
pushup(rt);
}
int main(){
freopen("d:\\in.txt","r",stdin);
while(scanf("%d",&n)==1){
if(n==0)break;
int lx=1000000,rx=-1,ly=1000000,ry=-1;
for(int i=0;i<n;i++){
int a,b,c,d;
int aa,bb,cc,dd;
scanf("%d%d%d%d%d%d%d%d",&a,&b,&c,&d,&aa,&bb,&cc,&dd);
node[i*4]=Node(a,b,c,bb);
node[i*4+1]=Node(a,bb,aa,dd);
node[i*4+2]=Node(cc,dd,c,dd);
node[i*4+3]=Node(a,dd,c,d);
lx=min(a,lx);rx=max(c,rx);
ly=min(b,ly);ry=max(d,ry);
}
for(int i=lx;i<=rx;i++){
in[i].clear();ou[i].clear();
}
for(int i=0;i<4*n;i++){
in[node[i].x1].push_back(i);
ou[node[i].x2].push_back(i);
}
build(1,0,ry);
int ans=0;
for(int i=lx;i<rx;i++){
for(int j=0;j<ou[i].size();j++){
int a=ou[i][j];
update(1,node[a].y1,node[a].y2,-1);
}
for(int j=0;j<in[i].size();j++){
int a=in[i][j];
update(1,node[a].y1,node[a].y2,1);
}
ans+=sum[1];
}
printf("%d\n",ans);
}
return 0;
}
|
main.c:3:9: fatal error: algorithm: No such file or directory
3 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s137553831
|
p00000
|
C
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define maxn 105
int a[maxn][maxn];
bool vis[maxn][maxn];
bool prime[maxn*maxn];
struct node
{
int x,y;
}c[maxn*maxn];
struct Node
{
int x,y;
int dis;
}q[maxn*maxn];
void init()
{
int i,j;
prime[1]=true;
for (i=2;i<=10000;i++)
if (!prime[i])
{
j=2;
while (i*j<=10000)
{
prime[i*j]=true;
j++;
}
}
for (i=0;i<maxn;i++)
a[0][i]=a[i][0]=a[i][101]=a[101][i]=10005;
int x=1,y=1;
int cnt=10000;
for (i=100;i>=1;i--)
{
while (a[x][y]==0)
{
a[x][y]=cnt;
c[cnt].x=x;c[cnt].y=y;
cnt--;
y++;
}
y--;x++;
while (a[x][y]==0)
{
a[x][y]=cnt;
c[cnt].x=x;c[cnt].y=y;
cnt--;
x++;
}
x--;y--;
while (a[x][y]==0)
{
a[x][y]=cnt;
c[cnt].x=x;c[cnt].y=y;
cnt--;
y--;
}
y++,x--;
while (a[x][y]==0)
{
a[x][y]=cnt;
c[cnt].x=x;c[cnt].y=y;
cnt--;
x--;
}
x++,y++;
}
}
int d[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
void bfs(int s,int t)
{
memset(vis,0,sizeof(vis));
q[1].x=c[s].x;
q[1].y=c[s].y;
q[1].dis=0;
vis[c[s].x][c[s].y]=0;
int head=1,tail=1;
int i,x,y,xx,yy;
while (head<=tail)
{
x=q[head].x;
y=q[head].y;
for (i=0;i<4;i++)
{
xx=x+d[i][0];
yy=y+d[i][1];
if (a[xx][yy]>10000) continue;
if (vis[xx][yy]||!prime[a[xx][yy]]) continue;
if (a[xx][yy]==t)
{
printf("%d\n",q[head].dis+1);
return;
}
q[++tail].x=xx;
q[tail].y=yy;
q[tail].dis=q[head].dis+1;
vis[xx][yy]=true;
}
head++;
}
printf("impossible\n");
}
int main()
{
init();
int cnt=0;
int s,t;
while (scanf("%d %d",&s,&t)!=-1)
{
printf("Case %d: ",++cnt);
if (s==t)
printf("0\n");
else
bfs(s,t);
}
return 0;
}
|
main.c:4:9: fatal error: algorithm: No such file or directory
4 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s515441935
|
p00000
|
C
|
#include<iostream>
#include<stdio.h>
#include<set>
#include<string.h>
#include<math.h>
#include<string>
#include<queue>
#include<algorithm>
#define LL long long
#define N 2
using namespace std;
int a,b,mod,n;
struct mat
{
int a[N][N],n,m;
mat(int n=2,int m=2,int val=0):n(n),m(m)
{
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
a[i][j]=(i==j?val:0);
}
mat operator *(mat tmp)
{
mat ret(n,tmp.m);
for(int i=0;i<n;i++)
for(int j=0;j<tmp.m;++j)
for(int k=0;k<m;++k)
ret.a[i][j]=(1ll*a[i][k]*tmp.a[k][j]+ret.a[i][j])%mod;
return ret;
}
mat operator ^(int b)
{
mat ret(n,m,1),base=(*this);
while(b)
{
if(b&1) ret=ret*base;
base=base*base;
b>>=1;
}
return ret;
}
void print(){
for(int i=0;i<n;++i,puts(""))
for(int j=0;j<m;++j)
cout<<a[i][j]<<' ';
}
}e(2,2,1),base(2,2),m1(1,2),m2(1,2);
void test()
{
mod=10000;
mat m1=(2,2);
(e*m1).print();
// e.print();
// (e*e).print();
(e^10).print();
}
void init()
{
// mod=10;
// (e^1).print();
base.a[0][0]=1; base.a[0][1]=1; base.a[1][0]=1; base.a[1][1]=0;
m1.a[0][0]=0; m1.a[0][1]=1;
m2.a[0][0]=1; m2.a[0][1]=0;
// (base^0).print();
// m1.print(); m2.print();
}
int exp_mod(int a,int b)
{
LL ret=1,base=a%mod;
while(b)
{
if(b&1) ret=ret*base%mod;
base=base*base%mod;
b>>=1;
}
return (int) ret;
}
int main()
{
// test();
int t,cas=0;
init();
freopen("b.in","r",stdin);
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d%d",&a,&b,&mod,&n);
--n;
mat m=base^n;
mat tmp=m1*m;
// m.print();
// m1.print();
// tmp.print();
LL ans=exp_mod(a,tmp.a[0][1]);
// cout<<ans<<endl;
tmp=m2*m;
// m2.print();
// tmp.print();
ans=ans*exp_mod(b,tmp.a[0][1])%mod;
printf("Case #%d: %d\n",++cas,(int)ans);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s684282316
|
p00000
|
C
|
#include<iostream>
#include<stdio.h>
#include<set>
#include<string.h>
#include<math.h>
#include<string>
#include<queue>
#include<algorithm>
#define LL long long
#define N 2
using namespace std;
int a,b,mod,n,p;
struct mat
{
int a[N][N],n,m;
mat(int n=2,int m=2,int val=0):n(n),m(m)
{
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
a[i][j]=(i==j?val:0);
}
mat operator *(mat tmp)
{
mat ret(n,tmp.m);
for(int i=0;i<n;i++)
for(int j=0;j<tmp.m;++j)
for(int k=0;k<m;++k){
LL tt=1ll*a[i][k]*tmp.a[k][j]+ret.a[i][j];
if(tt>mod) tt=tt%mod+mod;
ret.a[i][j]=(int)tt;
}
return ret;
}
mat operator ^(int b)
{
mat ret(n,m,1),base=(*this);
while(b)
{
if(b&1) ret=ret*base;
base=base*base;
b>>=1;
}
return ret;
}
void print(){
for(int i=0;i<n;++i,puts(""))
for(int j=0;j<m;++j)
cout<<a[i][j]<<' ';
}
}e(2,2,1),base(2,2),m1(1,2),m2(1,2);
void test()
{
mod=10000;
mat m1=(2,2);
(e*m1).print();
// e.print();
// (e*e).print();
(e^10).print();
}
void init()
{
// mod=10;
// (e^1).print();
base.a[0][0]=1; base.a[0][1]=1; base.a[1][0]=1; base.a[1][1]=0;
m1.a[0][0]=0; m1.a[0][1]=1;
m2.a[0][0]=1; m2.a[0][1]=0;
// (base^0).print();
// m1.print(); m2.print();
}
int exp_mod(int a,int b)
{
LL ret=1,base=a%p;
while(b)
{
if(b&1) ret=ret*base%p;
base=base*base%p;
b>>=1;
}
return (int) ret;
}
void get_mod(int n)
{
mod=n;
for(int i=2;i*i<=n;++i)
{
if(n%i==0) mod=mod/i*(i-1);
while(n%i==0) n/=i;
}
if(n>1) mod=mod/n*(n-1);
}
int main()
{
// test();
int t,cas=0;
init();
freopen("b.in","r",stdin);
scanf("%d",&t);
while(t--)
{
init();
scanf("%d%d%d%d",&a,&b,&p,&n);
get_mod(p);
cout<<mod<<' '<<p<<endl;
--n;
mat m=base^n;
mat tmp=m1*m;
// m.print();
// m1.print();
// tmp.print();
LL ans=exp_mod(a,tmp.a[0][1]);
// cout<<ans<<endl;
tmp=m2*m;
// m2.print();
// tmp.print();
ans=ans*exp_mod(b,tmp.a[0][1])%mod;
printf("Case #%d: %d\n",++cas,(int)ans);
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s347603748
|
p00000
|
C
|
//#include<stdio.h>
//#include<stdlib.h>
//#include<algorithm>
//using namespace std;
//int n,d1,d2;
//
//int main(){
// scanf("%d%d%d",&n,&d1,&d2);
// int t1=d1,t2=d2,num=2;
// while(1){
// int t=min(t1,t2);
// if(num>=n) break;
// if(t==t1) t1+=d1,num++;
// if(t==t2) t2+=d2,num++;
// }
// printf("%d %d\n",num,max(t1,t2));
// return 0;
//}
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include <vector>
#include <set>
#include <string.h>
#define clr(a,b) memset(a,b,sizeof(a))
using namespace std;
int n,k;
int num[4005],val[4005][4005];
struct Node{
int a,b;
bool operator<(const Node&x)const{
return b>x.b;
}
Node(int aa,int bb):a(aa),b(bb){}
Node(){}
}node[4005];
int uu[4005];
int main(){
freopen("d:\\in.txt","r",stdin);
while(scanf("%d%d",&n,&k)==2){
clr(num,0);
for(int i=1;i<=n;i++){
int a,b;scanf("%d%d",&a,&b);
val[a][num[a]++]=b;
}
for(int i=1;i<=4000;i++){
sort(val[i],val[i]+num[i],greater<int>);
node[i]=Node(i,num[i]);
}
sort(node+1,node+1+4000);
int cnt=node[k].b;
if(cnt==0){
put("0 0");continue;
}
for(int i=1;i<=k;i++){
int id=node[i].a;
int sum=0;
for(int j=0;j<cnt;j++)sum+=val[id][j];
uu[i]=sum;
}
int i=k+1;
for(;i<=4000;i++)
if(node[i].b==cnt){
int id=node[i].a;
int sum=0;
for(int j=0;j<cnt;j++)sum+=val[id][j];
uu[i]=sum;
}
sort(uu+1,uu+i);
int sum=0;
for(int i=1;i<=k;i++)sum+=uu[i];
printf("%d %d\n",cnt,sum);
}
}
|
main.c:22:9: fatal error: algorithm: No such file or directory
22 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s156493804
|
p00000
|
C
|
#include<iostream>
using namespace std;
int main()
{
int i,j;
int s;
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
{
s=i*j;
cout<<i<<"x"<<j<<"="<<s<<"\n";
}
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s623386454
|
p00000
|
C
|
#include<stdio.h>
int main(void)
{
for(int f1=1;f1<=9;f1++){
for(int f2=1;f2<=9;f2++){
printf("%dx%d=%d\n",f1,f2,f1*f2);
return 0;
}
|
main.c: In function 'main':
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
|
s241284078
|
p00000
|
C
|
struct SuffixArray {
int wa[LEN] , wb[LEN] , wv[LEN] , ws[LEN];
int n , m , r[LEN] , sa[LEN] , rank[LEN] , h[LEN];
void init(char *str) {
// r[] : the string
// n : length of the string
// m : kind of character
// Tips : r[n] = 0
n = strlen(str);
for(int i = 0 ; i < n ; i++) r[i] = str[i] - 'a' + 1;
r[n] = 0;
m = 27;
}
inline int cmp(int *y , int a , int b , int l) {
return y[a] == y[b] && y[a+l] == y[b+l];
}
void get_sa(int n) {
// sa[i]:蟄怜?蠎冗ャャi螟ァ逧?錘郛?噪襍キ蟋倶ス咲スョ (1 <= i <= n , 0 <= sa[i] < n)
int i , j , p , *x = wa , *y = wb , *t;
for(i = 0 ; i < m ; i++) ws[i] = 0;
for(i = 0 ; i < n ; i++) ws[x[i] = r[i]]++;
for(i = 1 ; i < m ; i++) ws[i] += ws[i-1];
for(i = n - 1 ; i >= 0 ; i--) sa[--ws[x[i]]] = i;
for(j = 1 , p = 1 ; p < n ; j <<= 1 , m = p) {
for(p = 0 , i = n - j ; i < n ; i++) y[p++] = i;
for(i = 0 ; i < n ; i++) if(sa[i] >= j) y[p++] = sa[i]-j;
for(i = 0 ; i < m ; i++) ws[i] = 0;
for(i = 0 ; i < n ; i++) ws[wv[i] = x[y[i]]]++;
for(i = 1 ; i < m ; i++) ws[i] += ws[i-1];
for(i = n - 1 ; i >= 0 ; i--) sa[--ws[wv[i]]] = y[i];
swap(x , y) , p = 1 , x[sa[0]] = 0;
for(i = 1 ; i < n ; i++)
x[sa[i]] = cmp(y , sa[i-1] , sa[i] , j) ? p - 1 : p++;
}
}
void get_h() {
// rank[i]:莉主次荳イi蠑?ァ狗噪蜷守シ?噪謗貞錐?? <= i < n?? // h[i]:謗貞錐隨ャi螟ァ逧?錘郛?ク取賜蜷咲ャャi-1螟ァ逧?錘郛?噪譛?柄蜈ャ蜈ア蜑咲シ?シ? <= i <= n?? int i , j , k = 0;
for(i = 1 ; i <= n ; i++) rank[sa[i]] = i;
for(i = 0 ; i < n ; h[rank[i++]] = k)
for(k?k--:0 , j = sa[rank[i]-1] ; r[i+k] == r[j+k] ; k++) ;
}
int lcp(int x , int y) { //霑泌屓蛟シ荳コ蜷守シ?蜥悟錘郛?逧?怙髟ソ蜈ャ蜈ア蜑咲シ? x = rank[x] , y = rank[y];
if(x > y) swap(x , y);
return rmq.query(x + 1 , y);
}
void out() {
get_sa(n + 1);
get_h();
puts("rank array:");
for(int i = 0 ; i < n ; i++) printf("%d " , rank[i]);
puts("\nsa array");
for(int i = 1 ; i <= n ; i++) printf("%d " , sa[i]);
puts("\nheight array");
for(int i = 1 ; i <= n ; i++) printf("%d " , h[i]);
puts("");
}
void debug() {
char str[LEN];
scanf("%s" , str);
init(str);
out();
/*
莉・"aabaaaab"荳コ萓具シ檎嶌蠎皮噪霎灘?荳コ?? rank array:
4 6 8 1 2 3 5 7
sa array
3 4 5 0 6 1 7 2
height array
0 3 2 3 1 2 0 1
*/
}
}sf;
|
main.c:2:12: error: 'LEN' undeclared here (not in a function)
2 | int wa[LEN] , wb[LEN] , wv[LEN] , ws[LEN];
| ^~~
main.c:4:26: error: expected ':', ',', ';', '}' or '__attribute__' before '{' token
4 | void init(char *str) {
| ^
|
s863781393
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<map>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 3100
#define lef(x) (((x)<<1)+1)
#define rig(x) (((x)<<1)+2)
int h[N], e[N], thick[N], Oceng[N], Tceng[N];
int apx[N], apy[N], apz[N];//o to r
int _x[N][2], _y[N][2], _z[N][2];
map<int, int> x, y;// real to reorder
int length(int loc){
return apy[e[loc]] - apy[h[loc]];
}
void build(int he, int en, int loc){
h[loc] = he, e[loc] = en;
if(he+1>=en){
return;
}
int mid = he+en>>1;
build(he, mid, lef(loc));
build(mid, en, rig(loc));
}
void statis(int loc){
if(thick[loc] >= 2){
Tceng[loc] = length(loc);
Oceng[loc] = 0;
return;
}
if(h[loc] +1>=e[loc]){
if(thick[loc] >= 2){
Tceng[loc] = length(loc);
Oceng[loc] = 0;
}
else if(thick[loc]){
Oceng[loc]=length(loc);
Tceng[loc]=0;
}
else
Tceng[loc] = Oceng[loc] =0;
return;
}
Tceng[loc] = Tceng[lef(loc)]+Tceng[rig(loc)];
Oceng[loc] = Oceng[lef(loc)]+Oceng[rig(loc)];
if(thick[loc]){
Tceng[loc] += Oceng[loc];
Oceng[loc] =length(loc)-Tceng[loc];
}
}
void insert(int he, int en, int loc){
if(h[loc] == he&& e[loc] == en){
thick[loc]++;
}
else{
int mid = h[loc]+e[loc]>>1;
insert(he, mid, lef(loc));
insert(mid, en, rig(loc));
}
statis(loc);
}
void del(int he, int en, int loc){
if(h[loc] == he && e[loc] ==en)
thick[loc]--;
else{
int mid = h[loc]+e[loc]>>1;
del(he, mid, lef(loc));
del(mid, en, rig(loc));
}
statis(loc);
}
struct line{
int up, down, x, z1, z2;
bool in;
} work[N];
bool operator <(line a, line b){
if(a.x!=b.x)return a.x<b.x;
return a.in>b.in;
}
int t, n, zzz;
bool judge(line a){
if(a.z1<=zzz && a.z2>=zzz+1)return true;
return false;
}
int main(){
build(0 , 1000, 0);
scanf("%d", &t);
for(int cas = 1; cas<=t; cas++){
scanf("%d", &n);
for(int i=0; i<n; i++){
for(int j=0; j<2; j++){
scanf("%d%d%d", &_x[i][j], &_y[i][j], &_z[i][j]);
}
apx[2*i] = _x[i][0], apy[2*i] = _y[i][0], apz[2*i] = _z[i][0];
apx[2*i+1] = _x[i][1], apy[2*i+1] = _y[i][1], apz[2*i+1] = _z[i][1];
work[2*i+1].z1=work[2*i].z1=_z[i][0];
work[2*i+1].z2=work[2*i].z2=_z[i][1];
work[2*i+1].up=work[2*i].up = _y[i][0];
work[2*i+1].down=work[2*i].down = _y[i][1];
work[2*i].x = _x[i][0], work[2*i].in = true;
work[2*i+1].in = false;work[2*i+1].x=_x[i][1];
}
sort(apx, apx+2*n), sort(apy, apy+2*n), sort(apz, apz+2*n);
sort(work, work+2*n);
int usedx = 0, usedy = 0;
for(int i=0; i<2*n; i++){
if(x.find(apx[i]) == x.end()){
x[apx[i]] = usedx;
usedx++;
}
if(y.find(apy[i]) == y.end()){
y[apy[i]] = usedy;
usedy++;
}
}
usedx = 0;
map<int, int>::iterator it = x.begin();
for(;it!=x.end();it++, usedx++){
apx[usedx] = it->first;
}
usedy = 0; it = y.begin();
for(;it!=y.end();it++, usedy++){
apy[usedy] = it->first;
}
for(int i=0; i<2*n; i++)
work[i].up = apy[work[i].up],
work[i].down = apy[work[i].down];
long long ans = 0;
for(int zz = -505; zz<505; zz++){
zzz = zz;
memset(thick, 0, sizeof thick);
memset(Oceng, 0, sizeof Oceng);
memset(Tceng, 0, sizeof Tceng);
int pre = -10000000;
for(int i=0; i<2*n; i++){
if(judge(work[i])){
ans += (work[i].x-pre)*Tceng[0];
if(work[i].in) insert(work[i].up, work[i].down, 0);
else del(work[i].up, work[i].down, 0);
pre = work[i].x;
}
}
}
cout<<"Case "<<cas<<": "<<ans<<endl;
//printf("Case %d: %I64d\n",cas, ans);
x.clear(), y.clear();
}
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s745512026
|
p00000
|
C
|
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define clr(x,y) memset(x,y,sizeof(x))
#define ll long long
using namespace std;
const int inf = 1000000000;
ll dp[1005][1005];
ll a[1005],p;
int q[1005][1005],bg[1005],ed[1005];
int i,j,n;
ll f1(int l,int k,int j){
return dp[j][l]-dp[k][l];
}
ll f2(int l,int k,int j){
return j-k;
}
ll g(int l,int i,int j){
return dp[j][l]+a[i]*(i-j);
}
int main(){
freopen("d:\\in.txt","r",stdin);
scanf("%d%lld",&n,&p);
for(i=1;i<=n;i++) scanf("%lld",&a[i]);
sort(a+1,a+n+1);
ll sum=0;
for(i=1;i<=n;i++){
sum+=a[i];
if(sum>p) break;
}
n=i-1;
clr(bg,0);clr(ed,-1);
for(i=0;i<=n;i++) q[i][++ed[i]]=0,dp[0][i]=0;
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
while(ed[j-1]>bg[j-1]&&f2(j-1,q[j-1][bg[j-1]],q[j-1][bg[j-1]+1])*a[i]>=
f1(j-1,q[j-1][bg[j-1]],q[j-1][bg[j-1]+1])) bg[j-1]++;
dp[i][j]=g(j-1,i,q[j-1][bg[j-1]]);
while(ed[j]>bg[j]&&f1(j,q[j][ed[j]-1],q[j][ed[j]])*f2(j,q[j][ed[j]],i)>=
f1(j,q[j][ed[j]],i)*f2(j,q[j][ed[j]-1],q[j][ed[j]])) ed[j]--;
q[i][++ed[j]]=i;
}
}
int ans=inf;
for(i=1;i<=n;i++){
if(dp[n][i]<=p) ans=min(ans,i);
}
printf("%d %d\n",n,ans);
return 0;
}
|
main.c:3:9: fatal error: algorithm: No such file or directory
3 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s841719811
|
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 | {
| ^
|
s960385871
|
p00000
|
C
|
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define db double
#define rt return
const db eps = 1e-8 , pi = acos(-1.);
inline int sig(db x){rt (x>eps)-(x<-eps);}
db calc(db a , db b , db c) {
db delta = b*b - 4.*a*c;
rt (-b - sqrt(delta)) / (2. * a);
}
int n;
db v[211] , H , l1 , r1 , l2 , r2;
int main() {
freopen("d.in" , "r" , stdin);
while(scanf("%d" , &n) , n) {
scanf("%lf%lf%lf%lf%lf" , &H , &l1 , &r1 , &l2 , &r2);
for(int i = 0 ; i < n ; i++) scanf("%lf" , &v[i]);
int res = 0;
db di = pi / 30000 , x = 0.;
int cnt = 0;
for(db i = 0 ; i < 30000 ; i++) {
// cnt++;
int tmp = 0;
for(int j = 0 ; j < n ; j++) {
db a = 4.9 , b = -v[j]*sin(i) , c = H;
db t = calc(a , b , c) , x = t * v[j] * cos(i);
if(sig(x - l1) >= 0 && sig(r1-x) >= 0 &&
(sig(x-l2) < 0 || sig(x-r2) > 0)) tmp++;
}
if(tmp > res) res = tmp;
x += di;
}
// printf("cnt = %d\n" , cnt);
printf("%d\n" , res);
}
rt 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s026999371
|
p00000
|
C
|
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define eps 1e-8
#define fabs(x) ((x) > 0?(x):-(x))
#define zero(x) (fabs(x) < eps)
#define sqr(x) ((x)*(x))
struct point3{
double x, y, z;
void read(){
scanf("%lf %lf %lf", &x, &y, &z);
};
point3 operator - (const point3 &b)const{
point3 a;
a.x = x - b.x;
a.y = y - b.y;
a.z = z - b.z;
};
friend ostream & operator << (ostream &out, const point3 &a){
out<<a.x<<' '<<a.y<<' '<<a.z;
return out;
};
};
struct plane3{
point3 a, b, c;
friend ostream &operator << (ostream & out, const plane3 &x){
out<<x.a<<' '<<x.b<<' '<<x.c;
return out;
}
};
point3 xmult(const point3 &u, const point3 &v){
point3 ret;
ret.x = u.y * v.z - v.y * u.z;
ret.y = u.z * v.x - u.x * v.z;
ret.z = u.x * v.y - u.y * v.x;
return ret;
};
double dmult(const point3 & u, const point3 &v){
return u.x * v.x + u.y * v.y + u.z * v.z;
};
point3 pvec(const point3 & s1, const point3 &s2, const point3 &s3){
return xmult(s1 - s2, s2 - s3);
};
double dis(const point3 &p1, const point3 &p2){
return sqrt(sqr(p1.x - p2.x) + sqr(p1.y - p2.y) + sqr(p1.z - p2.z));
};
double len(const point3 &p){
return sqrt(sqr(p.x) + sqr(p.y) + sqr(p.z));
};
point3 pvec(const plane3 &s){
return xmult(s.a - s.b, s.b - s.c);
};
int dots_onplane(const point3 &a, const point3 &b, const point3 &c, const point3 &d){
return zero(dmult(pvec(a, b, c), d - a));
};
double ptoplane(const point3 &p, const plane3 & s){
return fabs(dmult(pvec(s), p - s.a)) / len(pvec(s));
};
double area_triangle(const plane3 &p){
return len(xmult(p.b - p.a, p.c - p.a)) / 2;
};
const int MAXN = 50;
const int MAXM = 5000;
struct NODE{
int p[4], next, out;
point3 f;
}s[MAXM];
point3 p[MAXM];
plane3 convex[MAXM];
int edge[MAXN][MAXN];
int tot;
int next(int x){
//cout<<x<<endl;
if (s[x].next == x) return x;
return s[x].next = next(s[x].next);
};
void add(int a, int b, int c, point3 *p){
s[tot].p[0] = a;
s[tot].p[1] = b;
s[tot].p[2] = c;
s[tot].p[3] = a;
s[tot].f = xmult(p[b] - p[a], p[c] - p[a]);
s[tot].out = false;
for (int i = 0; i < 3; ++i)
edge[s[tot].p[i]][s[tot].p[i + 1]] = tot;
++tot;
}
void add(int a, int b, int c, int d, point3 *p){
point3 f = xmult(p[b] - p[a], p[c] - p[a]);
if (dmult(f, p[d] - p[a]) > 0) add(a, c, b, p);
else add(a, b, c, p);
};
int get_convex(int n, point3 * p, plane3 * convex){
for (int i = 0; i < MAXM; ++i)
s[i].next = i;
tot = 0;
for (int i = 3; i < n; ++i)
if (!dots_onplane(p[0], p[1], p[2], p[i])){
swap(p[i], p[3]);
break;
}
//cout<<"hehe"<<endl;
add(0, 1, 2, 3, p);
add(2, 3, 0, 1, p);
add(3, 1, 0, 2, p);
add(3, 1, 2, 0 ,p);
for (int i = 4; i < n; ++i){
cout<<i<<endl;
for (int j = next(0); j < tot; j = next(j + 1)){
cout<<j<<' '<<tot<<endl;
s[j].out = dmult(s[j].f, p[i] - p[s[j].p[0]]) > 0;
}
cout<<i<<endl;
int c = tot;
for (int j = next(0); j < tot; j = next(j + 1))
if (s[j].out){
for (int k = 0; k < 3; ++k)
if (!s[edge[s[j].p[k + 1]][s[j].p[k]]].out)
add(s[j].p[k], s[j].p[k + 1], i, p);
s[j].next = j + 1;
}
}
int i, j;
for (i = 0, j < next(0); j < tot; ++i, j = next(j + 1)){
convex[i].a = p[s[j].p[0]];
convex[i].b = p[s[j].p[1]];
convex[i].c = p[s[j].p[2]];
}
return i;
}
int main(){
int n;
while (true){
scanf("%d", &n);
if (!n) break;
cout<<n<<endl;
for (int i = 0; i < n; ++i)
p[i].read();
cout<<"hehe"<<endl;
int m = get_convex(n, p, convex);
for (int i = 0; i < m; ++i)
cout<<convex[i]<<endl;
cout<<m<<endl;
double ansh = 0;
double anss = 0;
for (int i = 0; i < m; ++i){
double h = 0;
double s = 0;
for (int j = 0; j < n; ++j)
h = max(h, ptoplane(p[j], convex[i]));
cout<<h<<endl;
if (h + eps < ansh) continue;
if (ansh + eps < h) anss = 0;
ansh = h;
for (int j = 0; j < m; ++j){
if (!dots_onplane(convex[i].a, convex[i].b, convex[i].c, convex[j].a)) continue;
if (!dots_onplane(convex[i].a, convex[i].b, convex[i].c, convex[j].b)) continue;
if (!dots_onplane(convex[i].a, convex[i].b, convex[i].c, convex[j].c)) continue;
s += abs(area_triangle(convex[j]));
}
anss = max(anss, s);
}
printf("%.3lf %.3lf\n", ansh, anss);
}
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s930205606
|
p00000
|
C
|
compareTo荳ュ?瑚ソ泌屓-1邀サ莨シC++荳ュ驥崎スス逧?<'
import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
class Node implements Comparable
{
public int val;
public Node(int v){this.val=v;}
public int compareTo(Object obj)
{
if(obj instanceof Node){
Node oo=(Node)obj;
if(this.val<oo.val)
return -1;
if(this.val>oo.val)
return 1;
}
return 0;
}
}
public class Main {
public static void main(String args[]) throws Exception
{
int i;
Scanner cin=new Scanner(System.in);
Node a[]=new Node[4];
for(i=0;i<4;i++)a[i]=new Node(i+1);
Arrays.sort(a);
for(i=0;i<4;i++)
System.out.print(a[i].val+((i==3)?"\n":" "));
}
}
Arrays.sort(long A[],int L,int R);
|
main.c:1:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '?' token
1 | compareTo荳ュ?瑚ソ泌屓-1邀サ莨シC++荳ュ驥崎スス逧?<'
| ^
main.c:1:24: error: invalid suffix "邀サ莨シC" on integer constant
1 | compareTo荳ュ?瑚ソ泌屓-1邀サ莨シC++荳ュ驥崎スス逧?<'
| ^~~~~~~~~~
main.c:1:52: warning: missing terminating ' character
1 | compareTo荳ュ?瑚ソ泌屓-1邀サ莨シC++荳ュ驥崎スス逧?<'
| ^
main.c:1:52: error: missing terminating ' character
main.c:3:1: error: unknown type name 'import'
3 | import java.util.*;
| ^~~~~~
main.c:3:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
3 | import java.util.*;
| ^
main.c:4:1: error: unknown type name 'import'
4 | import java.math.*;
| ^~~~~~
main.c:4:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
4 | import java.math.*;
| ^
main.c:5:1: error: unknown type name 'import'
5 | import java.text.*;
| ^~~~~~
main.c:5:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
5 | import java.text.*;
| ^
main.c:6:1: error: unknown type name 'class'
6 | class Node implements Comparable
| ^~~~~
main.c:6:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'implements'
6 | class Node implements Comparable
| ^~~~~~~~~~
main.c:6:12: error: unknown type name 'implements'
main.c:22:1: error: unknown type name 'public'
22 | public class Main {
| ^~~~~~
main.c:22:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
22 | public class Main {
| ^~~~
main.c:36:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
36 | Arrays.sort(long A[],int L,int R);
| ^
|
s877281994
|
p00000
|
C
|
#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
#define N 500010
#define Max(a, b) ((a)>(b))?(a):(b)
#define Min(a, b) ((a)<(b))?(a):(b)
#define inf 0x7fffffff
#define PB push_back
vector<int> edge[N], length[N];
bool col[N];
int mn[N], mx[N];
void dfs(int loc){
col[loc]=true;
int s=0;
for(int i=0; i<edge[loc].size(); i++){
int to = edge[loc][i];
if(!col[to])
dfs(to),
s++;
}
if(!s) {
mn[loc]=mx[loc]=0;
return;
}
mx[loc] = 0, mn[loc]=inf;
for(int i=0; i<edge[loc].size(); i++){
int to = edge[loc][i];
if(!col[to]){
mn[loc] = Min(mn[loc], length[loc][i]+mx[to]);
mx[loc] = Max(mx[loc], length[loc][i]+mn[to]);
}
}
col[loc] = false;
}
int n, l, r;
int main()
{
while(scanf("%d%d%d", &n, &l, &r)!=EOF){
int a, b, c;
for(int i=0; i<n-1; i++){
scanf("%d%d%d", &a, &b, &c);
edge[a].PB(b);
length[a].PB(c);
}
dfs(0);
if(mx[0]<l || mx[0]>r){
printf("on, my god!\n");
}
else{
printf("%d\n", mx[0]);
}
for(int i=0; i<n; i++)
edge[i].clear(), length[i].clear();
}
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s759353974
|
p00000
|
C
|
#include<stdio.h>
int main()
{
printf("1x1=1\n1x2=2\n.\n.\n9x8=72\n9x9=81\n"};
return 0;
}
|
main.c: In function 'main':
main.c:4:46: error: expected ')' before '}' token
4 | printf("1x1=1\n1x2=2\n.\n.\n9x8=72\n9x9=81\n"};
| ~ ^
| )
main.c:4:46: error: expected ';' before '}' token
4 | printf("1x1=1\n1x2=2\n.\n.\n9x8=72\n9x9=81\n"};
| ^
| ;
main.c: At top level:
main.c:5:1: error: expected identifier or '(' before 'return'
5 | return 0;
| ^~~~~~
main.c:6:1: error: expected identifier or '(' before '}' token
6 | }
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.