submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s165147534 | p00453 | C++ | #include<cstdio>
#include<algorithm>
#include<queue>
#include<cmath>
#define REP(i,a,n) for(int i = a;i < n;i++)
#define rep(i,n) REP(i,0,n)
#define f first
#define s second
#define mpi(l,m,n,o) make_pair(make_pair(l,m),make_pair(n,o))
#define pi pair<pair<int,int>,pair<int,int> >
using namespace std;
int in(){int x; scanf("%d",&x); return x;}
int main(void){
int n,m;
while(scanf("%d%d",&n,&m),n+m){
vector<vector<int> > pos(150);
vector<vector<int> > cos(150);
int flag[151][11][76] = {0};
rep(i,n){
int x = in();
rep(j,x){
pos[i].push_back(in());
cos[i].push_back(in());
}
}
rep(i,pos[0].size()){
Q.push(mpi(0,0,i,0));
}
rep(i,pos[1].size()){
if(m != 0){
Q.push(mpi(0,1,i,1));
}
}
priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
int ans = 0;
while(Q.size()){
pi p = Q.top(); Q.pop();
if(p.f.s == n-1){ans = p.f.f; break;}
if(p.f.s == n-2 && m > p.s.s){ans = p.f.f; break;}
if(flag[p.f.s][pos[p.f.s][p.s.f]][p.s.s] == 1) continue;
flag[p.f.s][pos[p.f.s][p.s.f]][p.s.s] = 1;
rep(i,pos[p.f.s+1].size()){
Q.push(mpi(p.f.f+(cos[p.f.s][p.s.f]+cos[p.f.s+1][i])*abs(pos[p.f.s][p.s.f]-pos[p.f.s+1][i]),p.f.s+1,i,p.s.s));
}
rep(i,pos[p.f.s+2].size()){
if(p.s.s < m) Q.push(mpi(p.f.f+(cos[p.f.s][p.s.f]+cos[p.f.s+2][i])*abs(pos[p.f.s][p.s.f]-pos[p.f.s+2][i]),p.f.s+2,i,p.s.s+1));
}
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:10: error: 'Q' was not declared in this scope
29 | Q.push(mpi(0,0,i,0));
| ^
a.cc:33:13: error: 'Q' was not declared in this scope
33 | Q.push(mpi(0,1,i,1));
| ^
|
s042651099 | p00453 | C++ | #include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main(){
for(int n,m;cin>>n>>m,n|m;){
int k[150],xp[150][10],d[150][10];
for(int i=0;i<n;i++){
cin>>k[i];
for(int j=0;j<k[i];j++){
cin>>xp[i][j]>>d[i][j];
}
}
int c[150][150][10]={{}};
fill(c[0][0],c[150][0],1<<29);
fill(c[0][m],c[0][m+1],0);
if(m>0){
fill(c[1][m-1],c[1][m],0);
}
int ans=1<<30;
for(int y=0;y<n;y++){
for(int j=0;j<=m;j++){
for(int x=0;x<k[y];x++){
for(int dj=0;dj<=!!j#include<cstdio>
#include<algorithm>
#include<queue>
#include<cmath>
#define REP(i,a,n) for(int i = a;i < n;i++)
#define rep(i,n) REP(i,0,n)
#define f first
#define s second
#define mpi(l,m,n,o) make_pair(make_pair(l,m),make_pair(n,o))
#define pi pair<pair<int,int>,pair<int,int> >
using namespace std;
int in(){int x; scanf("%d",&x); return x;}
priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
int main(void){
int n,m;
while(scanf("%d%d",&n,&m),n+m){
vector<vector<int> > pos(151);
vector<vector<int> > cos(151);
int flag[151][11][76] = {0};
while(Q.size()) Q.pop();
rep(i,n){
int x; scanf("%d",&x);
rep(j,x){
int _d;
scanf("%d",&_d);
pos[i].push_back(_d);
scanf("%d",&_d);
cos[i].push_back(_d);
}
}
rep(i,pos[0].size()){
Q.push(mpi(0,0,i,0));
}
rep(i,pos[1].size()){
if(m != 0){
Q.push(mpi(0,1,i,1));
}
}
int ans = 0;
while(Q.size()){
pi p = Q.top(); Q.pop();
if(p.f.s == n-1){ans = p.f.f; break;}
if(p.f.s == n-2 && m > p.s.s){ans = p.f.f; break;}
if(flag[p.f.s][pos[p.f.s][p.s.f]][p.s.s] == 1) continue;
flag[p.f.s][pos[p.f.s][p.s.f]][p.s.s] = 1;
rep(i,pos[p.f.s+1].size()){
Q.push(mpi(p.f.f+(cos[p.f.s][p.s.f]+cos[p.f.s+1][i])*abs(pos[p.f.s][p.s.f]-pos[p.f.s+1][i]),p.f.s+1,i,p.s.s));
}
rep(i,pos[p.f.s+2].size()){
if(p.s.s < m) Q.push(mpi(p.f.f+(cos[p.f.s][p.s.f]+cos[p.f.s+2][i])*abs(pos[p.f.s][p.s.f]-pos[p.f.s+2][i]),p.f.s+2,i,p.s.s+1));
}
}
printf("%d\n",ans);
}
return 0;
}
;dj++){
if(y+1+dj<n){
for(int nx=0;nx<k[y+1+dj];nx++){
c[y+1+dj][j-dj][nx]=min(c[y+1+dj][j-dj][nx],c[y][j][x]+(d[y][x]+d[y+dj+1][nx])*abs(xp[y][x]-xp[y+1+dj][nx]));
}
}else{
ans=min(ans,c[y][j][x]);
}
}
}
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc:26:27: error: stray '#' in program
26 | for(int dj=0;dj<=!!j#include<cstdio>
| ^
a.cc: In function 'int main()':
a.cc:26:27: error: expected ';' before 'include'
26 | for(int dj=0;dj<=!!j#include<cstdio>
| ^~~~~~~~
| ;
a.cc:26:28: error: 'include' was not declared in this scope
26 | for(int dj=0;dj<=!!j#include<cstdio>
| ^~~~~~~
a.cc:26:36: error: 'cstdio' was not declared in this scope; did you mean 'stdin'?
26 | for(int dj=0;dj<=!!j#include<cstdio>
| ^~~~~~
| stdin
In file included from /usr/include/c++/14/deque:65,
from /usr/include/c++/14/queue:62,
from a.cc:28:
/usr/include/c++/14/bits/stl_uninitialized.h:70:1: error: expected primary-expression before 'namespace'
70 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~
a.cc:26:43: error: expected ')' before 'namespace'
26 | for(int dj=0;dj<=!!j#include<cstdio>
| ~ ^
| )
In file included from /usr/include/c++/14/bits/requires_hosted.h:31,
from /usr/include/c++/14/iostream:38,
from a.cc:1:
/usr/include/c++/14/bits/stl_uninitialized.h:70:15: error: expected '=' before '__attribute__'
70 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:70:15: error: expected identifier before '__attribute__'
/usr/include/c++/14/bits/stl_uninitialized.h:70:14: error: expected ';' before '__attribute__'
70 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/bits/stl_uninitialized.h:71:1: error: expected primary-expression before '{' token
71 | {
| ^
/usr/include/c++/14/bits/stl_deque.h:72:15: error: expected '=' before '__attribute__'
72 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:72:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/deque:66:
/usr/include/c++/14/bits/stl_deque.h:72:14: error: expected ';' before '__attribute__'
72 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/bits/stl_deque.h:73:1: error: expected primary-expression before '{' token
73 | {
| ^
/usr/include/c++/14/bits/deque.tcc:61:15: error: expected '=' before '__attribute__'
61 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/deque.tcc:61:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/deque:69:
/usr/include/c++/14/bits/deque.tcc:61:14: error: expected ';' before '__attribute__'
61 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/bits/deque.tcc:62:1: error: expected primary-expression before '{' token
62 | {
| ^
/usr/include/c++/14/deque:82:15: error: expected '=' before '__attribute__'
82 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/deque:82:15: error: expected identifier before '__attribute__'
/usr/include/c++/14/deque:82:14: error: expected ';' before '__attribute__'
82 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/deque:83:1: error: expected primary-expression before '{' token
83 | {
| ^
/usr/include/c++/14/bits/stl_vector.h:77:15: error: expected '=' before '__attribute__'
77 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:77:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/queue:63:
/usr/include/c++/14/bits/stl_vector.h:77:14: error: expected ';' before '__attribute__'
77 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/bits/stl_vector.h:78:1: error: expected primary-expression before '{' token
78 | {
| ^
/usr/include/c++/14/bits/stl_bvector.h:68:15: error: expected '=' before '__attribute__'
68 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:68:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/vector:67:
/usr/include/c++/14/bits/stl_bvector.h:68:14: error: expected ';' before '__attribute__'
68 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/bits/stl_bvector.h:69:1: error: expected primary-expression before '{' token
69 | {
| ^
/usr/include/c++/14/bits/vector.tcc:59:15: error: expected '=' before '__attribute__'
59 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:59:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:59:14: error: expected ';' before '__attribute__'
59 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/bits/vector.tcc:60:1: error: expected primary-expression before '{' token
60 | {
| ^
/usr/include/c++/14/bits/vector.tcc:1218:15: error: expected '=' before '__attribute__'
1218 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:1218:15: error: expected identifier before '__attribute__'
/usr/include/c++/14/bits/vector.tcc:1218:14: error: expected ';' before '__attribute__'
1218 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/bits/vector.tcc:1219:1: error: expected primary-expression before '{' token
1219 | {
| ^
/usr/include/c++/14/vector:88:15: error: expected '=' before '__attribute__'
88 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/vector:88:15: error: expected identifier before '__attribute__'
/usr/include/c++/14/vector:88:14: error: expected ';' before '__attribute__'
88 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/vector:89:1: error: expected primary-expression before '{' token
89 | {
| ^
/usr/include/c++/14/bits/stl_queue.h:65:15: error: expected '=' before '__attribute__'
65 | namespace std _GLIBCXX_VISIBILITY(default)
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:65:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/queue:66:
/usr/include/c++/14/bits/stl_queue.h:65:14: error: expected ';' before '__attribute__'
65 | namespace std _GLIBCXX_VISIBILITY(default)
| ^
| ;
/usr/include/c++/14/bits/stl_queue.h:66:1: error: expected primary-expression before '{' token
66 | {
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683:
/usr/include/math.h:34:1: error: expected unqualified-id before string constant
34 | __BEGIN_DECLS
| ^~~~~~~~~~~~~
In file included from a.cc:29:
/usr/include/c++/14/cmath:83:8: error: expected unqualified-id before string constant
83 | extern "C++"
| ^~~~~
a.cc:37:7: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
37 | int in(){int x; scanf("%d",&x); return x;}
| ^~
a.cc:37:7: note: remove parentheses to default-initialize a variable
37 | int in(){int x; scanf("%d",&x); return x;}
| ^~
| --
a.cc:37:7: note: or replace parentheses with braces to value-initialize a variable
a.cc:37:9: error: a function-definition is not allowed here before '{' token
37 | int in(){int x; scanf("%d",&x); return x;}
| ^
a.cc:38:1: error: 'priority_queue' was not declared in this scope
38 | priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
| ^~~~~~~~~~~~~~
a.cc:30:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
29 | #include<cmath>
+++ |+#include <queue>
30 | #define REP(i,a,n) for(int i = a;i < n;i++)
a.cc:38:18: error: expected primary-expression before ',' token
38 | priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
| ^
a.cc:38:19: error: 'vector' was not declared in this scope
38 | priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
| ^~~~~~
a.cc:30:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
29 | #include<cmath>
+++ |+#include <vector>
30 | #define REP(i,a,n) for(int i = a;i < n;i++)
a.cc:38:29: error: expected primary-expression before '>' token
38 | priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
| ^
a.cc:38:30: error: expected primary-expression before ',' token
38 | priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
| ^
a.cc:38:44: error: expected primary-expression before '>' token
38 | priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
| ^
a.cc:38:45: error: 'Q' was not declared in this scope
38 | priority_queue<pi,vector<pi >,greater<pi > >Q;//cost,y,x,slip
| ^
a.cc:39:15: error: a function-definition is not allowed here before '{' token
39 | int main(void){
| |
s105460342 | p00454 | Java | #include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <memory.h>
using namespace std;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
int W, H, N;
int X1[1000], X2[1000], Y1[1000], Y2[1000];
bool fld[1000 * 6][1000 * 6];
int compress(int *x1, int *x2, int w) {
vector<int> xs;
for(int i = 0; i < N; i++) {
for(int d = -1; d <= 1; d++) {
int tx1 = x1[i] + d, tx2 = x2[i] + d;
if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i = 0; i < N; i++) {
x1[i] = find(xs.begin(),xs.end(),x1[i]) - xs.begin();
x2[i] = find(xs.begin(),xs.end(),x2[i]) - xs.begin();
}
return xs.size();
}
void solve() {
W = compress(X1,X2,W);
H = compress(Y1,Y2,H);
memset(fld,0,sizeof(fld));
for(int i = 0; i < N; i++) {
for(int y = Y1[i]; y <= Y2[i]; y++) {
for(int x = X1[i]; x <= X2[i]; x++) {
fld[y][x] = true;
}
}
}
int ans = 0;
for(int y = 0; y < H; y++) {
for(int x = 0; x < W; x++) {
if(fld[y][x]) continue;
ans++;
queue<pair<int,int> > que;
que.push(make_pair(x,y));
while(!que.empty()) {
int sx = que.front().first, sy = que.front().second;
que.pop();
for(int i = 0; i < 4; i++) {
int tx = sx + dx[i], ty = sy + dy[i];
if(tx < 0 || ty < 0 || tx >= W || ty >= H) continue;
if(fld[ty][tx]) continue;
que.push(make_pair(tx,ty));
fld[ty][tx] = true;
}
}
}
}
printf("%d\n",ans-1);
}
int main() {
while(1) {
scanf("%d %d",&W,&H);
if(W == 0 && H == 0) break;
W++;
H++;
scanf("%d",&N);
for(int i = 0; i < N; i++) {
scanf("%d %d %d %d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
X1[i]++;
Y1[i]++;
X2[i]++;
Y2[i]++;
}
solve();
}
} | Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <vector>
^
Main.java:3: error: illegal character: '#'
#include <math.h>
^
Main.java:4: error: illegal character: '#'
#include <stdio.h>
^
Main.java:5: error: illegal character: '#'
#include <algorithm>
^
Main.java:6: error: illegal character: '#'
#include <string>
^
Main.java:7: error: illegal character: '#'
#include <map>
^
Main.java:8: error: illegal character: '#'
#include <queue>
^
Main.java:9: error: illegal character: '#'
#include <memory.h>
^
Main.java:11: error: class, interface, enum, or record expected
int dx[] = {1,0,-1,0};
^
Main.java:12: error: class, interface, enum, or record expected
int dy[] = {0,1,0,-1};
^
Main.java:14: error: class, interface, enum, or record expected
int W, H, N;
^
Main.java:15: error: class, interface, enum, or record expected
int X1[1000], X2[1000], Y1[1000], Y2[1000];
^
Main.java:17: error: class, interface, enum, or record expected
bool fld[1000 * 6][1000 * 6];
^
Main.java:19: error: unnamed classes are a preview feature and are disabled by default.
int compress(int *x1, int *x2, int w) {
^
(use --enable-preview to enable unnamed classes)
Main.java:19: error: <identifier> expected
int compress(int *x1, int *x2, int w) {
^
Main.java:19: error: class, interface, enum, or record expected
int compress(int *x1, int *x2, int w) {
^
Main.java:22: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:22: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:22: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:23: error: class, interface, enum, or record expected
for(int d = -1; d <= 1; d++) {
^
Main.java:23: error: class, interface, enum, or record expected
for(int d = -1; d <= 1; d++) {
^
Main.java:25: error: class, interface, enum, or record expected
if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
^
Main.java:26: error: class, interface, enum, or record expected
if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
^
Main.java:27: error: class, interface, enum, or record expected
}
^
Main.java:30: error: class, interface, enum, or record expected
xs.erase(unique(xs.begin(),xs.end()),xs.end());
^
Main.java:32: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:32: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:32: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:34: error: class, interface, enum, or record expected
x2[i] = find(xs.begin(),xs.end(),x2[i]) - xs.begin();
^
Main.java:35: error: class, interface, enum, or record expected
}
^
Main.java:37: error: class, interface, enum, or record expected
}
^
Main.java:41: error: class, interface, enum, or record expected
H = compress(Y1,Y2,H);
^
Main.java:43: error: class, interface, enum, or record expected
memset(fld,0,sizeof(fld));
^
Main.java:44: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:44: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:44: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:45: error: class, interface, enum, or record expected
for(int y = Y1[i]; y <= Y2[i]; y++) {
^
Main.java:45: error: class, interface, enum, or record expected
for(int y = Y1[i]; y <= Y2[i]; y++) {
^
Main.java:46: error: class, interface, enum, or record expected
for(int x = X1[i]; x <= X2[i]; x++) {
^
Main.java:46: error: class, interface, enum, or record expected
for(int x = X1[i]; x <= X2[i]; x++) {
^
Main.java:48: error: class, interface, enum, or record expected
}
^
Main.java:54: error: class, interface, enum, or record expected
for(int y = 0; y < H; y++) {
^
Main.java:54: error: class, interface, enum, or record expected
for(int y = 0; y < H; y++) {
^
Main.java:54: error: class, interface, enum, or record expected
for(int y = 0; y < H; y++) {
^
Main.java:55: error: class, interface, enum, or record expected
for(int x = 0; x < W; x++) {
^
Main.java:55: error: class, interface, enum, or record expected
for(int x = 0; x < W; x++) {
^
Main.java:57: error: class, interface, enum, or record expected
ans++;
^
Main.java:60: error: class, interface, enum, or record expected
que.push(make_pair(x,y));
^
Main.java:61: error: class, interface, enum, or record expected
while(!que.empty()) {
^
Main.java:63: error: class, interface, enum, or record expected
que.pop();
^
Main.java:65: error: class, interface, enum, or record expected
for(int i = 0; i < 4; i++) {
^
Main.java:65: error: class, interface, enum, or record expected
for(int i = 0; i < 4; i++) {
^
Main.java:65: error: class, interface, enum, or record expected
for(int i = 0; i < 4; i++) {
^
Main.java:67: error: class, interface, enum, or record expected
if(tx < 0 || ty < 0 || tx >= W || ty >= H) continue;
^
Main.java:68: error: class, interface, enum, or record expected
if(fld[ty][tx]) continue;
^
Main.java:69: error: class, interface, enum, or record expected
que.push(make_pair(tx,ty));
^
Main.java:70: error: class, interface, enum, or record expected
fld[ty][tx] = true;
^
Main.java:71: error: class, interface, enum, or record expected
}
^
Main.java:76: error: class, interface, enum, or record expected
}
^
Main.java:82: error: class, interface, enum, or record expected
if(W == 0 && H == 0) break;
^
Main.java:83: error: class, interface, enum, or record expected
W++;
^
Main.java:84: error: class, interface, enum, or record expected
H++;
^
Main.java:85: error: class, interface, enum, or record expected
scanf("%d",&N);
^
Main.java:86: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:86: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:86: error: class, interface, enum, or record expected
for(int i = 0; i < N; i++) {
^
Main.java:88: error: class, interface, enum, or record expected
X1[i]++;
^
Main.java:89: error: class, interface, enum, or record expected
Y1[i]++;
^
Main.java:90: error: class, interface, enum, or record expected
X2[i]++;
^
Main.java:91: error: class, interface, enum, or record expected
Y2[i]++;
^
Main.java:92: error: class, interface, enum, or record expected
}
^
Main.java:94: error: class, interface, enum, or record expected
}
^
73 errors
|
s643412229 | p00454 | C | #include<cstring>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define maxn 1005
#define INF 0x3f3f3f3f3f
#define eps 1e-6
using namespace std;
typedef long long ll;
int w, h, n, ans, tx, ty;
int lx[maxn], ly[maxn], rx[maxn], ry[maxn];
int hx[maxn], hy[maxn];
int fld[maxn * 2][maxn * 2];
int pos[4][2] = { 1,0,0,1,-1,0,0,-1 };
struct node
{
int x, y;
};
bool judge(int x, int y)
{
if (x < 0 || y < 0 || x >= w || y >= h)return false;
if (fld[x][y] > 0)return false;
return true;
}
void imos()
{
memset(fld, 0, sizeof(fld));
for (int i = 1; i <= n; i++)
{
fld[lx[i]][ly[i]]++;
fld[lx[i]][ry[i]]--;
fld[rx[i]][ly[i]]--;
fld[rx[i]][ry[i]]++;
}
for (int i = 0; i < w; i++)
{
for (int j = 1; j < h; j++)
fld[i][j] += fld[i][j - 1];
}
for (int j = 0; j < h; j++)
{
for (int i = 1; i < w; i++)
fld[i][j] += fld[i - 1][j];
}
}
void bfs(int sx, int sy)
{
ans++;
node st, now, nxt;
queue<node>q;
st.x = sx, st.y = sy;
fld[sx][sy] = 1;
q.push(st);
while (!q.empty())
{
now = q.front();
q.pop();
for (int i = 0; i < 4; i++)
{
nxt.x = now.x + pos[i][0];
nxt.y = now.y + pos[i][1];
if (judge(nxt.x, nxt.y))
{
q.push(nxt);
fld[nxt.x][nxt.y] = 1;
}
}
}
}
int main()
{
while (scanf("%d%d", &w, &h))
{
if (w == 0 && h == 0)break;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d%d%d%d", &lx[i], &ly[i], &rx[i], &ry[i]);
tx = ty = 0;
for (int i = 1; i <= n; i++)
{
hx[++tx] = lx[i], hx[++tx] = rx[i];
hy[++ty] = ly[i], hy[++ty] = ry[i];
}
hx[++tx] = 0, hx[++tx] = w;
hy[++ty] = 0, hy[++ty] = h;
sort(hx + 1, hx + tx + 1);
sort(hy + 1, hy + ty + 1);
w = unique(hx + 1, hx + tx + 1) - (hx + 1);
h = unique(hy + 1, hy + ty + 1) - (hy + 1);
for (int i = 1; i <= n; i++)
{
lx[i] = lower_bound(hx + 1, hx + w + 1, lx[i]) - hx - 1;
rx[i] = lower_bound(hx + 1, hx + w + 1, rx[i]) - hx - 1;
ly[i] = lower_bound(hy + 1, hy + h + 1, ly[i]) - hy - 1;
ry[i] = lower_bound(hy + 1, hy + h + 1, ry[i]) - hy - 1;
}
w--, h--;
imos();
ans = 0;
for (int i = 0; i < w; i++)
{
for (int j = 0; j < h; j++)
{
if (fld[i][j] == 0)
bfs(i, j);
}
}
printf("%d\n", ans);
}
return 0;
}
| main.c:1:9: fatal error: cstring: No such file or directory
1 | #include<cstring>
| ^~~~~~~~~
compilation terminated.
|
s693915793 | p00454 | C++ | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
public class Main {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String[] tmpArray = br.readLine().split(" ");
int w = Integer.parseInt(tmpArray[0]);
int h = Integer.parseInt(tmpArray[1]);
if(w == 0 && h == 0){
break;
}
int n = Integer.parseInt(br.readLine());
int x1[] = new int[n];
int x2[] = new int[n];
int y1[] = new int[n];
int y2[] = new int[n];
for(int i = 0; i < n; i++){
tmpArray = br.readLine().split(" ");
x1[i] = Integer.parseInt(tmpArray[0]);
y1[i] = Integer.parseInt(tmpArray[1]);
x2[i] = Integer.parseInt(tmpArray[2]);
y2[i] = Integer.parseInt(tmpArray[3]);
}
solve(x1, y1, x2, y2, w, h);
}
}
static void solve(int[] x1, int[] y1, int[] x2, int[] y2, int w, int h){
int n = x1.length;
// System.out.println("before "+w+"*"+h);
w = compress(x1, x2, w);
h = compress(y1, y2, h);
// System.out.println("after "+w+"*"+h);
boolean matrix[][] = new boolean[h][w];
for(int i = 0; i < n; i++){
if((i + 1)%10 == 0){
// System.out.println("painted: "+(i + 1));
}
paint(matrix, x1[i], y1[i], x2[i], y2[i]);
}
// System.out.println();
// showBoard(matrix);
long result = 0;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(matrix[i][j] == WHITE){
// System.out.println("start bfs from"+j+" "+i);
visitWithBFS(matrix, j, i);
result++;
// System.out.println("====================");
// showBoard(matrix);
}
}
}
System.out.println(result);
}
static final boolean WHITE = false;
static final boolean BLACK = true;
//登場する値の最大値を返す
static int compress(int[] array1, int[] array2, int limit){
int n = array1.length;
HashSet<Integer> set = new HashSet<Integer>();
int d[] = {-1, 0, 1};
for(int i = 0; i < n; i++){
for(int j = 0; j <= 2; j++){
int tmp1 = array1[i] + d[j];
int tmp2 = array2[i] + d[j];
if(tmp1 >= 0 && tmp1 <= limit){
set.add(tmp1);
}
if(tmp2 >= 0 && tmp2 <= limit){
set.add(tmp2);
}
}
}
int size = set.size();
int compressedData[] = new int[size];
int index = 0;
Iterator<Integer> it = set.iterator();
while(it.hasNext()){
compressedData[index++] = it.next();
}
Arrays.sort(compressedData);
//debug
// for(int i = 0; i < size; i++){
// System.out.print(compressedData[i]+" ");
// }
// System.out.println();
//
// System.out.println("before");
// for(int i = 0; i < n ; i++){
// System.out.print(array1[i]+" ");
// }
// System.out.println();
// for(int i = 0; i < n ; i++){
// System.out.print(array2[i]+" ");
// }
// System.out.println();
//compress
for(int i = 0; i < n; i++){
array1[i] = Arrays.binarySearch(compressedData, array1[i]);
array2[i] = Arrays.binarySearch(compressedData, array2[i]);
}
// System.out.println("after");
// for(int i = 0; i < n ; i++){
// System.out.print(array1[i]+" ");
// }
// System.out.println();
// for(int i = 0; i < n ; i++){
// System.out.print(array2[i]+" ");
// }
// System.out.println();
// return compressedData[size - 1];
return size - 1;
}
static void visitWithBFS(boolean matrix[][], int x, int y){
ArrayDeque<Point> que = new ArrayDeque<Point>();
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
que.add(new Point(x, y));
matrix[y][x] = BLACK;
while(!que.isEmpty()){
Point tmpPoint = que.removeFirst();
// matrix[tmpPoint.y][tmpPoint.x] = BLACK;
// System.out.println(tmpPoint);
//四方向
for(int i = 0; i < 4; i++){
int newX = tmpPoint.x + dx[i];
int newY = tmpPoint.y + dy[i];
if(newX >= 0 && newX < matrix[0].length &&
newY >= 0 && newY < matrix.length &&
matrix[newY][newX] == WHITE){
que.add(new Point(newX, newY));
matrix[newY][newX] = BLACK;
}
}
// System.out.println("queue size"+que.size());
}
}
static void paint(boolean[][] matrix, int x1, int y1, int x2, int y2){
for(int i = y1; i < y2 ; i++){
for(int j = x1; j < x2 ; j++){
matrix[i][j] = BLACK;
}
}
}
static void showBoard(boolean[][] matrix){
for(int i = matrix.length - 1; i >= 0; i--){
for(int j = 0; j < matrix[0].length; j++){
if(matrix[i][j]){
System.out.print("#");
}
else {
System.out.print(".");
}
}
System.out.println();
}
}
}
class Point {
int x, y;
Point(int x, int y){
this.x = x;
this.y = y;
}
public String toString(){
return "Point x = "+x+" y = "+y ;
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.io.BufferedReader;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.io.InputStreamReader;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.util.ArrayDeque;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.Arrays;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.util.HashSet;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.util.Iterator;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: expected unqualified-id before 'public'
10 | public class Main {
| ^~~~~~
a.cc:220:15: error: expected ':' before 'String'
220 | public String toString(){
| ^~~~~~~
| :
a.cc:220:16: error: 'String' does not name a type
220 | public String toString(){
| ^~~~~~
a.cc:223:2: error: expected ';' after class definition
223 | }
| ^
| ;
a.cc: In constructor 'Point::Point(int, int)':
a.cc:216:22: error: request for member 'x' in '(Point*)this', which is of pointer type 'Point*' (maybe you meant to use '->' ?)
216 | this.x = x;
| ^
a.cc:217:22: error: request for member 'y' in '(Point*)this', which is of pointer type 'Point*' (maybe you meant to use '->' ?)
217 | this.y = y;
| ^
|
s353928935 | p00454 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
typedef pair<int,int> P;
#define MAX_N 1000
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int W,H,N;
int X1[MAX_N],X2[MAX_N],Y1[MAX_N],Y2[MAX_N];
bool fld[MAX_N*6][MAX_N*6];
int compress(int *x1,int *x2,int w){
vector<int> xs;
for(int i=0;i<N;i++){
for(int d=-1;d<=1;d++){
int tx1=x1[i]+d,tx2=x2[i]+d;
if(1<=tx1&&tx1<=w)xs.push_back(tx1);
if(1<=tx2&&tx2<=w)xs.push_back(tx2);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i=0;i<N;i++){
x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
}
return xs.size();
}
void solve(){
W = compress(X1,X2,W);
H = compress(Y1,Y2,H);
memset(fld,0,sizeof(fld));
for(int i=0;i<N;i++){
for(int y=Y1[i];y<=Y2[i];y++){
for(int x=X1[i];x<=X2[i];x++){
fld[y][x]=true;
}
}
}
/*
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cout<<fld[i][j];
}
cout<<endl;
}
*/
int ans=0;
for(int y=0;y<H;y++){
for(int x=0;x<W;x++){
if(fld[y][x])continue;
ans++;
queue< P > que;
que.push(P(x,y));
while(!que.empty()){
int sx=que.front().first;
int sy=que.front().second;
que.pop();
for(int i=0;i<4;i++){
int tx=sx+dx[i],ty=sy+dy[i];
if(tx<0||W<=tx)continue;
if(ty<0||H<=ty)continue;
if(fld[ty][tx])continue;
que.push(P(tx,ty));
fld[ty][tx]=true;
}
}
}
}
cout<<ans<<endl;
}
int main(){
while(1){
cin>>W>>H;
if(W==0&&H==0)break;
cin>>N;
for(int i=0;i<N;i++){
cin>>X1[i]>>Y1[i]>>X2[i]>>Y2[i];
X1[i]++;
Y1[i]++;
}
solve();
}
return 0;
} | a.cc: In function 'void solve()':
a.cc:44:3: error: 'memset' was not declared in this scope
44 | memset(fld,0,sizeof(fld));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<queue>
+++ |+#include <cstring>
5 | using namespace std;
|
s339727292 | p00454 | C++ | #include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctYpe>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <compleX>
#include <cassert>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
int w,h;
vector<int> Xs;
vector<int> Ys;
int n;
int X1[1000];
int Y1[1000];
int X2[1000];
int Y2[1000];
int table[2002][2002];
void dfs(int i, int j){
table[i][j]=1;
int dX=1,dY=0;
for(int k=0;k<4;k++,swap(dX,dY),dX=-dX){
int X=i+dX;
int Y=j+dY;
if(0<=X&&X<Xs.size()&&0<=Y&&Y<Ys.size()&&table[X][Y]==0){
dfs(X,Y);
}
}
}
int main() {
while(1){
cin >> w >> h;
if(w==0&&h==0){
return 0;
}
memset(table,0,sizeof(table));
Xs.clear();
Xs.push_back(0);
Ys.push_back(0);
Xs.push_back(w-1);
Ys.push_back(h-1);
Ys.clear();
cin >> n;
for(int i=0;i<n;i++){
cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
Xs.push_back(X1[i]);
Xs.push_back(X2[i]);
Ys.push_back(Y1[i]);
Ys.push_back(Y2[i]);
}
sort(Xs.begin(),Xs.end());
Xs.resize(unique(Xs.begin(),Xs.end())-Xs.begin());
sort(Ys.begin(),Ys.end());
Ys.resize(unique(Ys.begin(),Ys.end())-Ys.begin());
for(int i=0;i<n;i++){
int s=lower_bound(Xs.begin(),Xs.end(),X1[i])-Xs.begin();
int t=lower_bound(Ys.begin(),Ys.end(),Y1[i])-Ys.begin();
int u=lower_bound(Xs.begin(),Xs.end(),X2[i])-Xs.begin();
int v=lower_bound(Ys.begin(),Ys.end(),Y2[i])-Ys.begin();
table[s][t]++;
table[s][v]--;
table[u][t]--;
table[u][v]++;
}
if(Xs.back()>=w)Xs.pop_back();
if(Ys.back()>=h)Ys.pop_back();
for(int i=0;i<Xs.size();i++){
for(int j=1;j<Ys.size();j++){
table[i][j]+=table[i][j-1];
}
}
for(int i=1;i<Xs.size();i++){
for(int j=0;j<Ys.size();j++){
table[i][j]+=table[i-1][j];
}
}
/*
for(int j=Ys.size()-1;j>=0;j--){
for(int i=0;i<Xs.size();i++){
cout << table[i][j];
}
cout << endl;
}*/
int ret=0;
for(int i=0;i<Xs.size();i++){
for(int j=0;j<Ys.size();j++){
if(table[i][j]==0){
//cout << i << ", " << j << endl;
dfs(i,j);
ret++;
}
}
}
cout << ret << endl;
}
} | a.cc:15:10: fatal error: cctYpe: No such file or directory
15 | #include <cctYpe>
| ^~~~~~~~
compilation terminated.
|
s802761722 | p00454 | C++ | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const double eps = 1e-10;
const double pi = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;
int n;
int w,h;
int x1[1010],x2[1010];
int y1[1010],y2[1010];
bool board[6000][6000];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int compress(int* z1,int* z2,int len){
vi zs;
rep(i,n)for(int d=-1;d<=1;d++){
int tz1=z1[i]+d,tz2=z2[i]+d;
if(0<=tz1&&tz1<=len) zs.pb(tz1);
if(0<=tz2&&tz2<=len) zs.pb(tz2);
}
sort(zs.begin(),zs.end());
zs.erase(unique(zs.begin(),zs.end()),zs.end());
rep(i,n){
z1[i]=find(zs.begin(),zs.end(),z1[i])-zs.begin();
z2[i]=find(zs.begin(),zs.end(),z2[i])-zs.begin();
}
return zs.size();
}
int main(void){
while(cin >> w >> h){
if(w==0||h==0)
break;
cin >> n;
rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
rep(i,n) x2[i]--,y2[i]--;
w=compress(x1,x2,w-1);
h=compress(y1,y2,h-1);
clr(board,0);
rep(i,n){
for(int y=y1[i];y<=y2[i];y++)
for(int x=x1[i];x<=x2[i];x++)
board[y][x]=true;
}
int ans=0;
rep(y,h)rep(x,w){
if(board[y][x])
continue;
ans++;
queue<pii> q;
q.push(mp(x,y));
while(!q.empty()){
int sx=q.front().first;
int sy=q.front().second;
q.pop();
rep(i,4){
int nx=sx+dx[i];
int ny=sy+dy[i];
if(nx<0||w<=nx||ny<0||h<=ny) continue;
if(board[ny][nx]) continue;
board[ny][nx]=true;
q.push(mp(nx,ny));
}
}
}
cout << ans << endl;
}
return 0;
} | a.cc:35:12: error: 'int y1 [1010]' redeclared as different kind of entity
35 | int y1[1010],y2[1010];
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:62:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ^
a.cc:62:39: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~~~~~~~~~ ^~ ~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(short int)(y1 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(short unsigned int)(y1 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(int)(y1 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(unsigned int)(y1 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(long int)(y1 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(long unsigned int)(y1 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(long long int)(y1 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(long long unsigned int)(y1 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) no |
s273297078 | p00454 | C++ | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const double eps = 1e-10;
const double pi = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;
int n;
int w,h;
int x1[1010],x2[1010];
int y1[1010],y2[1010];
bool board[6000][6000];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int compress(int* z1,int* z2,int len){
vi zs;
rep(i,n)for(int d=-1;d<=1;d++){
int tz1=z1[i]+d,tz2=z2[i]+d;
if(0<=tz1&&tz1<=len) zs.pb(tz1);
if(0<=tz2&&tz2<=len) zs.pb(tz2);
}
sort(zs.begin(),zs.end());
zs.erase(unique(zs.begin(),zs.end()),zs.end());
rep(i,n){
z1[i]=find(zs.begin(),zs.end(),z1[i])-zs.begin();
z2[i]=find(zs.begin(),zs.end(),z2[i])-zs.begin();
}
return zs.size();
}
int main(void){
while(cin >> w >> h){
if(w==0||h==0)
break;
cin >> n;
rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
rep(i,n) x2[i]--,y2[i]--;
w=compress(x1,x2,w-1);
h=compress(y1,y2,h-1);
clr(board,0);
rep(i,n){
for(int y=y1[i];y<=y2[i];y++)
for(int x=x1[i];x<=x2[i];x++)
board[y][x]=true;
}
int ans=0;
rep(y,h)rep(x,w){
if(board[y][x])
continue;
ans++;
queue<pii> q;
q.push(mp(x,y));
while(!q.empty()){
int sx=q.front().first;
int sy=q.front().second;
q.pop();
rep(i,4){
int nx=sx+dx[i];
int ny=sy+dy[i];
if(nx<0||w<=nx||ny<0||h<=ny) continue;
if(board[ny][nx]) continue;
board[ny][nx]=true;
q.push(mp(nx,ny));
}
}
}
cout << ans << endl;
}
return 0;
} | a.cc:35:12: error: 'int y1 [1010]' redeclared as different kind of entity
35 | int y1[1010],y2[1010];
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:62:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ^
a.cc:62:39: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~~~~~~~~~ ^~ ~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(short int)(y1 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(short unsigned int)(y1 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(int)(y1 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(unsigned int)(y1 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(long int)(y1 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(long unsigned int)(y1 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(long long int)(y1 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:62:46: error: cannot bind rvalue '(long long unsigned int)(y1 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:46: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
62 | rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
| ~~~~^
| |
| double (*)(double) no |
s604627713 | p00454 | C++ | #include <iostream>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstring>
#include <sstream>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const double eps = 1e-10;
const double pi = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;
int n;
int w,h;
int x1[1010],x2[1010];
int y1[1010],y2[1010];
bool board[6000][6000];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int compress(int* z1,int* z2,int len){
vi zs;
rep(i,n)for(int d=-1;d<=1;d++){
int tz1=z1[i]+d,tz2=z2[i]+d;
if(0<=tz1&&tz1<=len) zs.pb(tz1);
if(0<=tz2&&tz2<=len) zs.pb(tz2);
}
sort(zs.begin(),zs.end());
zs.erase(unique(zs.begin(),zs.end()),zs.end());
rep(i,n){
z1[i]=find(zs.begin(),zs.end(),z1[i])-zs.begin();
z2[i]=find(zs.begin(),zs.end(),z2[i])-zs.begin();
}
return zs.size();
}
int main(void){
while(cin >> w >> h){
if(w==0||h==0)
break;
cin >> n;
rep(i,n) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
rep(i,n) x2[i]--,y2[i]--;
w=compress(x1,x2,w-1);
h=compress(y1,y2,h-1);
clr(board,0);
rep(i,n){
for(int y=y1[i];y<=y2[i];y++)
for(int x=x1[i];x<=x2[i];x++)
board[y][x]=true;
}
int ans=0;
rep(y,h)rep(x,w){
if(board[y][x])
continue;
ans++;
queue<pii> q;
q.push(mp(x,y));
while(!q.empty()){
int sx=q.front().first;
int sy=q.front().second;
q.pop();
rep(i,4){
int nx=sx+dx[i];
int ny=sy+dy[i];
if(nx<0||w<=nx||ny<0||h<=ny) continue;
if(board[ny][nx]) continue;
board[ny][nx]=true;
q.push(mp(nx,ny));
}
}
}
cout << ans << endl;
}
return 0;
} | a.cc:35:20: error: 'acos' was not declared in this scope
35 | const double pi = acos(-1.0);
| ^~~~
a.cc:42:5: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
42 | int y1[1010],y2[1010];
| ^~
|
s550769860 | p00454 | C++ | #include <iostream>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstring>
#include <sstream>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const double eps = 1e-10;
const double pi = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;
int n;
int w,h;
int x1[1010],x2[1010];
int yy1[1010],y2[1010];
bool board[6000][6000];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int compress(int* z1,int* z2,int len){
vi zs;
rep(i,n)for(int d=-1;d<=1;d++){
int tz1=z1[i]+d,tz2=z2[i]+d;
if(0<=tz1&&tz1<=len) zs.pb(tz1);
if(0<=tz2&&tz2<=len) zs.pb(tz2);
}
sort(zs.begin(),zs.end());
zs.erase(unique(zs.begin(),zs.end()),zs.end());
rep(i,n){
z1[i]=find(zs.begin(),zs.end(),z1[i])-zs.begin();
z2[i]=find(zs.begin(),zs.end(),z2[i])-zs.begin();
}
return zs.size();
}
int main(void){
while(cin >> w >> h){
if(w==0||h==0)
break;
cin >> n;
rep(i,n) cin >> x1[i] >> yy1[i] >> x2[i] >> y2[i];
rep(i,n) x2[i]--,y2[i]--;
w=compress(x1,x2,w-1);
h=compress(yy1,y2,h-1);
clr(board,0);
rep(i,n){
for(int y=yy1[i];y<=y2[i];y++)
for(int x=x1[i];x<=x2[i];x++)
board[y][x]=true;
}
int ans=0;
rep(y,h)rep(x,w){
if(board[y][x])
continue;
ans++;
queue<pii> q;
q.push(mp(x,y));
while(!q.empty()){
int sx=q.front().first;
int sy=q.front().second;
q.pop();
rep(i,4){
int nx=sx+dx[i];
int ny=sy+dy[i];
if(nx<0||w<=nx||ny<0||h<=ny) continue;
if(board[ny][nx]) continue;
board[ny][nx]=true;
q.push(mp(nx,ny));
}
}
}
cout << ans << endl;
}
return 0;
} | a.cc:35:20: error: 'acos' was not declared in this scope
35 | const double pi = acos(-1.0);
| ^~~~
|
s727910051 | p00454 | C++ | #include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
int W,H,N;
int X1[5000];int X2[5000];
int Y1[5000];int Y2[5000];
int field[5001][5001];
bool Field[5001][5001];
int dx[4]={-1,0,0,1};
int dy[4]={0,-1,1,0};
bool FX[1000005];bool FY[1000005];
int Num_X[5000];int Num_Y[5000];
queue<pair<int,int> >que;
int main()
{
while(true){
que.clear();
for(int i=0;i<5001;i++)for(int j=0;j<5001;j++)field[i][j]=0;
scanf("%d%d",&W,&H);
if(W==0&&H==0)return 0;
scanf("%d",&N);
for(int i=0;i<N;i++)scanf("%d%d%d%d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
for(int i=0;i<N;i++){
X1[i]++;X2[i]++;Y1[i]++;Y2[i]++;
if(X1[i]!=1)FX[X1[i]-1]=true;
FX[X1[i]]=true;
if(X2[i]!=W+1)FX[X2[i]]=true;
FX[X2[i]-1]=true;
FY[Y1[i]]=true;
if(Y1[i]!=1)FY[Y1[i]-1]=true;
if(Y2[i]!=H+1)FY[Y2[i]]=true;
FY[Y2[i]-1]=true;
}
int cou1=0,cou2=0;
for(int i=0;i<=W+1;i++){
if(FX[i]){
Num_X[cou1]=i;
cou1++;
}
}
for(int i=0;i<=H+1;i++){
if(FY[i]){
Num_Y[cou2]=i;
cou2++;
}
}
//for(int i=0;i<cou1;i++)printf("%d:%d\n",i,Num_X[i]);
//for(int i=0;i<cou2;i++)printf("%d:%d\n",i,Num_Y[i]);
for(int i=0;i<N;i++){
for(int j=0;j<cou1;j++){
if(Num_X[j]==X1[i])X1[i]=j;
if(Num_X[j]==X2[i])X2[i]=j;
}
if(X2[i]>=cou1)X2[i]=cou1+1;
for(int j=0;j<cou2;j++){
if(Num_Y[j]==Y1[i])Y1[i]=j;
if(Num_Y[j]==Y2[i])Y2[i]=j;
}
if(Y2[i]>=cou2)Y2[i]=cou2+1;
}
for(int i=0;i<N;i++){
field[X1[i]][Y1[i]]++;
field[X2[i]][Y2[i]]++;
field[X1[i]][Y2[i]]--;
field[X2[i]][Y1[i]]--;
//printf("%d\n",i);
}
for(int i=1;i<cou1;i++){
for(int j=0;j<cou2;j++){
field[i][j]+=field[i-1][j];
}
}
for(int i=0;i<cou1;i++){
for(int j=1;j<cou2;j++){
field[i][j]+=field[i][j-1];
}
}
for(int i=0;i<cou1;i++){
for(int j=0;j<cou2;j++){
if(field[i][j]<=0)Field[i][j]=true;
else Field[i][j]=false;
}
}
/*for(int i=0;i<cou2;i++){
for(int j=0;j<cou1;j++){
printf("%d ",Field[j][i]);
}
printf("\n");
}*/
int ans=0;
for(int i=0;i<cou1;i++){
for(int j=0;j<cou2;j++){
if(!Field[i][j])continue;
ans++;
que.push(make_pair(i,j));
while(!que.empty()){
pair<int,int> P=que.front();que.pop();
int pf=P.first;int ps=P.second;
if(!Field[pf][ps])continue;
Field[pf][ps]=false;
for(int k=0;k<4;k++){
if(pf+dx[k]<0)continue;
if(pf+dx[k]>=cou1)continue;
if(ps+dy[k]<0)continue;
if(ps+dy[k]>=cou2)continue;
if(!Field[pf+dx[k]][ps+dy[k]])continue;
que.push(make_pair(pf+dx[k],ps+dy[k]));
}
}
}
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:21: error: 'class std::queue<std::pair<int, int> >' has no member named 'clear'
18 | que.clear();
| ^~~~~
|
s336219396 | p00454 | C++ | #include <bits/stdc++.h>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int INF = 1 << 29;
const double EPS = 1e-10;
double zero(double d) {
return d < EPS ? 0.0 : d;
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
return os << '(' << p.first << ',' << p.second << ')';
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
os << '[';
rep(i, a.size()) os << (i ? " " : "") << a[i];
return os << ']';
}
// to avoid error on mingw
string toString(int i) {
stringstream ss;
ss << i;
return ss.str();
}
const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
ll res = 1ll;
ll x = a;
while (k != 0) {
if ((k & 1) == 1)
res = (res * x) % M;
x = (x * x) % M;
k >>= 1;
}
return res;
}
int compress(vector<pii>& p, int w) {
vi xs;
rep(i, p.size()) {
REP(d, -1, 1+1) { // -1, 0, 1 // 蟾ヲ蜿ウ繧貞性繧√※菫晏ュ? int tx1 = p[i].first + d, tx2 = p[i].second + d;
if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
}
}
// 驥崎、?r蜑企勁
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
// 蝨ァ邵ョ縺励◆蛟、縺ォ譖ク縺肴鋤縺? rep(i, p.size()) {
p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
p[i].second = find(xs.begin(), xs.end(), p[i].second) - xs.begin();
}
return xs.size();
}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
int main() {
cout.setf(ios::fixed, ios::floatfield);
cout.precision(8);
ios_base::sync_with_stdio(false);
int w, h, n;
cin >> w >> h >> n;
vector<pii> px(n), py(n);
rep(i, n)
cin >> px[i].first >> py[i].first >> px[i].second >> py[i].second;
w = compress(px, w);
h = compress(py, h);
w--, h--;
// 蝪励j縺、縺カ縺? vector< vector<bool> > fld(h, vector<bool>(w, false));
rep(i, n) {
REP(y, py[i].first, py[i].second) {
REP(x, px[i].first, px[i].second)
fld[y][x] = true;
}
}
int res = 0;
rep(r, h) {
rep(c, w) {
if(!fld[r][c]) {
res++;
// bfs
queue<pii> que;
que.push(mp(r, c));
while(!que.empty()) {
pii now = que.front(); que.pop();
fld[now.first][now.second] = true;
rep(d, 4) {
int my = now.first + dy[d];
int mx = now.second + dx[d];
if(0 <= my && my < h && 0 <= mx && mx < w &&
!fld[my][mx])
que.push(mp(my, mx));
}
}
}
}
}
cout << res << endl;
return 0;
} | a.cc: In function 'int compress(std::vector<std::pair<int, int> >&, int)':
a.cc:70:21: error: 'tx1' was not declared in this scope
70 | if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
| ^~~
a.cc:71:21: error: 'tx2' was not declared in this scope
71 | if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
| ^~~
a.cc:80:11: error: 'i' was not declared in this scope
80 | p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
| ^
a.cc:82:5: warning: no return statement in function returning non-void [-Wreturn-type]
82 | }
| ^
a.cc: At global scope:
a.cc:84:5: error: expected unqualified-id before 'return'
84 | return xs.size();
| ^~~~~~
a.cc:85:1: error: expected declaration before '}' token
85 | }
| ^
a.cc: In function 'int main()':
a.cc:109:17: error: 'fld' was not declared in this scope
109 | fld[y][x] = true;
| ^~~
a.cc:116:17: error: 'fld' was not declared in this scope
116 | if(!fld[r][c]) {
| ^~~
|
s707086787 | p00454 | C++ | #include <bits/stdc++.h>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int INF = 1 << 29;
const double EPS = 1e-10;
double zero(double d) {
return d < EPS ? 0.0 : d;
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
return os << '(' << p.first << ',' << p.second << ')';
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
os << '[';
rep(i, a.size()) os << (i ? " " : "") << a[i];
return os << ']';
}
// to avoid error on mingw
string toString(int i) {
stringstream ss;
ss << i;
return ss.str();
}
const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
ll res = 1ll;
ll x = a;
while (k != 0) {
if ((k & 1) == 1)
res = (res * x) % M;
x = (x * x) % M;
k >>= 1;
}
return res;
}
int compress(vector<pii>& p, int w) {
vi xs;
rep(i, p.size()) {
REP(d, -1, 1+1) { // -1, 0, 1 // 蟾ヲ蜿ウ繧貞性繧√※菫晏ュ? int tx1 = p[i].first + d, tx2 = p[i].second + d;
if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
}
}
// 驥崎、?r蜑企勁
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
// 蝨ァ邵ョ縺励◆蛟、縺ォ譖ク縺肴鋤縺? rep(i, p.size()) {
p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
p[i].second = find(xs.begin(), xs.end(), p[i].second) - xs.begin();
}
return xs.size();
}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
int main() {
cout.setf(ios::fixed, ios::floatfield);
cout.precision(8);
ios_base::sync_with_stdio(false);
int w, h, n;
cin >> w >> h >> n;
vector<pii> px(n), py(n);
rep(i, n)
cin >> px[i].first >> py[i].first >> px[i].second >> py[i].second;
w = compress(px, w);
h = compress(py, h);
w--, h--;
// 蝪励j縺、縺カ縺? vector< vector<bool> > fld(h, vector<bool>(w, false));
rep(i, n) {
REP(y, py[i].first, py[i].second) {
REP(x, px[i].first, px[i].second)
fld[y][x] = true;
}
}
int res = 0;
rep(r, h) {
rep(c, w) {
if(!fld[r][c]) {
res++;
// bfs
queue<pii> que;
que.push(mp(r, c));
while(!que.empty()) {
pii now = que.front(); que.pop();
fld[now.first][now.second] = true;
rep(d, 4) {
int my = now.first + dy[d];
int mx = now.second + dx[d];
if(0 <= my && my < h && 0 <= mx && mx < w &&
!fld[my][mx])
que.push(mp(my, mx));
}
}
}
}
}
cout << res << endl;
return 0;
} | a.cc: In function 'int compress(std::vector<std::pair<int, int> >&, int)':
a.cc:70:21: error: 'tx1' was not declared in this scope
70 | if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
| ^~~
a.cc:71:21: error: 'tx2' was not declared in this scope
71 | if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
| ^~~
a.cc:80:11: error: 'i' was not declared in this scope
80 | p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
| ^
a.cc:82:5: warning: no return statement in function returning non-void [-Wreturn-type]
82 | }
| ^
a.cc: At global scope:
a.cc:84:5: error: expected unqualified-id before 'return'
84 | return xs.size();
| ^~~~~~
a.cc:85:1: error: expected declaration before '}' token
85 | }
| ^
a.cc: In function 'int main()':
a.cc:109:17: error: 'fld' was not declared in this scope
109 | fld[y][x] = true;
| ^~~
a.cc:116:17: error: 'fld' was not declared in this scope
116 | if(!fld[r][c]) {
| ^~~
|
s817083900 | p00454 | C++ | #include <bits/stdc++.h>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int INF = 1 << 29;
const double EPS = 1e-10;
double zero(double d) {
return d < EPS ? 0.0 : d;
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
return os << '(' << p.first << ',' << p.second << ')';
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
os << '[';
rep(i, a.size()) os << (i ? " " : "") << a[i];
return os << ']';
}
// to avoid error on mingw
string toString(int i) {
stringstream ss;
ss << i;
return ss.str();
}
const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
ll res = 1ll;
ll x = a;
while (k != 0) {
if ((k & 1) == 1)
res = (res * x) % M;
x = (x * x) % M;
k >>= 1;
}
return res;
}
int compress(vector<pii>& p, int w) {
vi xs;
rep(i, p.size()) {
REP(d, -1, 1+1) { // -1, 0, 1 // 蟾ヲ蜿ウ繧貞性繧√※菫晏ュ? int tx1 = p[i].first + d, tx2 = p[i].second + d;
if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
}
}
// 驥崎、?r蜑企勁
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
// 蝨ァ邵ョ縺励◆蛟、縺ォ譖ク縺肴鋤縺? rep(i, p.size()) {
p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
p[i].second = find(xs.begin(), xs.end(), p[i].second) - xs.begin();
}
return xs.size();
}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
int main() {
cout.setf(ios::fixed, ios::floatfield);
cout.precision(8);
ios_base::sync_with_stdio(false);
int w, h, n;
cin >> w >> h >> n;
vector<pii> px(n), py(n);
rep(i, n)
cin >> px[i].first >> py[i].first >> px[i].second >> py[i].second;
w = compress(px, w);
h = compress(py, h);
w--, h--;
// 蝪励j縺、縺カ縺? vector< vector<bool> > fld(h, vector<bool>(w, false));
rep(i, n) {
REP(y, py[i].first, py[i].second) {
REP(x, px[i].first, px[i].second)
fld[y][x] = true;
}
}
int res = 0;
rep(r, h) {
rep(c, w) {
if(!fld[r][c]) {
res++;
// bfs
queue<pii> que;
que.push(mp(r, c));
while(!que.empty()) {
pii now = que.front(); que.pop();
fld[now.first][now.second] = true;
rep(d, 4) {
int my = now.first + dy[d];
int mx = now.second + dx[d];
if(0 <= my && my < h && 0 <= mx && mx < w &&
!fld[my][mx])
que.push(mp(my, mx));
}
}
}
}
}
cout << res << endl;
return 0;
} | a.cc: In function 'int compress(std::vector<std::pair<int, int> >&, int)':
a.cc:70:21: error: 'tx1' was not declared in this scope
70 | if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
| ^~~
a.cc:71:21: error: 'tx2' was not declared in this scope
71 | if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
| ^~~
a.cc:80:11: error: 'i' was not declared in this scope
80 | p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
| ^
a.cc:82:5: warning: no return statement in function returning non-void [-Wreturn-type]
82 | }
| ^
a.cc: At global scope:
a.cc:84:5: error: expected unqualified-id before 'return'
84 | return xs.size();
| ^~~~~~
a.cc:85:1: error: expected declaration before '}' token
85 | }
| ^
a.cc: In function 'int main()':
a.cc:109:17: error: 'fld' was not declared in this scope
109 | fld[y][x] = true;
| ^~~
a.cc:116:17: error: 'fld' was not declared in this scope
116 | if(!fld[r][c]) {
| ^~~
|
s825440261 | p00454 | C++ | #include <bits/stdc++.h>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int INF = 1 << 29;
const double EPS = 1e-10;
double zero(double d) {
return d < EPS ? 0.0 : d;
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
return os << '(' << p.first << ',' << p.second << ')';
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
os << '[';
rep(i, a.size()) os << (i ? " " : "") << a[i];
return os << ']';
}
// to avoid error on mingw
string toString(int i) {
stringstream ss;
ss << i;
return ss.str();
}
const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
ll res = 1ll;
ll x = a;
while (k != 0) {
if ((k & 1) == 1)
res = (res * x) % M;
x = (x * x) % M;
k >>= 1;
}
return res;
}
int compress(vector<pii>& p, int w) {
vi xs;
rep(i, p.size()) {
REP(d, -1, 1+1) { // -1, 0, 1 // 蟾ヲ蜿ウ繧貞性繧√※菫晏ュ? int tx1 = p[i].first + d, tx2 = p[i].second + d;
if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
}
}
// 驥崎、?r蜑企勁
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
// 蝨ァ邵ョ縺励◆蛟、縺ォ譖ク縺肴鋤縺? rep(i, p.size()) {
p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
p[i].second = find(xs.begin(), xs.end(), p[i].second) - xs.begin();
}
return xs.size();
}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
int main() {
cout.setf(ios::fixed, ios::floatfield);
cout.precision(8);
ios_base::sync_with_stdio(false);
int w, h, n;
cin >> w >> h >> n;
vector<pii> px(n), py(n);
rep(i, n)
cin >> px[i].first >> py[i].first >> px[i].second >> py[i].second;
w = compress(px, w);
h = compress(py, h);
w--, h--;
// 蝪励j縺、縺カ縺? vector< vector<bool> > fld(h, vector<bool>(w, false));
rep(i, n) {
REP(y, py[i].first, py[i].second) {
REP(x, px[i].first, px[i].second)
fld[y][x] = true;
}
}
int res = 0;
rep(r, h) {
rep(c, w) {
if(!fld[r][c]) {
res++;
// bfs
queue<pii> que;
que.push(mp(r, c));
while(!que.empty()) {
pii now = que.front(); que.pop();
fld[now.first][now.second] = true;
rep(d, 4) {
int my = now.first + dy[d];
int mx = now.second + dx[d];
if(0 <= my && my < h && 0 <= mx && mx < w &&
!fld[my][mx])
que.push(mp(my, mx));
}
}
}
}
}
cout << res << endl;
return 0;
} | a.cc: In function 'int compress(std::vector<std::pair<int, int> >&, int)':
a.cc:70:21: error: 'tx1' was not declared in this scope
70 | if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
| ^~~
a.cc:71:21: error: 'tx2' was not declared in this scope
71 | if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
| ^~~
a.cc:80:11: error: 'i' was not declared in this scope
80 | p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
| ^
a.cc:82:5: warning: no return statement in function returning non-void [-Wreturn-type]
82 | }
| ^
a.cc: At global scope:
a.cc:84:5: error: expected unqualified-id before 'return'
84 | return xs.size();
| ^~~~~~
a.cc:85:1: error: expected declaration before '}' token
85 | }
| ^
a.cc: In function 'int main()':
a.cc:109:17: error: 'fld' was not declared in this scope
109 | fld[y][x] = true;
| ^~~
a.cc:116:17: error: 'fld' was not declared in this scope
116 | if(!fld[r][c]) {
| ^~~
|
s281983624 | p00454 | C++ | #include <bits/stdc++.h>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int INF = 1 << 29;
const double EPS = 1e-10;
double zero(double d) {
return d < EPS ? 0.0 : d;
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
return os << '(' << p.first << ',' << p.second << ')';
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
os << '[';
rep(i, a.size()) os << (i ? " " : "") << a[i];
return os << ']';
}
// to avoid error on mingw
string toString(int i) {
stringstream ss;
ss << i;
return ss.str();
}
const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
ll res = 1ll;
ll x = a;
while (k != 0) {
if ((k & 1) == 1)
res = (res * x) % M;
x = (x * x) % M;
k >>= 1;
}
return res;
}
int compress(vector<pii>& p, int w) {
vi xs;
rep(i, p.size()) {
REP(d, -1, 1+1) { // -1, 0, 1 // 蟾ヲ蜿ウ繧貞性繧√※菫晏ュ?
int tx1 = p[i].first + d, tx2 = p[i].second + d;
if(0 <= tx1 && tx1 <= w) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= w) xs.push_back(tx2);
}
}
// 驥崎、?r蜑企勁
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
// 蝨ァ邵ョ縺励◆蛟、縺ォ譖ク縺肴鋤縺? rep(i, p.size()) {
p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
p[i].second = find(xs.begin(), xs.end(), p[i].second) - xs.begin();
}
return xs.size();
}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
int main() {
cout.setf(ios::fixed, ios::floatfield);
cout.precision(8);
ios_base::sync_with_stdio(false);
int w, h, n;
cin >> w >> h >> n;
vector<pii> px(n), py(n);
rep(i, n)
cin >> px[i].first >> py[i].first >> px[i].second >> py[i].second;
w = compress(px, w);
h = compress(py, h);
w--, h--;
// 蝪励j縺、縺カ縺? vector< vector<bool> > fld(h, vector<bool>(w, false));
rep(i, n) {
REP(y, py[i].first, py[i].second) {
REP(x, px[i].first, px[i].second)
fld[y][x] = true;
}
}
int res = 0;
rep(r, h) {
rep(c, w) {
if(!fld[r][c]) {
res++;
// bfs
queue<pii> que;
que.push(mp(r, c));
while(!que.empty()) {
pii now = que.front(); que.pop();
fld[now.first][now.second] = true;
rep(d, 4) {
int my = now.first + dy[d];
int mx = now.second + dx[d];
if(0 <= my && my < h && 0 <= mx && mx < w &&
!fld[my][mx])
que.push(mp(my, mx));
}
}
}
}
}
cout << res << endl;
return 0;
} | a.cc: In function 'int compress(std::vector<std::pair<int, int> >&, int)':
a.cc:81:11: error: 'i' was not declared in this scope
81 | p[i].first = find(xs.begin(), xs.end(), p[i].first) - xs.begin();
| ^
a.cc:83:5: warning: no return statement in function returning non-void [-Wreturn-type]
83 | }
| ^
a.cc: At global scope:
a.cc:85:5: error: expected unqualified-id before 'return'
85 | return xs.size();
| ^~~~~~
a.cc:86:1: error: expected declaration before '}' token
86 | }
| ^
a.cc: In function 'int main()':
a.cc:110:17: error: 'fld' was not declared in this scope
110 | fld[y][x] = true;
| ^~~
a.cc:117:17: error: 'fld' was not declared in this scope
117 | if(!fld[r][c]) {
| ^~~
|
s165963162 | p00454 | C++ | #include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
using namespace std;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
int W, H, N;
int X1[1000], X2[1000], Y1[1000], Y2[1000];
bool fld[1000 * 6][1000 * 6];
int compress(int *x1, int *x2, int w) {
vector<int> xs;
for(int i = 0; i < N; i++) {
for(int d = -1; d <= 1; d++) {
int tx1 = x1[i] + d, tx2 = x2[i] + d;
if(1 <= tx1 && tx1 <= W) xs.push_back(tx1);
if(1 <= tx2 && tx2 <= W) xs.push_back(tx2);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i = 0; i < N; i++) {
x1[i] = find(xs.begin(),xs.end(),x1[i]) - xs.begin();
x2[i] = find(xs.begin(),xs.end(),x2[i]) - xs.begin();
}
return xs.size();
}
void solve() {
W = compress(X1,X2,W);
H = compress(Y1,Y2,H);
memset(fld,0,sizeof(fld));
for(int i = 0; i < N; i++) {
for(int y = Y1[i]; y <= Y2[i]; y++) {
for(int x = X1[i]; x <= X2[i]; x++) {
fld[y][x] = true;
}
}
}
int ans = 0;
for(int y = 0; y < H; y++) {
for(int x = 0; x < W; x++) {
if(fld[y][x]) continue;
ans++;
queue<pair<int,int> > que;
que.push(make_pair(x,y));
while(!que.empty()) {
int sx = que.front().first, sy = que.front().second;
que.pop();
for(int i = 0; i < 4; i++) {
int tx = sx + dx[i], ty = sy + dy[i];
if(tx < 0 || ty < 0 || tx >= W || ty >= H) continue;
if(fld[ty][tx]) continue;
que.push(make_pair(tx,ty));
fld[ty][tx] = true;
}
}
}
}
printf("%d\n",ans-1);
}
int main() {
while(1) {
scanf("%d %d",&W,&H);
if(W == 0 && H == 0) break;
W++;
H++;
scanf("%d",&N);
for(int i = 0; i < N; i++) {
scanf("%d %d %d %d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
X1[i]++;
Y1[i]++;
X2[i]++;
Y2[i]++;
}
solve();
}
} | a.cc: In function 'void solve()':
a.cc:42:3: error: 'memset' was not declared in this scope
42 | memset(fld,0,sizeof(fld));
| ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <queue>
+++ |+#include <cstring>
9 | using namespace std;
|
s351284128 | p00454 | C++ | #include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
#define MAX_N 2400
pair<int, int>X[MAX_N];
pair<int, int>Y[MAX_N];
int x[MAX_N][2], y[MAX_N][2], h, w, n, a, b, c, d, A, B, cnt;
int col[MAX_N][MAX_N];
int z[MAX_N][MAX_N];
queue<int>Q;
int main() {
while (true) {
memset(X, 0, sizeof(X));
memset(Y, 0, sizeof(Y));
memset(x, 0, sizeof(x));
memset(y, 0, sizeof(y));
memset(col, 0, sizeof(col));
memset(z, 0, sizeof(z));
cin >> h >> w;
if (h == 0 && w == 0) { break; }
cin >> n;
for (int j = 0; j < n; j++) {
cin >> a >> b >> c >> d;
X[j * 2].first = a; X[j * 2].second = j;
X[j * 2 + 1].first = c; X[j * 2 + 1].second = j;
Y[j * 2].first = b; Y[j * 2].second = j;
Y[j * 2 + 1].first = d; Y[j * 2 + 1].second = j;
}
sort(X, X + n * 2);
sort(Y, Y + n * 2);
for (int i = 0; i < n * 2; i++){
if (x[X[i].second][0] == 0) {
x[X[i].second][0] = i + 1;
}
else {
x[X[i].second][1] = i + 1;
}
}
for (int i = 0; i < n * 2; i++) {
if (y[Y[i].second][0] == 0) {
y[Y[i].second][0] = i + 1;
}
else {
y[Y[i].second][1] = i + 1;
}
}
for (int i = 0; i < n; i++){
for (int j = x[i][0]; j < x[i][1]; j++) {
for (int k = 0; k < y[i][0]; k < y[i][1]; k++) {
z[j][k] = 1;
}
}
}
//bfs.
cnt = 0;
for (int i = 0; i < MAX_N; i++) {
for (int j = 0; j < MAX_N; j++) {
if (z[i][j] == 0 && col[i][j] == 0) {
Q.push(i * 10000 + j);
cnt++;
col[i][j] = cnt;
while (!Q.empty()) {
A = Q.front() / 10000;
B = Q.front() % 10000;
if (A + 1 < MAX_N) {
if (z[A + 1][B] == 0 && col[A + 1][B] == 0) {
col[A + 1][B] = cnt;
Q.push(Q.front() + 10000);
}
}
if (B + 1 < MAX_N) {
if (z[A][B + 1] == 0 && col[A][B + 1] == 0) {
col[A][B + 1] = cnt;
Q.push(Q.front() + 1);
}
}
if (A - 1 >= 0) {
if (z[A - 1][B] == 0 && col[A - 1][B] == 0) {
col[A - 1][B] = cnt;
Q.push(Q.front() - 10000);
}
}
if (B - 1 >= 0) {
if (z[A][B - 1] == 0 && col[A][B - 1] == 0) {
col[A][B - 1] = cnt;
Q.push(Q.front() - 1);
}
}
}
}
}
}
cout << cnt << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:54:73: error: expected ')' before ';' token
54 | for (int k = 0; k < y[i][0]; k < y[i][1]; k++) {
| ~ ^
| )
a.cc:54:75: error: 'k' was not declared in this scope
54 | for (int k = 0; k < y[i][0]; k < y[i][1]; k++) {
| ^
|
s071806610 | p00454 | C++ | #include <iostream>
#include <queue>
using namespace std;
typedef pair<int, int> P;
void seach(int x,int y,int X,int Y);
int speace[1000000][1000000],n;
int main(){
int X,Y,N,x1,y1,x2,y2;
while(1){
cin >> X >> Y;
if(X==0&&Y==0){
break;
}
cin >> N;
n=0;
for(int i=0;i<X;i++){
for(int j=0;j<Y;j++){
speace[i][j]=-1;
}
}
for(int i=0;i<N;i++){
cin >> x1>>y1>>x2>>y2;
for(int j=x1;j<x2;j++){
for(int k=y1;k<y2;k++){
speace[j][k]=n;
}
}
}
n++;
for(int i=0;i<X;i++){
for(int j=0;j<Y;j++){
if(speace[i][j]==-1){
seach(i,j,X,Y);n++;
}
}
}
/*cout << "\n";
for(int i=0;i<X;i++){
for(int j=0;j<Y;j++){
cout << speace[i][j] << " ";
}
cout << "\n";
}*/
cout << n-1 <<"\n";
}
return 0;
}
void seach(int x,int y,int X,int Y){
int dx[4]={-1,0,0,1},dy[4]={0,1,-1,0};
queue<P> que;
que.push(P(x,y));
while(que.size()){
P p=que.front();
que.pop();
for(int i=0;i<4;i++){
if(0<=p.first+dx[i]&&p.first+dx[i]<X&&0<=p.second+dy[i]&&p.second+dy[i]<Y){
if(speace[p.first+dx[i]][p.second+dy[i]]==-1){
speace[p.first+dx[i]][p.second+dy[i]]=n;
que.push(P(p.first+dx[i],p.second+dy[i]));
}
}
}
}
}
| /tmp/ccBBCILT.o: in function `main':
a.cc:(.text+0x5a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBBCILT.o
a.cc:(.text+0x121): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBBCILT.o
a.cc:(.text+0x177): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBBCILT.o
a.cc:(.text+0x180): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBBCILT.o
a.cc:(.text+0x1d7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBBCILT.o
a.cc:(.text+0x1e0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBBCILT.o
a.cc:(.text+0x1fe): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBBCILT.o
/tmp/ccBBCILT.o: in function `seach(int, int, int, int)':
a.cc:(.text+0x3ed): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBBCILT.o
collect2: error: ld returned 1 exit status
|
s078815338 | p00454 | C++ | #include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#define MAX_N 1010
using namespace std;
static int X1[1010], Y1[1010], X2[1010], Y2[1010], fld[MAX_N * 2][MAX_N * 2],
dx[4] = { -1, 0, 0, 1 }, dy[4] = { 0, -1, 1, 0 };
static int compress(int *const, int *const, const int, const int);
static int bfs(const int, const int);
void imos(const int, const int, const int);
int main(void)
{
int W, H, N;
std::ios::sync_with_stdio(false);
//freopen("D:\\input.txt", "r", stdin);
while (1)
{
cin >> W >> H;
if (W == 0 && H == 0)
break;
cin >> N;
for (int i = 0; i < N; i++)
cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
W = compress(X1, X2, W, N);
H = compress(Y1, Y2, H, N);
imos(W, H, N);
cout << bfs(W, H) << endl;
}
return EXIT_SUCCESS;
}
static int compress(int *const s1, int *const s2, const int W, const int N)
{
//???????????£???
vector<int>xs;
for (int i = 0; i < N; i++)
{
if (0 < s1[i] && s1[i] < W) xs.push_back(s1[i]);
if (0 < s2[i] && s2[i] < W) xs.push_back(s2[i]);
}
xs.push_back(0);
xs.push_back(W);//?????????????????¶
sort(xs.begin(), xs.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
for (int i = 0; i < N; i++)
{
s1[i] = find(xs.begin(), xs.end(), s1[i]) - xs.begin();
s2[i] = find(xs.begin(), xs.end(), s2[i]) - xs.begin();
}
return xs.size() - 1;
}
static int bfs(const int W, const int H)
{
int ans = 0;
for (int i = 0; i < W; i++)
for (int j = 0; j < H; j++)
{
if (fld[i][j])continue;//????´¢?????????????????????
ans++;
queue<pair<int, int>>que;
que.push(make_pair(i, j));
while (!que.empty())
{
int tx = que.front().first, ty = que.front().second;
que.pop();
for (int i = 0; i < 4; i++)
{
int ttx = tx + dx[i], tty = ty + dy[i];
if (0 <= ttx && ttx <= W
&& 0 <= tty && tty <= H
&& !fld[ttx][tty])
{
que.push(make_pair(ttx, tty));
fld[ttx][tty] = 1;
}
}
}
}
return ans;
}
void imos(const int W, const int H, const int N)
{
//imos??????????????´
memset(fld, 0, sizeof(fld));
for (int i = 0; i < N; i++)//????????±??????
{
fld[X1[i]][Y1[i]]++;
fld[X1[i]][Y2[i]]--;
fld[X2[i]][Y1[i]]--;
fld[X2[i]][Y2[i]]++;
}
for (int i = 0; i < W; i++)//?´?????¨????
for (int j = 1; j < H; j++)
fld[i][j] += fld[i][j - 1];
for (int j = 0; j < H; j++)//?´??????????
for (int i = 1; i < W; i++)
fld[i][j] += fld[i - 1][j];
//?????¶??¨????°±????????????????????????
} | a.cc: In function 'void imos(int, int, int)':
a.cc:97:9: error: 'memset' was not declared in this scope
97 | memset(fld, 0, sizeof(fld));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <queue>
+++ |+#include <cstring>
6 | #define MAX_N 1010
|
s583527045 | p00454 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
#include<cstring>
using namespace std;
typedef pair<int, int> P;
int compress(int *, int *, int);
void bfs(int, int);
int n, W, H;
int xa[1000], xb[1000], ya[1000], yb[1000]
bool pt[5000][5000] = {};
int main() {
int w, h, ans = 0;
while (cin >> w >> h&&w&&h) {
cin >> n;
memset(pt, 0, sizeof(pt));
ans=0;
for (int i = 0; i < n; i++) {
scanf("%d%d%d%d", &xa[i], &ya[i], &xb[i], &yb[i]);
}
W = compress(xa, xb, w);
H = compress(ya, yb, h);
for (int i = 0; i < n; i++) {
for (int j = xa[i]; j < xb[i]; j++) {
for (int k = ya[i]; k < yb[i]; k++) {
pt[k][j] = 1;
}
}
}
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (!pt[i][j]) {
bfs(i, j);
ans++;
}
}
}
cout << ans << endl;
}
}
int compress(int *x1, int *x2, int lim) {
vector<int> vec;
for (int i = 0; i < n; i++) {
for (int j = -1; j <= 1; j++) {
int a = x1[i] + j, b = x2[i] + j;
if (a >= 0 && a < lim) vec.push_back(a);
if (b >= 0 && b < lim) vec.push_back(b);
}
}
sort(vec.begin(), vec.end());
vec.erase(unique(vec.begin(), vec.end()), vec.end());
for (int i = 0; i < n; i++) {
x1[i] = find(vec.begin(), vec.end(), x1[i]) - vec.begin();
x2[i] = find(vec.begin(), vec.end(), x2[i]) - vec.begin();
}
return vec.size();
}
void bfs(int x, int y) {
queue<P> que;
que.push(P(x, y));
while (!que.empty()) {
P p = que.front();
que.pop();
for (int i = -1; i <= 1; i++) {
if (i) {
int a = p.first + i, b = p.second + i;
if (a >= 0 && a < H && !pt[a][p.second]) {
pt[a][p.second] = 1;
que.push(P(a, p.second));
}
if (b >= 0 && b < W && !pt[p.first][b]) {
pt[p.first][b] = 1;
que.push(P(p.first, b));
}
}
}
}
} | a.cc:13:1: error: expected initializer before 'bool'
13 | bool pt[5000][5000] = {};
| ^~~~
a.cc: In function 'int main()':
a.cc:18:24: error: 'pt' was not declared in this scope
18 | memset(pt, 0, sizeof(pt));
| ^~
a.cc:21:68: error: 'yb' was not declared in this scope; did you mean 'ya'?
21 | scanf("%d%d%d%d", &xa[i], &ya[i], &xb[i], &yb[i]);
| ^~
| ya
a.cc:24:34: error: 'yb' was not declared in this scope; did you mean 'ya'?
24 | H = compress(ya, yb, h);
| ^~
| ya
a.cc: In function 'void bfs(int, int)':
a.cc:71:57: error: 'pt' was not declared in this scope; did you mean 'p'?
71 | if (a >= 0 && a < H && !pt[a][p.second]) {
| ^~
| p
a.cc:75:57: error: 'pt' was not declared in this scope; did you mean 'p'?
75 | if (b >= 0 && b < W && !pt[p.first][b]) {
| ^~
| p
|
s392657051 | p00454 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef pair<int, int> P;
int compress(int *, int *, int);
void bfs(int, int);
int n, W, H;
int xa[1000], xb[1000], ya[1000], yb[1000];
bool pt[5000][5000] = {};
int main() {
int w, h, ans = 0;
while (cin >> w >> h&&w&&h) {
cin >> n;
memset(pt, 0, sizeof(pt));
for (int i = 0; i < n; i++) {
scanf("%d%d%d%d", &xa[i], &ya[i], &xb[i], &yb[i]);
}
W = compress(xa, xb, w);
H = compress(ya, yb, h);
for (int i = 0; i < n; i++) {
for (int j = xa[i]; j < xb[i]; j++) {
for (int k = ya[i]; k < yb[i]; k++) {
pt[k][j] = 1;
}
}
}
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (!pt[i][j]) {
bfs(i, j);
ans++;
}
}
}
cout << ans << endl;
}
}
int compress(int *x1, int *x2, int lim) {
vector<int> vec;
for (int i = 0; i < n; i++) {
for (int j = -1; j <= 1; j++) {
int a = x1[i] + j, b = x2[i] + j;
if (a >= 0 && a < lim) vec.push_back(a);
if (b >= 0 && b < lim) vec.push_back(b);
}
}
sort(vec.begin(), vec.end());
vec.erase(unique(vec.begin(), vec.end()), vec.end());
for (int i = 0; i < n; i++) {
x1[i] = find(vec.begin(), vec.end(), x1[i]) - vec.begin();
x2[i] = find(vec.begin(), vec.end(), x2[i]) - vec.begin();
}
return vec.size();
}
void bfs(int x, int y) {
queue<P> que;
que.push(P(x, y));
while (!que.empty()) {
P p = que.front();
que.pop();
for (int i = -1; i <= 1; i++) {
if (i) {
int a = p.first + i, b = p.second + i;
if (a >= 0 && a < H && !pt[a][p.second]) {
pt[a][p.second] = 1;
que.push(P(a, p.second));
}
if (b >= 0 && b < W && !pt[p.first][b]) {
pt[p.first][b] = 1;
que.push(P(p.first, b));
}
}
}
}
} | a.cc: In function 'int main()':
a.cc:17:17: error: 'memset' was not declared in this scope
17 | memset(pt, 0, sizeof(pt));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include<algorithm>
+++ |+#include <cstring>
6 | using namespace std;
|
s131169567 | p00454 | C++ |
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int compress(vector<int>&a_, vector<int>&b_,int c_)
{
vector<int> ret;
for (int ap : a_)
{
if(ap != 0)ret.push_back(ap - 1);
ret.push_back(ap);
if (ap != c_)ret.push_back(ap + 1);
}
for (int bp : b_)
{
if (bp != 0)ret.push_back(bp - 1);
ret.push_back(bp);
if (bp != c_)ret.push_back(bp + 1);
}
sort(ret.begin(), ret.end());
ret.erase(unique(ret.begin(), ret.end()), ret.end());
for (int &ap : a_)
{
ap = find(ret.begin(), ret.end(), ap) - ret.begin();
}
for (int &bp : b_)
{
bp = find(ret.begin(), ret.end(), bp) - ret.begin();
}
return ret.size() - 1;
}
bool fld[1234][1234];
int main()
{
for (;;)
{
int w, h;
int n;
vector<int>vx1, vx2, vy1, vy2;
scanf("%d %d", &w, &h);
scanf("%d", &n);
if (w == 0)break;
for (int i = 0; i < n; ++i)
{
int x1_, y1_, x2_, y2_;
scanf("%d %d %d %d", &x1_, &y1_, &x2_, &y2_);
vx1.push_back(x1_);
vx2.push_back(x2_);
vy1.push_back(y1_);
vy2.push_back(y2_);
}
vx1.push_back(0);
vx2.push_back(w);
vy1.push_back(0);
vy2.push_back(h);
w = compress(vx1, vx2, w);
h = compress(vy1, vy2, h);
memset(fld, false, sizeof(fld));
//?´?????????§??????????????£??????TLE?
for (int i = 0; i < n; ++i)
{
for (int y = vy1[i]; y < vy2[i]; ++y)
{
for (int x = vx1[i]; x < vx2[i]; ++x)
{
fld[y][x] = true;
}
}
}
int ans = 0;
for (int i = 0; i < h; ++i)
{
for (int j = 0; j < w; ++j)printf("%d",fld[i][j]);
printf("\n");
}
for (int i = 0; i < h; ++i)
{
for (int j = 0; j < w; ++j)
{
if (fld[i][j])continue;
++ans;
queue<pair<int,int>>que;
que.emplace(i,j);
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
while (!que.empty())
{
pair<int,int> p = que.front(); que.pop();
for (int d = 0; d < 4; ++d)
{
int y = p.first + dy[d];
int x = p.second + dx[d];
if (0 <= x && x < w && 0 <= y && y < h && !fld[y][x])
{
que.emplace(y,x);
fld[y][x] = true;
}
}
}
}
}
printf("%d\n", ans);
}
} | a.cc: In function 'int main()':
a.cc:64:17: error: 'memset' was not declared in this scope
64 | memset(fld, false, sizeof(fld));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <queue>
+++ |+#include <cstring>
6 |
|
s844979486 | p00454 | C++ |
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int compress(vector<int>&a_, vector<int>&b_,int c_)
{
vector<int> ret;
for (int ap : a_)
{
if(ap != 0)ret.push_back(ap - 1);
ret.push_back(ap);
if (ap != c_)ret.push_back(ap + 1);
}
for (int bp : b_)
{
if (bp != 0)ret.push_back(bp - 1);
ret.push_back(bp);
if (bp != c_)ret.push_back(bp + 1);
}
sort(ret.begin(), ret.end());
ret.erase(unique(ret.begin(), ret.end()), ret.end());
for (int &ap : a_)
{
ap = find(ret.begin(), ret.end(), ap) - ret.begin();
}
for (int &bp : b_)
{
bp = find(ret.begin(), ret.end(), bp) - ret.begin();
}
return ret.size() - 1;
}
bool fld[1234][1234];
int main()
{
for (;;)
{
int w, h;
int n;
vector<int>vx1, vx2, vy1, vy2;
scanf("%d %d", &w, &h);
scanf("%d", &n);
if (w == 0)break;
for (int i = 0; i < n; ++i)
{
int x1_, y1_, x2_, y2_;
scanf("%d %d %d %d", &x1_, &y1_, &x2_, &y2_);
vx1.push_back(x1_);
vx2.push_back(x2_);
vy1.push_back(y1_);
vy2.push_back(y2_);
}
vx1.push_back(0);
vx2.push_back(w);
vy1.push_back(0);
vy2.push_back(h);
w = compress(vx1, vx2, w);
h = compress(vy1, vy2, h);
memset(fld, false, sizeof(fld));
//?´?????????§??????????????£??????TLE?
for (int i = 0; i < n; ++i)
{
for (int y = vy1[i]; y < vy2[i]; ++y)
{
for (int x = vx1[i]; x < vx2[i]; ++x)
{
fld[y][x] = true;
}
}
}
int ans = 0;
for (int i = 0; i < h; ++i)
{
for (int j = 0; j < w; ++j)printf("%d",fld[i][j]);
printf("\n");
}
for (int i = 0; i < h; ++i)
{
for (int j = 0; j < w; ++j)
{
if (fld[i][j])continue;
++ans;
queue<pair<int,int>>que;
que.emplace(i,j);
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
while (!que.empty())
{
pair<int,int> p = que.front(); que.pop();
for (int d = 0; d < 4; ++d)
{
int y = p.first + dy[d];
int x = p.second + dx[d];
if (0 <= x && x < w && 0 <= y && y < h && !fld[y][x])
{
que.emplace(y,x);
fld[y][x] = true;
}
}
}
}
}
printf("%d\n", ans);
}
} | a.cc: In function 'int main()':
a.cc:64:17: error: 'memset' was not declared in this scope
64 | memset(fld, false, sizeof(fld));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <queue>
+++ |+#include <cstring>
6 |
|
s946783184 | p00454 | C++ | #include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
using namespace std;
int compress(int *x1,int *x2,int w){
vector<int> xs;
for(int i=0;i<N;i++){
for(int d=-1;d<=1;d++){
int tx1=x1[i]+d,tx2=x2[i]+d;
if(1<=tx1&&tx1<=W) xs.push_back(tx1);
if(1<=tx2&&tx2<=W) xs.push_back(tx2);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i=0; i<N; i++){
x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
}
return xs.size();
}
int main(){
while(1){
int W,H,N;
int X1[1000],X2[1000],Y1[1000],Y2[1000];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
bool fld[6000][6000];
scanf("%d%d",&W,&H);
if(W==0) break;
scanf("%d",&N);
for(int i=0; i<N; i++){
scanf("%d%d%d%d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
}
W=compress(X1,X2,W);
H=compress(Y1,Y2,H);
memset(fld,0,sizeof(fld));
for(int i=0;i<N;i++){
for(int y=Y1[i];y<=Y2[i];y++){
for(int x=X1[i];x<=X2[i];x++){
fld[y][x]=true;
}
}
}
int ans=0;
for(int y=0;y<H;y++){
for(int x=0;x<W;x++){
if(fld[y][x]) continue;
ans++;
queue<pair<int,int> > que;
que.push(make_pair(x,y));
while(!que.empty()){
int sx=que.front().first,sy=que.front().second;
que.pop();
for(int i=0; i<4; i++){
int tx=sx+dx[i],ty=sy+dy[i];
if(tx<0||W<=tx||ty<0||H<=ty) continue;
if(fld[ty][tx]) continue;
que.push(make_pair(tx,ty));
fld[ty][tx]=true;
}
}
}
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int compress(int*, int*, int)':
a.cc:23:17: error: 'N' was not declared in this scope
23 | for(int i=0;i<N;i++){
| ^
a.cc:26:23: error: 'W' was not declared in this scope
26 | if(1<=tx1&&tx1<=W) xs.push_back(tx1);
| ^
a.cc:27:23: error: 'W' was not declared in this scope
27 | if(1<=tx2&&tx2<=W) xs.push_back(tx2);
| ^
a.cc:34:18: error: 'N' was not declared in this scope
34 | for(int i=0; i<N; i++){
| ^
|
s145160283 | p00454 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
??
using namespace std;
??
#define y1 hogwhoasjfd
??
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
??
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;
??
template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
??
constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;
??
int w, h;
int n;
int x1[1005], x2[1005];
int y1[1005], y2[1005];
??
bool fld[1005*6+2][1005*6+2];
??
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
??
int compress(int *x1, int *x2, int w)
{
????????vi xs;
??
????????rep(i, n) {
????????????????for (int d = -1; d <= 1; ++d) {
????????????????????????int tx1 = x1[i] + d, tx2 = x2[i] + d;
??
????????????????????????if (0 <= tx1 && tx1 <= w) xs.PB(tx1);
????????????????????????if (0 <= tx2 && tx2 <= w) xs.PB(tx2);
????????????????}
????????}
??
????????sort(all(xs));
??//??????xs.erase(unique(all(xs)), end(xs));
??
????????rep(i, n) {
????????????????x1[i] = lower_bound(all(xs), x1[i]) - begin(xs);
????????????????x2[i] = lower_bound(all(xs), x2[i]) - begin(xs);
????????}
??
????????return xs.size();
}
??
int main()
{
????????while (cin >> w >> h, w) {
????????????????cin >> n;
??
????????????????memset(fld, 0, sizeof fld);
??
????????????????rep(i, n) {
????????????????????????cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
????????????????}
??
????????????????w = compress(x1, x2, w);
????????????????h = compress(y1, y2, h);
??
????????????????rep(i, n) {
????????????????????????for (int y = y1[i]; y <= y2[i]-1; ++y) {
????????????????????????????????for (int x = x1[i]; x <= x2[i]-1; ++x) {
????????????????????????????????????????fld[y][x] = true;
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????int ans = 0;
??
????????????????rep(y, h-1) rep(x, w-1) {
????????????????????????if (fld[y][x]) continue;
??
????????????????????????ans++;
??
????????????????????????queue<pii> q;
????????????????????????q.push(pii(y, x));
??
????????????????????????while (q.size()) {
????????????????????????????????pii p = q.front(); q.pop();
????????????????????????????????rep(i, 4) {
????????????????????????????????????????int ny = p.fst + dy[i], nx = p.scd + dx[i];
??
????????????????????????????????????????if (ny < 0 || ny >= h-1 || nx < 0 || nx >= w-1 || fld[ny][nx]) continue;
??
????????????????????????????????????????fld[ny][nx] = true;
????????????????????????????????????????q.push(pii(ny, nx));
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????cout << ans << endl;
????????}
} | a.cc:75:1: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
75 | ??//??????xs.erase(unique(all(xs)), end(xs));
a.cc:18:1: error: expected unqualified-id before '?' token
18 | ??
| ^
a.cc:20:1: error: expected unqualified-id before '?' token
20 | ??
| ^
a.cc:35:10: error: 'vector' does not name a type
35 | using vi=vector<int>;
| ^~~~~~
a.cc:36:11: error: 'vector' does not name a type
36 | using vvi=vector<vi>;
| ^~~~~~
a.cc:37:11: error: 'pair' does not name a type
37 | using pii=pair<int, int>;
| ^~~~
a.cc:38:12: error: 'vector' does not name a type
38 | using vpii=vector<pii>;
| ^~~~~~
a.cc:39:1: error: expected unqualified-id before '?' token
39 | ??
| ^
a.cc:41:18: error: 'ostream' does not name a type
41 | template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
| ^~~~~~~
a.cc:46:1: error: expected unqualified-id before '?' token
46 | ??
| ^
a.cc:48:11: error: 'll' does not name a type; did you mean 'ld'?
48 | constexpr ll linf = 3e18;
| ^~
| ld
a.cc:50:1: error: expected unqualified-id before '?' token
50 | ??
| ^
a.cc:55:1: error: expected unqualified-id before '?' token
55 | ??
| ^
a.cc:57:1: error: expected unqualified-id before '?' token
57 | ??
| ^
a.cc:60:1: error: expected unqualified-id before '?' token
60 | ??
| ^
a.cc:84:1: error: expected unqualified-id before '?' token
84 | ??
| ^
|
s500376561 | p00454 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
??
using namespace std;
??
#define y1 hogwhoasjfd
??
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
??
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;
??
template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
??
constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;
??
int w, h;
int n;
int x1[1005], x2[1005];
int y1[1005], y2[1005];
??
bool fld[1005*6+2][1005*6+2];
??
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
??
int compress(int *x1, int *x2, int w)
{
????????vi xs;
??
????????rep(i, n) {
????????????????for (int d = -1; d <= 1; ++d) {
????????????????????????int tx1 = x1[i] + d, tx2 = x2[i] + d;
??
????????????????????????if (0 <= tx1 && tx1 <= w) xs.PB(tx1);
????????????????????????if (0 <= tx2 && tx2 <= w) xs.PB(tx2);
????????????????}
????????}
??
????????sort(all(xs));
????????xs.erase(unique(all(xs)), end(xs));
??
????????rep(i, n) {
????????????????x1[i] = lower_bound(all(xs), x1[i]) - begin(xs);
????????????????x2[i] = lower_bound(all(xs), x2[i]) - begin(xs);
????????}
??
????????return xs.size();
}
??
int main()
{
????????while (cin >> w >> h, w) {
????????????????cin >> n;
??
????????????????memset(fld, 0, sizeof fld);
??
????????????????rep(i, n) {
????????????????????????cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
????????????????}
??
????????????????w = compress(x1, x2, w);
????????????????h = compress(y1, y2, h);
??
????????????????rep(i, n) {
????????????????????????for (int y = y1[i]; y <= y2[i]-1; ++y) {
????????????????????????????????for (int x = x1[i]; x <= x2[i]-1; ++x) {
????????????????????????????????????????fld[y][x] = true;
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????int ans = 0;
??
????????????????rep(y, h-1) rep(x, w-1) {
????????????????????????if (fld[y][x]) continue;
??
????????????????????????ans++;
??
????????????????????????queue<pii> q;
????????????????????????q.push(pii(y, x));
??
????????????????????????while (q.size()) {
????????????????????????????????pii p = q.front(); q.pop();
????????????????????????????????rep(i, 4) {
????????????????????????????????????????int ny = p.fst + dy[i], nx = p.scd + dx[i];
??
????????????????????????????????????????if (ny < 0 || ny >= h-1 || nx < 0 || nx >= w-1 || fld[ny][nx]) continue;
??
????????????????????????????????????????fld[ny][nx] = true;
????????????????????????????????????????q.push(pii(ny, nx));
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????cout << ans << endl;
????????}
} | a.cc:18:1: error: expected unqualified-id before '?' token
18 | ??
| ^
a.cc:20:1: error: expected unqualified-id before '?' token
20 | ??
| ^
a.cc:35:10: error: 'vector' does not name a type
35 | using vi=vector<int>;
| ^~~~~~
a.cc:36:11: error: 'vector' does not name a type
36 | using vvi=vector<vi>;
| ^~~~~~
a.cc:37:11: error: 'pair' does not name a type
37 | using pii=pair<int, int>;
| ^~~~
a.cc:38:12: error: 'vector' does not name a type
38 | using vpii=vector<pii>;
| ^~~~~~
a.cc:39:1: error: expected unqualified-id before '?' token
39 | ??
| ^
a.cc:41:18: error: 'ostream' does not name a type
41 | template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
| ^~~~~~~
a.cc:46:1: error: expected unqualified-id before '?' token
46 | ??
| ^
a.cc:48:11: error: 'll' does not name a type; did you mean 'ld'?
48 | constexpr ll linf = 3e18;
| ^~
| ld
a.cc:50:1: error: expected unqualified-id before '?' token
50 | ??
| ^
a.cc:55:1: error: expected unqualified-id before '?' token
55 | ??
| ^
a.cc:57:1: error: expected unqualified-id before '?' token
57 | ??
| ^
a.cc:60:1: error: expected unqualified-id before '?' token
60 | ??
| ^
a.cc:84:1: error: expected unqualified-id before '?' token
84 | ??
| ^
|
s955838212 | p00454 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
??
using namespace std;
??
#define y1 hogwhoasjfd
??
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
??
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;
??
template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
??
constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;
??
int w, h;
int n;
int x1[1005], x2[1005];
int y1[1005], y2[1005];
??
bool fld[1005*6+2][1005*6+2];
??
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
??
int compress(int *x1, int *x2, int w)
{
????????vi xs;
??
????????rep(i, n) {
????????????????for (int d = -1; d <= 1; ++d) {
????????????????????????int tx1 = x1[i] + d, tx2 = x2[i] + d;
??
????????????????????????if (0 <= tx1 && tx1 <= w) xs.PB(tx1);
????????????????????????if (0 <= tx2 && tx2 <= w) xs.PB(tx2);
????????????????}
????????}
??
????????sort(all(xs));
????????xs.erase(unique(all(xs)), end(xs));
??
????????rep(i, n) {
????????????????x1[i] = lower_bound(all(xs), x1[i]) - begin(xs);
????????????????x2[i] = lower_bound(all(xs), x2[i]) - begin(xs);
????????}
??
????????return xs.size();
}
??
int main()
{
????????while (cin >> w >> h, w) {
????????????????cin >> n;
??
????????????????memset(fld, 0, sizeof fld);
??
????????????????rep(i, n) {
????????????????????????cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
????????????????}
??
????????????????w = compress(x1, x2, w);
????????????????h = compress(y1, y2, h);
??
????????????????rep(i, n) {
????????????????????????for (int y = y1[i]; y <= y2[i]-1; ++y) {
????????????????????????????????for (int x = x1[i]; x <= x2[i]-1; ++x) {
????????????????????????????????????????fld[y][x] = true;
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????int ans = 0;
??
????????????????rep(y, h-1) rep(x, w-1) {
????????????????????????if (fld[y][x]) continue;
??
????????????????????????ans++;
??
????????????????????????queue<pii> q;
????????????????????????q.push(pii(y, x));
??
????????????????????????while (q.size()) {
????????????????????????????????pii p = q.front(); q.pop();
????????????????????????????????rep(i, 4) {
????????????????????????????????????????int ny = p.fst + dy[i], nx = p.scd + dx[i];
??
????????????????????????????????????????if (ny < 0 || ny >= h-1 || nx < 0 || nx >= w-1 || fld[ny][nx]) continue;
??
????????????????????????????????????????fld[ny][nx] = true;
????????????????????????????????????????q.push(pii(ny, nx));
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????cout << ans << endl;
????????}
} | a.cc:18:1: error: expected unqualified-id before '?' token
18 | ??
| ^
a.cc:20:1: error: expected unqualified-id before '?' token
20 | ??
| ^
a.cc:35:10: error: 'vector' does not name a type
35 | using vi=vector<int>;
| ^~~~~~
a.cc:36:11: error: 'vector' does not name a type
36 | using vvi=vector<vi>;
| ^~~~~~
a.cc:37:11: error: 'pair' does not name a type
37 | using pii=pair<int, int>;
| ^~~~
a.cc:38:12: error: 'vector' does not name a type
38 | using vpii=vector<pii>;
| ^~~~~~
a.cc:39:1: error: expected unqualified-id before '?' token
39 | ??
| ^
a.cc:41:18: error: 'ostream' does not name a type
41 | template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
| ^~~~~~~
a.cc:46:1: error: expected unqualified-id before '?' token
46 | ??
| ^
a.cc:48:11: error: 'll' does not name a type; did you mean 'ld'?
48 | constexpr ll linf = 3e18;
| ^~
| ld
a.cc:50:1: error: expected unqualified-id before '?' token
50 | ??
| ^
a.cc:55:1: error: expected unqualified-id before '?' token
55 | ??
| ^
a.cc:57:1: error: expected unqualified-id before '?' token
57 | ??
| ^
a.cc:60:1: error: expected unqualified-id before '?' token
60 | ??
| ^
a.cc:84:1: error: expected unqualified-id before '?' token
84 | ??
| ^
|
s467818036 | p00454 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
??
using namespace std;
??
#define y1 hogwhoasjfd
??
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
??
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;
??
template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
??
constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;
??
int w, h;
int n;
int x1[1005], x2[1005];
int y1[1005], y2[1005];
??
bool fld[1005*6+2][1005*6+2];
??
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
??
int compress(int *x1, int *x2, int w)
{
vi xs;
??
rep(i, n) {
for (int d = -1; d <= 1; ++d) {
int tx1 = x1[i] + d, tx2 = x2[i] + d;
??
if (0 <= tx1 && tx1 <= w) xs.PB(tx1);
if (0 <= tx2 && tx2 <= w) xs.PB(tx2);
}
}
??
sort(all(xs));
xs.erase(unique(all(xs)), end(xs));
??
rep(i, n) {
x1[i] = lower_bound(all(xs), x1[i]) - begin(xs);
x2[i] = lower_bound(all(xs), x2[i]) - begin(xs);
}
??
return xs.size();
}
??
int main()
{
while (cin >> w >> h, w) {
cin >> n;
??
memset(fld, 0, sizeof fld);
??
rep(i, n) {
cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
}
??
w = compress(x1, x2, w);
h = compress(y1, y2, h);
??
rep(i, n) {
for (int y = y1[i]; y <= y2[i]-1; ++y) {
for (int x = x1[i]; x <= x2[i]-1; ++x) {
fld[y][x] = true;
}
}
}
??
int ans = 0;
??
rep(y, h-1) rep(x, w-1) {
if (fld[y][x]) continue;
??
ans++;
??
queue<pii> q;
q.push(pii(y, x));
??
while (q.size()) {
pii p = q.front(); q.pop();
rep(i, 4) {
int ny = p.fst + dy[i], nx = p.scd + dx[i];
??
if (ny < 0 || ny >= h-1 || nx < 0 || nx >= w-1 || fld[ny][nx]) continue;
??
fld[ny][nx] = true;
q.push(pii(ny, nx));
}
}
}
??
cout << ans << endl;
}
} | a.cc:18:1: error: expected unqualified-id before '?' token
18 | ??
| ^
a.cc:20:1: error: expected unqualified-id before '?' token
20 | ??
| ^
a.cc:35:10: error: 'vector' does not name a type
35 | using vi=vector<int>;
| ^~~~~~
a.cc:36:11: error: 'vector' does not name a type
36 | using vvi=vector<vi>;
| ^~~~~~
a.cc:37:11: error: 'pair' does not name a type
37 | using pii=pair<int, int>;
| ^~~~
a.cc:38:12: error: 'vector' does not name a type
38 | using vpii=vector<pii>;
| ^~~~~~
a.cc:39:1: error: expected unqualified-id before '?' token
39 | ??
| ^
a.cc:41:18: error: 'ostream' does not name a type
41 | template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
| ^~~~~~~
a.cc:46:1: error: expected unqualified-id before '?' token
46 | ??
| ^
a.cc:48:11: error: 'll' does not name a type; did you mean 'ld'?
48 | constexpr ll linf = 3e18;
| ^~
| ld
a.cc:50:1: error: expected unqualified-id before '?' token
50 | ??
| ^
a.cc:55:1: error: expected unqualified-id before '?' token
55 | ??
| ^
a.cc:57:1: error: expected unqualified-id before '?' token
57 | ??
| ^
a.cc:60:1: error: expected unqualified-id before '?' token
60 | ??
| ^
a.cc:84:1: error: expected unqualified-id before '?' token
84 | ??
| ^
|
s737096918 | p00454 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <cmath>
#define INF 10000000
#define REP(i, n) for(int i = 0;i < (n);i++)
#define all(n) n.begin(),n.end()
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int MAX_N = 1000;
int w, h, n;
int X1[MAX_N], X2[MAX_N], Y1[MAX_N], Y2[MAX_N];
int fld[6*MAX_N][6*MAX_N];
int compress(int *x1, int *x2, int W){
vector<int> xs;
REP(i, n){
for(int d = -1;d <= 1;d++){
int tx1 = x1[i]+d, tx2 = x2[i]+d;
if(0 <= tx1 && tx1 <= W*2) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= W*2) xs.push_back(tx2);
}
}
sort(all(xs));
//xs.erase(unique(all(xs)), xs.end());
REP(i, n){
x1[i] = find(all(xs), x1[i]) - xs.begin();
x2[i] = find(all(xs), x2[i]) - xs.begin();
}
return xs.size();
}
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
void dfs(int x, int y){
if(fld[x][y]) return;
fld[x][y] = true;
REP(i, 4){
//int tx = x + dx[i];
//int ty = y + dy[i];
if(0 <= x+dx[i] && x+dx[i] < w && 0 <= y+dy[i] && y+dy[i] < h && !fld[x+dx[i]][y+dy[i]]) dfs(x+dx[i], y+dy[i]);
}
}
int main(void){
while(cin >> w >> h && w && h){
cin >> n;
REP(i, n){
cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
X1[i] = X1[i] * 2;
X2[i] = X2[i] * 2;
Y1[i] = Y1[i] * 2;
Y2[i] = Y2[i] * 2;
}
REP(i, MAX_N*6){
fill(fld[i], fld[i]+(MAX_N*6), false);
}
w = compress(X1, X2, w);
h = compress(Y1, Y2, h);
REP(k, n){
for(int i = X1[k];i <= X2[k];i++){
for(int j = Y1[k];j <= Y2[k];j++){
fld[i][j] = true;
}
}
}
int res = 0;
REP(i, w){
REP(j, h){
if(fld[i][j]) continue;
res++;
// dfs(i, j);
queue<PII> que;
que.push(PII(i, j));
while(!que.empty()){
PII p = que.front(); que.pop();
REP(k, 4){
int tx = p.first+dx[k], ty = p.second + dy[i];
if(tx < 0 || w <= tx || ty < 0 || h <= ty || fld[tx][ty]) continue;
fld[tx][ty] = true;
que.push(PII(tx, ty));
}
}
}
}
cout << res << endl;
}
} | a.cc: In function 'int main()':
a.cc:91:39: error: 'PII' was not declared in this scope
91 | queue<PII> que;
| ^~~
a.cc:91:42: error: template argument 1 is invalid
91 | queue<PII> que;
| ^
a.cc:91:42: error: template argument 2 is invalid
a.cc:92:37: error: request for member 'push' in 'que', which is of non-class type 'int'
92 | que.push(PII(i, j));
| ^~~~
a.cc:93:44: error: request for member 'empty' in 'que', which is of non-class type 'int'
93 | while(!que.empty()){
| ^~~~~
a.cc:94:44: error: expected ';' before 'p'
94 | PII p = que.front(); que.pop();
| ^~
| ;
a.cc:94:66: error: request for member 'pop' in 'que', which is of non-class type 'int'
94 | PII p = que.front(); que.pop();
| ^~~
a.cc:96:58: error: 'p' was not declared in this scope
96 | int tx = p.first+dx[k], ty = p.second + dy[i];
| ^
a.cc:97:73: error: 'ty' was not declared in this scope; did you mean 'tx'?
97 | if(tx < 0 || w <= tx || ty < 0 || h <= ty || fld[tx][ty]) continue;
| ^~
| tx
a.cc:98:57: error: 'ty' was not declared in this scope; did you mean 'tx'?
98 | fld[tx][ty] = true;
| ^~
| tx
a.cc:99:53: error: request for member 'push' in 'que', which is of non-class type 'int'
99 | que.push(PII(tx, ty));
| ^~~~
|
s926100232 | p00454 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <cmath>
#define INF 10000000
#define REP(i, n) for(int i = 0;i < (n);i++)
#define all(n) n.begin(),n.end()
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int MAX_N = 1000;
int w, h, n;
int X1[MAX_N], X2[MAX_N], Y1[MAX_N], Y2[MAX_N];
bool fld[6*MAX_N][6*MAX_N];
int compress(int *x1, int *x2, int W){
vector<int> xs;
REP(i, n){
for(int d = -1;d <= 1;d++){
int tx1 = x1[i]+d, tx2 = x2[i]+d;
if(0 <= tx1 && tx1 <= W*2) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= W*2) xs.push_back(tx2);
}
}
sort(all(xs));
//xs.erase(unique(all(xs)), xs.end());
REP(i, n){
x1[i] = find(all(xs), x1[i]) - xs.begin();
x2[i] = find(all(xs), x2[i]) - xs.begin();
}
return xs.size();
}
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
void dfs(int x, int y){
if(fld[x][y]) return;
fld[x][y] = true;
REP(i, 4){
//int tx = x + dx[i];
//int ty = y + dy[i];
if(0 <= x+dx[i] && x+dx[i] < w && 0 <= y+dy[i] && y+dy[i] < h && !fld[x+dx[i]][y+dy[i]]) dfs(x+dx[i], y+dy[i]);
}
}
int main(void){
while(cin >> w >> h && w && h){
cin >> n;
REP(i, n){
cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
X1[i] = X1[i] * 2;
X2[i] = X2[i] * 2;
Y1[i] = Y1[i] * 2;
Y2[i] = Y2[i] * 2;
}
REP(i, MAX_N*6){
fill(fld[i], fld[i]+(MAX_N*6), false);
}
w = compress(X1, X2, w);
h = compress(Y1, Y2, h);
REP(k, n){
for(int i = X1[k];i <= X2[k];i++){
for(int j = Y1[k];j <= Y2[k];j++){
fld[i][j] = true;
}
}
}
int res = 0;
REP(i, w){
REP(j, h){
if(fld[i][j]) continue;
res++;
// dfs(i, j);
queue<PII> que;
que.push(PII(i, j));
while(!que.empty()){
PII p = que.front(); que.pop();
REP(k, 4){
int tx = p.first+dx[k], ty = p.second + dy[i];
if(tx < 0 || w <= tx || ty < 0 || h <= ty || fld[tx][ty]) continue;
fld[tx][ty] = true;
que.push(PII(tx, ty));
}
}
}
}
cout << res << endl;
}
} | a.cc: In function 'int main()':
a.cc:91:39: error: 'PII' was not declared in this scope
91 | queue<PII> que;
| ^~~
a.cc:91:42: error: template argument 1 is invalid
91 | queue<PII> que;
| ^
a.cc:91:42: error: template argument 2 is invalid
a.cc:92:37: error: request for member 'push' in 'que', which is of non-class type 'int'
92 | que.push(PII(i, j));
| ^~~~
a.cc:93:44: error: request for member 'empty' in 'que', which is of non-class type 'int'
93 | while(!que.empty()){
| ^~~~~
a.cc:94:44: error: expected ';' before 'p'
94 | PII p = que.front(); que.pop();
| ^~
| ;
a.cc:94:66: error: request for member 'pop' in 'que', which is of non-class type 'int'
94 | PII p = que.front(); que.pop();
| ^~~
a.cc:96:58: error: 'p' was not declared in this scope
96 | int tx = p.first+dx[k], ty = p.second + dy[i];
| ^
a.cc:97:73: error: 'ty' was not declared in this scope; did you mean 'tx'?
97 | if(tx < 0 || w <= tx || ty < 0 || h <= ty || fld[tx][ty]) continue;
| ^~
| tx
a.cc:98:57: error: 'ty' was not declared in this scope; did you mean 'tx'?
98 | fld[tx][ty] = true;
| ^~
| tx
a.cc:99:53: error: request for member 'push' in 'que', which is of non-class type 'int'
99 | que.push(PII(tx, ty));
| ^~~~
|
s425404175 | p00454 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <cmath>
#define INF 10000000
#define REP(i, n) for(int i = 0;i < (n);i++)
#define all(n) n.begin(),n.end()
using namespace std;
typedef long long int ll;
typedef pair<int, int> PII;
const int MAX_N = 1005;
int w, h, n;
int X1[MAX_N], X2[MAX_N], Y1[MAX_N], Y2[MAX_N];
bool fld[6*MAX_N][6*MAX_N];
int compress(int *x1, int *x2, int W){
vector<int> xs;
REP(i, n){
for(int d = -1;d <= 1;d++){
int tx1 = x1[i]+d, tx2 = x2[i]+d;
if(0 <= tx1 && tx1 <= W*2) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= W*2) xs.push_back(tx2);
}
}
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
REP(i, n){
x1[i] = find(all(xs), x1[i]) - xs.begin();
x2[i] = find(all(xs), x2[i]) - xs.begin();
}
return xs.size();
}
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
int main(void){
while(cin >> w >> h && w && h){
cin >> n;
REP(i, n){
cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
X1[i] = X1[i] * 2;
X2[i] = X2[i] * 2;
Y1[i] = Y1[i] * 2;
Y2[i] = Y2[i] * 2;
}
memset(fld, 0, sizeof(fld));
w = compress(X1, X2, w);
h = compress(Y1, Y2, h);
REP(i, n){
for(int y = Y1[i];y <= Y2[i];y++){
for(int x = X1[i];x <= X2[i];x++){
fld[y][x] = true;
}
}
}
int res = 0;
REP(y, h) REP(x, w){
if(fld[y][x]) continue;
res++;
queue<PII> que;
que.push(PII(y, x));
while(!que.empty()){
PII p = que.front(); que.pop();
REP(i, 4){
int tx = p.second + dx[i], ty = p.first + dy[i];
if(tx < 0 || w <= tx || ty < 0 || h <= ty || fld[y][x]) continue;
fld[y][x] = true;
que.push(PII(y, x));
}
}
}
cout << res << endl;
}
} | a.cc: In function 'int main()':
a.cc:57:17: error: 'memset' was not declared in this scope
57 | memset(fld, 0, sizeof(fld));
| ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include <cmath>
+++ |+#include <cstring>
8 | #define INF 10000000
|
s696330805 | p00454 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#define INF 10000000
#define REP(i, n) for(int i = 0;i < (n);i++)
#define all(n) n.begin(),n.end()
using namespace std;
typedef long long int ll;
typedef pair<int, int> PII;
const int MAX_N = 1005;
int w, h, n;
int X1[MAX_N], X2[MAX_N], Y1[MAX_N], Y2[MAX_N];
bool fld[6*MAX_N][6*MAX_N];
int compress(int *x1, int *x2, int W){
vector<int> xs;
REP(i, n){
for(int d = -1;d <= 1;d++){
int tx1 = x1[i]+d, tx2 = x2[i]+d;
if(0 <= tx1 && tx1 <= W*2) xs.push_back(tx1);
if(0 <= tx2 && tx2 <= W*2) xs.push_back(tx2);
}
}
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
REP(i, n){
x1[i] = find(all(xs), x1[i]) - xs.begin();
x2[i] = find(all(xs), x2[i]) - xs.begin();
}
return xs.size();
}
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
int main(void){
while(cin >> w >> h && w && h){
cin >> n;
REP(i, n){
cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
X1[i] = X1[i] * 2;
X2[i] = X2[i] * 2;
Y1[i] = Y1[i] * 2;
Y2[i] = Y2[i] * 2;
}
memset(fld, 0, sizeof(fld));
w = compress(X1, X2, w);
h = compress(Y1, Y2, h);
REP(i, n){
for(int y = Y1[i];y <= Y2[i];y++){
for(int x = X1[i];x <= X2[i];x++){
fld[y][x] = true;
}
}
}
int res = 0;
REP(y, h) REP(x, w){
if(fld[y][x]) continue;
res++;
queue<PII> que;
que.push(PII(y, x));
while(!que.empty()){
PII p = que.front(); que.pop();
REP(i, 4){
int tx = p.second + dx[i], ty = p.first + dy[i];
if(tx < 0 || w <= tx || ty < 0 || h <= ty || fld[y][x]) continue;
fld[y][x] = true;
que.push(PII(y, x));
}
}
}
cout << res << endl;
}
} | a.cc: In function 'int main()':
a.cc:59:17: error: 'memset' was not declared in this scope
59 | memset(fld, 0, sizeof(fld));
| ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include <cstdlib>
+++ |+#include <cstring>
10 | #define INF 10000000
|
s236010882 | p00454 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<unordered_map>
#define P pair<int,int>
using namespace std;
P x[1000], y[1000];
bool S[2005][2005];
int dx[4] = { -1,0,0,1 }, dy[4] = { 0,-1,1,0 };
int main() {
int a, b;
while (cin >> a >> b, a | b) {
set<int>c[2];
c[0].insert(0); c[0].insert(a);
c[1].insert(0); c[0].insert(b);
int d; cin >> d;
for (int e = 0; e < d; e++) {
int f, g, h, i; scanf("%d %d %d %d", &f, &g, &h, &i);
c[0].insert(f); c[0].insert(h);
c[1].insert(g); c[1].insert(i);
x[e] = P(f, g);
y[e] = P(h, i);
}
memset(S, 0, sizeof(S));
int taiou[2][2005];
unordered_map<int, int>U[2];
auto e = c[0].begin();
for (int f = 0; f < c[0].size(); e++, f++) {
taiou[0][f] = *e;
U[0][*e] = f;
}
e = c[1].begin();
for (int f = 0; f < c[1].size(); e++, f++) {
taiou[1][f] = *e;
U[1][*e] = f;
}
for (int g = 0; g < d; g++) {
for (int l = U[0][x[g].first]; l < U[0][y[g].first]; l++) {
for (int r = U[1][x[g].second]; r < U[1][y[g].second]; r++) {
S[l][r] = true;
}
}
}
int ans = 0;
for (int i = 0; i+1 < c[0].size(); i++) {
for (int j = 0; j+1 < c[1].size(); j++) {
if (!S[i][j]) {
ans++;
queue<P>Q;
Q.push(P(i,j));
while (Q.size()) {
P t = Q.front(); Q.pop();
S[i][j] = true;
for (int w = 0; w < 4; w++) {
int n = t.first + dx[w], m = t.second + dy[w];
if (n >= 0 && n+1 < c[0].size() && m >= 0 && m+1 < c[1].size() && !S[n][m]) {
S[n][m] = true;
Q.push(P(n, m));
}
}
}
}
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:32:17: error: 'memset' was not declared in this scope
32 | memset(S, 0, sizeof(S));
| ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
10 | #include<list>
+++ |+#include <cstring>
11 | #include<unordered_map>
|
s612340850 | p00454 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int h, w, n;
int x[1000][2], y[1000][2];
vector<int> xs, ys, z;
bool a[2500][2500];
bool f[2500][2500];
long long int ans;
typedef pair<int, int> P;
int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};
void dfs(int s, int t){
if(a[s][t] || f[s][t]) return;
// printf("%d %d\n", s, t);
ans++;
queue<P> q;
q.push(P(s, t));
while(!q.empty()){
P p = q.front(); q.pop();
f[p.first][p.second] = true;
for(int i=0; i<4; i++){
int nx = p.first+dx[i];
int ny = p.second+dy[i];
if(0 <= nx && 0 <= ny && nx < xs.size()-1 && ny < ys.size()-1)
if(!a[nx][ny] && !f[nx][ny])
q.push(P(nx, ny));
}
}
}
int main(){
while(1){
scanf("%d %d", &w, &h);
if(w == 0 && h == 0) break;
scanf("%d", &n);
for(int i=0; i<n; i++) scanf("%d %d %d %d", &x[i][0], &y[i][0], &x[i][1], &y[i][1]);
xs.push_back(0);
ys.push_back(0);
xs.push_back(w);
ys.push_back(h);
for(int i=0; i<n; i++){
for(int j=0; j<2; j++){
xs.push_back(x[i][j]);
ys.push_back(y[i][j]);
}
}
sort(xs.begin(), xs.end()); sort(ys.begin(), ys.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
ys.erase(unique(ys.begin(), ys.end()), ys.end());
/*
for(int i=0; i<xs.size(); i++) printf("%d\n", xs[i]);
for(int i=0; i<ys.size(); i++) printf("%d\n", ys[i]);
*/
for(int i=0; i<n; i++){
for(int j=0; j<2; j++){
x[i][j] = find(xs.begin(), xs.end(), x[i][j]) - xs.begin();
y[i][j] = find(ys.begin(), ys.end(), y[i][j]) - ys.begin();
}
}
/*
for(int i=0; i<n; i++){
printf("%d %d %d %d\n", x[i][0], y[i][0], x[i][1], y[i][1]);
}
*/
memset(a, 0, sizeof(a));
for(int i=0; i<n; i++){
for(int j=x[i][0]; j<x[i][1]; j++){
for(int k=y[i][0]; k<y[i][1]; k++){
a[j][k] = true;
}
}
}
/*
for(int i=0; i<xs.size(); i++){
for(int j=0; j<ys.size(); j++){
if(a[i][j]) printf("1 ");
else printf("0 ");
}
printf("\n");
}
*/
// printf("%lu %lu\n", xs.size(), ys.size());
memset(f, 0, sizeof(f));
ans = 0;
for(int i=0; i<xs.size()-1; i++){
for(int j=0; j<ys.size()-1; j++){
dfs(i, j);
}
}
printf("%lld\n", ans);
}
} | a.cc: In function 'int main()':
a.cc:71:17: error: 'memset' was not declared in this scope
71 | memset(a, 0, sizeof(a));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <queue>
+++ |+#include <cstring>
5 | using namespace std;
|
s279058094 | p00454 | C++ |
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define MAX_N 1010
int n;
bool f[2 * MAX_N + 6][2 * MAX_N + 6];
int cp(int *z1, int *z2, int k)
{
vector<int> xs;
for (int i = 0; i<n; i++) {
xs.push_back(z1[i]);
if (z1[i] - 1 >= 0)xs.push_back(z1[i] - 1);
xs.push_back(z2[i] - 1);
if (z2[i]<k)xs.push_back(z2[i]);
}
sort(xs.begin(), xs.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
for (int i = 0; i<n; i++) {
z1[i] = find(xs.begin(), xs.end(), z1[i]) - xs.begin();
z2[i] = find(xs.begin(), xs.end(), z2[i]) - xs.begin();
}
return xs.size();
}
int main()
{
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int w, h;
while (scanf("%d%d", &w, &h), w || h) {
scanf("%d", &n);
int x1[MAX_N + 1], x2[MAX_N + 1], y1[MAX_N + 1], y2[MAX_N + 1];
for (int i = 0; i<n; i++) {
scanf("%d%d%d%d", &x1[i], &y1[i], &x2[i], &y2[i]);
}
w = cp(x1, x2, w);
h = cp(y1, y2, h);
memset(f, 0, sizeof(f));
for (int i = 0; i<n; i++) {
for (int x = x1[i]; x<x2[i]; x++) {
for (int y = y1[i]; y<y2[i]; y++) {
f[x][y] = true;
}
}
}
int ans = 0;
for (int i = 0; i<w; i++) {
for (int j = 0; j<h; j++) {
if (f[i][j])continue;
ans++;
queue<P> q;
q.push(make_pair(i, j));
f[i][j] = true;
while (!q.empty()) {
int x = q.front().first, y = q.front().second;
q.pop();
for (int l = 0; l<4; l++) {
int xx = x + dx[l], yy = y + dy[l];
if (xx<0 || xx >= w || yy<0 || yy >= h)continue;
if (!f[xx][yy]) {
q.push(make_pair(xx, yy));
f[xx][yy] = true;
}
}
}
}
}
printf("%d\n", ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:58:17: error: 'memset' was not declared in this scope
58 | memset(f, 0, sizeof(f));
| ^~~~~~
a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
13 | #include<numeric>
+++ |+#include <cstring>
14 | using namespace std;
|
s266685780 | p00454 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <fstream>
using namespace std;
const int MAX_N = 1000;
int X1[MAX_N], X2[MAX_N], Y1[MAX_N], Y2[MAX_N];
bool fld[MAX_N * 3][MAX_N * 3];
int W, H, N;
struct RECT
{
int r, l, u, b;
};
int compress(int *x1, int *x2, int w);
int main()
{
//ifstream ifs("data.txt");
while( cin >> W >> H , W)
{
cin >> N;
for(int i = 0; i < N; i++)
cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
W = compress(X1, X2, W);
H = compress(Y1, Y2, H);
memset(fld, 0, sizeof(fld));
for(int i = 0; i < N; i++)
for(int y = Y1[i]; y <= Y2[i]; y++)
for(int x = X1[i]; x <= X2[i]; x++)
fld[y][x] = true;
int ans = 0;
for(int y = 0; y < H; y++){
for(int x = 0; x < W; x++){
if(fld[y][x]) continue;
ans++;
queue<pair<int, int> > que;
que.push(make_pair(x, y));
while(!que.empty())
{
int sx = que.front().first, sy = que.front().second;
que.pop();
int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, 1, -1, 0};
for(int i = 0; i < 4; i++)
{
int tx = sx + dx[i], ty = sy + dy[i];
if(tx < 0 || W <= tx || ty < 0 || H <= ty) continue;
if(fld[ty][tx]) continue;
que.push(make_pair(tx, ty));
fld[ty][tx] = true;
}
}
}
}
cout << ans << endl;
}
//cin.sync(); cin.get();
}
int compress(int *x1, int *x2, int w)
{
vector<int> xs;
for(int i = 0; i < N; i++){
for(int d = -1; d <= 1; d++)
{
int tx1 = x1[i] + d, tx2 = x2[i] + d;
if(0 < tx1 && tx1 < W-1) xs.push_back(tx1);
if(0 < tx2 && tx2 < W-1) xs.push_back(tx2);
}
}
sort(xs.begin(), xs.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
for(int i = 0; i < N; i++)
{
x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
}
return xs.size();
} | a.cc: In function 'int main()':
a.cc:34:17: error: 'memset' was not declared in this scope
34 | memset(fld, 0, sizeof(fld));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <fstream>
+++ |+#include <cstring>
6 | using namespace std;
|
s101677299 | p00454 | C++ | #include <iostream>
#include <queue>
#include <map>
#include <vector>
using namespace std;
int W,H,N;
bool fld[6000][6000];
int X1[1000],X2[1000],Y1[1000],Y2[1000];
const int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
int compress(int *x1,int *x2,int w){
vector<int> xs;
for(int i=0;i<N;i++){
for(int j=-1;j<=1;j++){
int tx1=x1[i]+j,tx2=x2[i]+j;
if(1<=tx1 && tx1<=W)xs.push_back(tx1);
if(1<=tx2 && tx2<=W)xs.push_back(tx2);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i=0;i<N;i++){
x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
}
return xs.size();
}
void solve(){
W=compress(X1,X2,W);
H=compress(Y1,Y2,H);
memset(fld,0,sizeof(fld));
for(int i=0;i<N;i++){
for(int y=Y1[i];y<=Y2[i];y++){
for(int x=X1[i];x<=X2[i];x++){
fld[y][x]=true;
}
}
}
int ans=0;
for(int y=0;y<H;y++){
for(int x=0;x<W;x++){
if(fld[y][x])continue;
ans++;
queue<pair<int,int>> que;
que.push(make_pair(x,y));
while(!que.empty()){
int sx=que.front().first,sy=que.front().second;
que.pop();
for(int i=0;i<4;i++){
int tx=sx+dx[i],ty=sy+dy[i];
if(tx<0 || W<=tx || ty<0 || H<=ty)continue;
if(fld[ty][tx])continue;
que.push(make_pair(tx,ty));
fld[ty][tx]=true;
}
}
}
}
printf("%d\n",ans);
}
int main(void){
while(1){
scanf("%d%d",&W,&H);
if(W==0 && H==0)break;
scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%d%d%d%d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
}
solve();
}
return 0;
} | a.cc: In function 'int compress(int*, int*, int)':
a.cc:21:9: error: 'sort' was not declared in this scope; did you mean 'short'?
21 | sort(xs.begin(),xs.end());
| ^~~~
| short
a.cc:22:18: error: 'unique' was not declared in this scope
22 | xs.erase(unique(xs.begin(),xs.end()),xs.end());
| ^~~~~~
a.cc:24:27: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
24 | x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:24:27: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
24 | x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:25:27: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
25 | x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:25:27: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
25 | x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'void solve()':
a.cc:33:9: error: 'memset' was not declared in this scope
33 | memset(fld,0,sizeof(fld));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <map>
+++ |+#include <cstring>
4 | #include <vector>
|
s620289420 | p00454 | C++ | #include <iostream>
#include <queue>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int W,H,N;
bool fld[6000][6000];
int X1[1000],X2[1000],Y1[1000],Y2[1000];
const int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
int compress(int *x1,int *x2,int w){
vector<int> xs;
for(int i=0;i<N;i++){
for(int j=-1;j<=1;j++){
int tx1=x1[i]+j,tx2=x2[i]+j;
if(1<=tx1 && tx1<=W)xs.push_back(tx1);
if(1<=tx2 && tx2<=W)xs.push_back(tx2);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i=0;i<N;i++){
x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
}
return xs.size();
}
void solve(){
W=compress(X1,X2,W);
H=compress(Y1,Y2,H);
memset(fld,0,sizeof(fld));
for(int i=0;i<N;i++){
for(int y=Y1[i];y<=Y2[i];y++){
for(int x=X1[i];x<=X2[i];x++){
fld[y][x]=true;
}
}
}
int ans=0;
for(int y=0;y<H;y++){
for(int x=0;x<W;x++){
if(fld[y][x])continue;
ans++;
queue<pair<int,int>> que;
que.push(make_pair(x,y));
while(!que.empty()){
int sx=que.front().first,sy=que.front().second;
que.pop();
for(int i=0;i<4;i++){
int tx=sx+dx[i],ty=sy+dy[i];
if(tx<0 || W<=tx || ty<0 || H<=ty)continue;
if(fld[ty][tx])continue;
que.push(make_pair(tx,ty));
fld[ty][tx]=true;
}
}
}
}
printf("%d\n",ans);
}
int main(void){
while(1){
scanf("%d%d",&W,&H);
if(W==0 && H==0)break;
scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%d%d%d%d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
}
solve();
}
return 0;
} | a.cc: In function 'void solve()':
a.cc:34:9: error: 'memset' was not declared in this scope
34 | memset(fld,0,sizeof(fld));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <algorithm>
+++ |+#include <cstring>
6 | using namespace std;
|
s310180920 | p00454 | C++ | #include<algorithm>
#include<iostream>
#include<cstdio>
using namespace std;
struct P{
int v,w,x,y;
};
bool pr(int* p,int* q){
return *p<*q;
}
P a[1000];
int* x[2002],* y[2002];
char b[2003][2003];
void fi(int x,int y){
static int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
int i;
b[x][y]=-1;
for(i=0;i<4;++i){
if(!b[x+dx[i]][y+dy[i]])
fi(x+dx[i],y+dy[i]);
}
}
int main(){
int i,j,k;
int w,h;
while(scanf("%d%d",&w,&h),w||h){
int n;
scanf("%d",&n);
for(i=0;i<n;++i){
scanf("%d%d%d%d",&a[i].v,&a[i].w,&a[i].x,&a[i].y);
x[i*2]=&a[i].v;
x[i*2+1]=&a[i].x;
y[i*2]=&a[i].w;
y[i*2+1]=&a[i].y;
}
int z=0;
x[i*2]=&z;
x[i*2+1]=&w;
y[i*2]=&z;
y[i*2+1]=&h;
sort(x,x+n*2+2,pr);
sort(y,y+n*2+2,pr);
for(i=1;i<n*2+2&&*x[0]==*x[i];++i);
for(;i<n*2+2;i=j){
for(j=i+1;j<n*2+2&&*x[i]==*x[j];++j);
for(k=i;k<j;++k)
*x[k]=*x[i-1]+1;
}
for(i=1;i<n*2+2&&*y[0]==*y[i];++i);
for(;i<n*2+2;i=j){
for(j=i+1;j<n*2+2&&*y[i]==*y[j];++j);
for(k=i;k<j;++k)
*y[k]=*y[i-1]+1;
}
memset(b,-1,sizeof(b));
for(i=1;i<=w;++i)
memset(b[i]+1,0,sizeof(char)*h);
for(i=0;i<n;++i)
for(j=a[i].v+1;j<=a[i].x;++j)
memset(b[j]+a[i].w+1,-1,sizeof(char)*(a[i].y-a[i].w));
int ct=0;
for(i=1;i<=h;++i){
for(j=1;j<=w;++j){
if(b[j][i])
continue;
fi(j,i);
++ct;
}
}
printf("%d\n",ct);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:55:17: error: 'memset' was not declared in this scope
55 | memset(b,-1,sizeof(b));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<cstdio>
+++ |+#include <cstring>
4 | using namespace std;
|
s652598940 | p00454 | C++ | #include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
int w,h,n;
int x1[1005],x2[1005],y1[1005],y2[1005];
bool field[4005][4005]={};
int compress(int *x1,int *x2,int W){
vector<int>xs;
for(int i=0;i<n;i++){
for(int d=-1;d<=1;d++){
int ax=x1[i]+d;
int bx=x2[i]+d;
if(1<=ax && ax<=W) xs.push_back(ax);
if(1<=bx && bx<=W) xs.push_back(bx);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i=0;i<n;i++){
x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
}
return xs.size();
}
int main(){
while(1){
scanf("%d %d",&w,&h);
if(!w) break;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d %d %d",&x1[i],&y1[i],&x2[i],&y2[i]);
}
w=compress(x1,x2,w);
h=compress(y1,y2,h);
memset(field,0,sizeof(field));
for(int i=0;i<n;i++){
for(int x=x1[i];x<=x2[i];x++){
for(int y=y1[i];y<=y2[i];y++){
field[x][y]=true;
}
}
}
int ans=0;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
for(int x=0;x<w;x++){
for(int y=0;y<h;y++){
if(field[x][y]) continue;
ans++;
queue<pair<int,int> >que;
que.push(make_pair(x,y));
while(!que.empty()){
int ax=que.front().first;
int ay=que.front().second;
que.pop();
for(int i=0;i<4;i++){
int ro=ax+dx[i];
int ryu=ay+dy[i];
if(ro<0 || w<=ro || ryu<0 || h<=ryu){
continue;
}
if(field[ro][ryu]) continue;
que.push(make_pair(ro,ryu));
field[ro][ryu]=true;
}
}
}
}
printf("%d\n",ans);
}
return 0;
} | a.cc:7:23: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
7 | int x1[1005],x2[1005],y1[1005],y2[1005];
| ^~
a.cc: In function 'int main()':
a.cc:37:9: error: 'memset' was not declared in this scope
37 | memset(field,0,sizeof(field));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <queue>
+++ |+#include <cstring>
5 | using namespace std;
|
s432914344 | p00454 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(n) n.begin(),n.end()
#define SIZE 2048
struct P{
int x,y;
P(int x1, int y1){
x=x1,y=y1;
}
};
int compress(vector<int> &x1, vector<int> &x2, int W){
vector<int> xs;
unsigned int size = x1.size();
for(int i=0; i<size; i++){
for(int d=-1; d<=1; d++){
int tx1 = x1[i] + d, tx2 = x2[i] + d;
if(0<=tx1 && tx1 <=W) xs.push_back(tx1);
if(0<=tx2 && tx2 <=W) xs.push_back(tx2);
}
}
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
int end = 0;
for(int i=0; i<size; i++){
x1[i] = find(all(xs), x1[i]) - xs.begin();
x2[i] = find(all(xs), x2[i]) - xs.begin();
if(end<x2[i])
end = x2[i];
}
return xs.size()-1;
}
void dfs(bool Map[SIZE][SIZE], P start, int W, int H){
static const int dx[] = {0, 0, -1, 1}, dy[] = {1, -1, 0, 0};
stack<P> st;
st.push(start);
while(st.size()){
P s = st.top();
st.pop();
rep(i, 4){
P t = P(s.x+dx[i], s.y+dy[i]);
if(t.y>=0 && t.x>=0 && t.y<H && t.x<W && Map[t.y][t.x]==false){
Map[t.y][t.x]=true;
st.push(t);
}
}
}
}
bool board[SIZE][SIZE];
int main(){
int W,H,N;
while(cin>>W>>H, W|H){
cin>>N;
vector<int> x1, x2, y1, y2;
rep(i,N){
int a, b, c, d;
cin>>a>>b>>c>>d;
x1.push_back(a);
y1.push_back(b);
x2.push_back(c);
y2.push_back(d);
}
W = compress(x1, x2, W);
H = compress(y1, y2, H);
memset(board, 0, sizeof(board));
rep(i, N){
for(int y=y1[i]; y<y2[i]; y++){
memset(board[y]+x1[i], 1, x2[i]-x1[i]);
}
}
int count = 0;
rep(y, H){
rep(x, W){
if(board[y][x]==false){
count++;
dfs(board, P(x, y), W, H);
}
}
}
cout << count << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:79:5: error: 'memset' was not declared in this scope
79 | memset(board, 0, sizeof(board));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<stack>
+++ |+#include <cstring>
5 |
|
s716177290 | p00454 | C++ | //Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define f first
#define s second
#define rep(i,x) for(int i=0;i<x;i++)
bool f[4005][4005];
int x1[1005],y1[1005],x2[1005],y2[1005],w,h,n;
int main()
{
srand((unsigned int)time(NULL));
while(1)
{
vector<int>x,y;
scanf("%d %d %d",&w,&h,&n);
for(int i=0;i<n;i++)
{
scanf("%d",&x1[i]);
scanf("%d",&y1[i]);
scanf("%d",&x2[i]);
scanf("%d",&y2[i]);
x.pb(x1[i]);
if(x1[i]) x.pb(x1[i]-1);
x.pb(x2[i]-1);
x.pb(x2[i]);
y.pb(y1[i]);
if(y1[i]) y.pb(y1[i]-1);
y.pb(y2[i]-1);
y.pb(y2[i]);
}
x.pb(0); x.pb(w-1);
y.pb(0); y.pb(h-1);
sort(x.begin(),x.end());
sort(y.begin(),y.end());
x.erase(unique(x.begin(),x.end()),x.end());
y.erase(unique(y.begin(),y.end()),y.end());
for(int i=0;i<x.size();i++)
{
for(int j=0;j<y.size();j++)
{
f[i][j]=false;
}
}
for(int i=0;i<n;i++)
{
int a=lower_bound(x.begin(),x.end(),x1[i])-x.begin();
int b=lower_bound(x.begin(),x.end(),x2[i]-1)-x.begin();
int c=lower_bound(y.begin(),y.end(),y1[i])-y.begin();
int d=lower_bound(y.begin(),y.end(),y2[i]-1)-y.begin();
for(int j=a;j<=b;j++)
{
for(int k=c;k<=d;k++)
{
f[j][k]=true;
}
}
}
int ret=0;
for(int i=0;i<x.size();i++)
{
for(int j=0;j<y.size();j++)
{
if(!f[i][j])
{
ret++;
queue<P>que;
que.push(mp(i,j));
while(!que.empty())
{
P p=que.front();que.pop();
if(f[p.f][p.s]) continue;
f[p.f][p.s]=true;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
for(int k=0;k<4;k++)
{
int nx=p.f+dx[k];
int ny=p.s+dy[k];
if(!(0<=nx && nx<x.size())) continue;
if(!(0<=ny && ny<y.size())) continue;
if(f[nx][ny]) continue;
que.push(mp(nx,ny));
}
}
}
}
printf("%d\n",ret);
}
} | a.cc:32:21: error: 'int y1 [1005]' redeclared as different kind of entity
32 | int x1[1005],y1[1005],x2[1005],y2[1005],w,h,n;
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cstdio:41,
from a.cc:3:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:43:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | scanf("%d",&y1[i]);
| ^
a.cc:50:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
50 | y.pb(y1[i]);
| ^
a.cc:50:29: error: no matching function for call to 'push_back(double (&)(double) noexcept)'
50 | y.pb(y1[i]);
| ~~~~^~~~~~~
In file included from /usr/include/c++/14/vector:66,
from a.cc:11:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' (near match)
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: conversion of argument 1 would be ill-formed:
a.cc:50:34: error: invalid conversion from 'double (*)(double) noexcept' to 'std::vector<int>::value_type' {aka 'int'} [-fpermissive]
50 | y.pb(y1[i]);
| ~~~~^
| |
| double (*)(double) noexcept
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' (near match)
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: conversion of argument 1 would be ill-formed:
a.cc:50:34: error: invalid conversion from 'double (*)(double) noexcept' to 'std::vector<int>::value_type' {aka 'int'} [-fpermissive]
50 | y.pb(y1[i]);
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:51:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | if(y1[i]) y.pb(y1[i]-1);
| ^
a.cc:51:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | if(y1[i]) y.pb(y1[i]-1);
| ^
a.cc:51:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | if(y1[i]) y.pb(y1[i]-1);
| ~~~~~^~
a.cc:51:39: error: no matching function for call to 'push_back(double (*)(double) noexcept)'
51 | if(y1[i]) y.pb(y1[i]-1);
| ~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' (near match)
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: conversion of argument 1 would be ill-formed:
a.cc:51:45: error: invalid conversion from 'double (*)(double) noexcept' to 'std::vector<int>::value_type' {aka 'int'} [-fpermissive]
51 | if(y1[i]) y.pb(y1[i]-1);
| ~~~~~^~
| |
| double (*)(double) noexcept
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' (near match)
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: conversion of argument 1 would be ill-formed:
a.cc:51:45: error: invalid conversion from 'double (*)(double) noexcept' to 'std::vector<int>::value_type' {aka 'int'} [-fpermissive]
51 | if(y1[i]) y.pb(y1[i]-1);
| ~~~~~^~
| |
| double (*)(double) noexcept
a.cc:72:65: warning: pointer to a function used in arithmetic [-Wpointer-arith]
72 | int c=lower_bound(y.begin(),y.end(),y1[i])-y.begin();
| ^
a.cc:113:2: error: expected '}' at end of input
113 | }
| ^
a.cc:34:1: note: to match this '{'
34 | {
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from a.cc:6:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Value = double(double) noexcept]':
/usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Tp = double(double) noexcept; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1504 | if (__comp(__middle, __val))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Tp = double(double) noexcept]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:72:21: required from here
72 | int c=lower_bound(y.begin(),y.end(),y1[i])-y.begin();
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:69:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
|
s740854752 | p00454 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <iterator>
#include <bitset>
#include <random>
#include <assert.h>
#include <unordered_map>
#include <array>
#include <ctime>
#ifdef _MSC_VER
#include <agents.h>
#endif
#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second
#define MP make_pair
#define umap unordered_map
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
typedef unsigned int uint;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };
vector<vector<short>> field;
int w, h;
void bfs(int r, int c){
queue<P> q;
q.push(MP(r, c));
field[r][c] = 1;
while (!q.empty()){
int y = q.front().first;
int x = q.front().second;
q.pop();
for (int i = 0; i < 4; ++i){
int nx = x + dx[i], ny = y + dy[i];
if (nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
if (field[ny][nx]) continue;
field[ny][nx] = 1;
q.push(MP(ny, nx));
}
}
}
int main(){
while (cin >> w >> h, w|h){
int n;
cin >> n;
vector<int> x(n * 2), y(n * 2);
rep(i, n * 2){
cin >> x[i] >> y[i];
}
vector<int> vx = x, vy = y;
vx.emplace_back(0), vx.emplace_back(w);
vy.emplace_back(0), vy.emplace_back(h);
sort(ALL(vx));
vx.erase(unique(ALL(vx)), vx.end());
sort(ALL(vy));
vy.erase(unique(ALL(vy)), vy.end());
for (auto &e : x) e = lower_bound(ALL(vx), e) - vx.begin();
for (auto &e : y) e = lower_bound(ALL(vy), e) - vy.begin();
w = vx.back() - 1, h = vy.back() - 1;
field = vector<vector<int>>(h + 1, vector<int>(w + 1, 0));
rep(i, n){
++field[y[i * 2]][x[i * 2]];
--field[y[i * 2 + 1]][x[i * 2]];
--field[y[i * 2]][x[i * 2 + 1]];
++field[y[i * 2 + 1]][x[i * 2 + 1]];
}
rep(i, h) rep(j, w){
field[i + 1][j] += field[i][j];
field[i][j + 1] += field[i][j];
field[i + 1][j + 1] -= field[i][j];
}
int ans = 0;
rep(i, h) rep(j, w){
if (field[i][j]) continue;
bfs(i, j);
++ans;
//rep(i, h){
// rep(j, w) cout << field[i][j];
// cout << '\n';
//} cout << '\n';
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:94:73: error: no match for 'operator=' (operand types are 'std::vector<std::vector<short int> >' and 'std::vector<std::vector<int> >')
94 | field = vector<vector<int>>(h + 1, vector<int>(w + 1, 0));
| ^
In file included from /usr/include/c++/14/vector:72,
from a.cc:2:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<short int>; _Alloc = std::allocator<std::vector<short int> >]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'const std::vector<std::vector<short int> >&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<short int>; _Alloc = std::allocator<std::vector<short int> >]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::vector<std::vector<short int> >&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::vector<short int>; _Alloc = std::allocator<std::vector<short int> >]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::initializer_list<std::vector<short int> >'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
|
s047654300 | p00455 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(!sc.hasNext()) {
int sh=sc.nextInt();
int sm=sc.nextInt();
int ss=sc.nextInt();
int gh=sc.nextInt();
int gm=sc.nextInt();
int gs=sc.nextInt();
int zan=(gh*3600+gm*60+gs)-(sh*3600+sm*60+ss);
pl(zan/3600+" "+(zan%3600)/60+" "+zan%60);
}
}
public static void pl(Object o) {
System.out.println(o);
}
public static void pl() {
System.out.println();
}
public static void p(Object o) {
System.out.print(o);
}
static class SC {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public SC(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
}
| Main.java:10: error: cannot find symbol
Scanner sc=new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:10: error: cannot find symbol
Scanner sc=new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s483888209 | p00455 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()) {
int sh=sc.nextInt();
int sm=sc.nextInt();
int ss=sc.nextInt();
int gh=sc.nextInt();
int gm=sc.nextInt();
int gs=sc.nextInt();
int zan=(gh*3600+gm*60+gs)-(sh*3600+sm*60+ss);
pl(zan/3600+" "+(zan%3600)/60+" "+zan%60);
}
}
public static void pl(Object o) {
System.out.println(o);
}
public static void pl() {
System.out.println();
}
public static void p(Object o) {
System.out.print(o);
}
static class SC {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public SC(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
}
| Main.java:10: error: cannot find symbol
Scanner sc=new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:10: error: cannot find symbol
Scanner sc=new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s967768484 | p00455 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Solve s = new Solve();
s.solve();
}
}
class Solve{
Solve(){}
Scanner in = new Scanner(System.in);
void solve(){
int h1,m1,s1,h2,m2,s2;
for(int i = 0; i < 3; i++){
h1 = in.nextInt();
m1 = in.nextInt();
s1 = in.nextInt();
h2 = in.nextInt();
s2 = in.nextInt();
m2 = in.nextInt();
int a = tos(h2,s2,m2) - tos(h1,s1,m1);
System.out.print(a/3600);
a %= 3600;
System.out.print(" ");
System.out.print(a / 60);
a %= 60;
System.out.print(" ");
System.out.println(a);
}
}
int tos(int h, int m, int s){
int ret = 0;
ret += h * 3600;
ret += m *60;
ret += s;
}
} | Main.java:42: error: missing return statement
}
^
1 error
|
s445828131 | p00455 | Java | Scanner scan = new Scanner(System.in);
int[6] h,m,s;
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
} | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
Scanner scan = new Scanner(System.in);
^
(use --enable-preview to enable unnamed classes)
Main.java:2: error: class, interface, enum, or record expected
int[6] h,m,s;
^
Main.java:3: error: class, interface, enum, or record expected
for(int i=0;i<6;i++){
^
Main.java:3: error: class, interface, enum, or record expected
for(int i=0;i<6;i++){
^
Main.java:3: error: class, interface, enum, or record expected
for(int i=0;i<6;i++){
^
Main.java:5: error: class, interface, enum, or record expected
m[i] = scan.next();
^
Main.java:6: error: class, interface, enum, or record expected
s[i] = scan.next();
^
Main.java:7: error: class, interface, enum, or record expected
}
^
Main.java:8: error: class, interface, enum, or record expected
for(int i=1;i<6;i+=2){
^
Main.java:8: error: class, interface, enum, or record expected
for(int i=1;i<6;i+=2){
^
Main.java:9: error: class, interface, enum, or record expected
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
^
Main.java:9: error: class, interface, enum, or record expected
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
^
Main.java:10: error: class, interface, enum, or record expected
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
^
Main.java:10: error: class, interface, enum, or record expected
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
^
Main.java:12: error: class, interface, enum, or record expected
}
^
Main.java:13: error: class, interface, enum, or record expected
for(int i=1;i<6;i+=2){
^
Main.java:13: error: class, interface, enum, or record expected
for(int i=1;i<6;i+=2){
^
Main.java:15: error: class, interface, enum, or record expected
}
^
18 errors
|
s966834096 | p00455 | Java | import java.util.Scanner;
class AOJ0532{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int[6] h,m,s;
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:5: error: ']' expected
int[6] h,m,s;
^
Main.java:5: error: not a statement
int[6] h,m,s;
^
Main.java:5: error: not a statement
int[6] h,m,s;
^
Main.java:5: error: ';' expected
int[6] h,m,s;
^
Main.java:5: error: not a statement
int[6] h,m,s;
^
Main.java:5: error: ';' expected
int[6] h,m,s;
^
Main.java:5: error: not a statement
int[6] h,m,s;
^
7 errors
|
s501698890 | p00455 | Java | import java.util.Scanner;
class Main{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int[6] h,m,s;
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:6: error: ']' expected
int[6] h,m,s;
^
Main.java:6: error: not a statement
int[6] h,m,s;
^
Main.java:6: error: not a statement
int[6] h,m,s;
^
Main.java:6: error: ';' expected
int[6] h,m,s;
^
Main.java:6: error: not a statement
int[6] h,m,s;
^
Main.java:6: error: ';' expected
int[6] h,m,s;
^
Main.java:6: error: not a statement
int[6] h,m,s;
^
7 errors
|
s074728037 | p00455 | Java | import java.util.Scanner;
class Main{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int[6] h;int[6] m;int[6] s;
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:6: error: ']' expected
int[6] h;int[6] m;int[6] s;
^
Main.java:6: error: not a statement
int[6] h;int[6] m;int[6] s;
^
Main.java:6: error: not a statement
int[6] h;int[6] m;int[6] s;
^
Main.java:6: error: ']' expected
int[6] h;int[6] m;int[6] s;
^
Main.java:6: error: not a statement
int[6] h;int[6] m;int[6] s;
^
Main.java:6: error: not a statement
int[6] h;int[6] m;int[6] s;
^
Main.java:6: error: ']' expected
int[6] h;int[6] m;int[6] s;
^
Main.java:6: error: not a statement
int[6] h;int[6] m;int[6] s;
^
Main.java:6: error: not a statement
int[6] h;int[6] m;int[6] s;
^
9 errors
|
s344718604 | p00455 | Java | import java.util.Scanner;
class Main{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int[] h = new int[6];
int[] m = new int[6];
int[] s = new int[6];
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:6: error: illegal character: '\u3000'
int[] h?= new int[6];
^
Main.java:6: error: not a statement
int[] h?= new int[6];
^
Main.java:7: error: illegal character: '\u3000'
int[] m?= new int[6];
^
Main.java:7: error: not a statement
int[] m?= new int[6];
^
Main.java:8: error: illegal character: '\u3000'
int[] s?= new int[6];
^
Main.java:8: error: not a statement
int[] s?= new int[6];
^
6 errors
|
s600933668 | p00455 | Java | import java.util.Scanner;
class Main{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
h = new int[6];
m = new int[6];
s = new int[6];
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:6: error: illegal character: '\u3000'
h?= new int[6];
^
Main.java:6: error: not a statement
h?= new int[6];
^
Main.java:6: error: not a statement
h?= new int[6];
^
Main.java:7: error: illegal character: '\u3000'
m?= new int[6];
^
Main.java:7: error: not a statement
m?= new int[6];
^
Main.java:7: error: not a statement
m?= new int[6];
^
Main.java:8: error: illegal character: '\u3000'
s?= new int[6];
^
Main.java:8: error: not a statement
s?= new int[6];
^
Main.java:8: error: not a statement
s?= new int[6];
^
9 errors
|
s715443273 | p00455 | Java | import java.util.Scanner;
class Main{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int[] h = new int[6];
int[] m = new int[6];
int[] s = new int[6];
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:6: error: illegal character: '\u3000'
int[] h?= new int[6];
^
Main.java:6: error: not a statement
int[] h?= new int[6];
^
Main.java:7: error: illegal character: '\u3000'
int[] m?= new int[6];
^
Main.java:7: error: not a statement
int[] m?= new int[6];
^
Main.java:8: error: illegal character: '\u3000'
int[] s?= new int[6];
^
Main.java:8: error: not a statement
int[] s?= new int[6];
^
6 errors
|
s568660517 | p00455 | Java | import java.util.Scanner;
class Main{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int h[] = new int[6];
int m[] = new int[6];
int s[] = new int[6];
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:6: error: illegal character: '\u3000'
int h[]?= new int[6];
^
Main.java:6: error: not a statement
int h[]?= new int[6];
^
Main.java:7: error: illegal character: '\u3000'
int m[]?= new int[6];
^
Main.java:7: error: not a statement
int m[]?= new int[6];
^
Main.java:8: error: illegal character: '\u3000'
int s[]?= new int[6];
^
Main.java:8: error: not a statement
int s[]?= new int[6];
^
6 errors
|
s041001093 | p00455 | Java | import java.util.Scanner;
class Main{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int[] h,m,s;
h = new int[6];
m = new int[6];
s = new int[6];
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:7: error: illegal character: '\u3000'
h?= new int[6];
^
Main.java:7: error: not a statement
h?= new int[6];
^
Main.java:7: error: not a statement
h?= new int[6];
^
Main.java:8: error: illegal character: '\u3000'
m?= new int[6];
^
Main.java:8: error: not a statement
m?= new int[6];
^
Main.java:8: error: not a statement
m?= new int[6];
^
Main.java:9: error: illegal character: '\u3000'
s?= new int[6];
^
Main.java:9: error: not a statement
s?= new int[6];
^
Main.java:9: error: not a statement
s?= new int[6];
^
9 errors
|
s013536651 | p00455 | Java | import java.util.Scanner;
class public Main{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int[] h,m,s;
h = new int[6];
m = new int[6];
s = new int[6];
for(int i=0;i<6;i++){
h[i] = scan.next();
m[i] = scan.next();
s[i] = scan.next();
}
for(int i=1;i<6;i+=2){
if((s[i]-=s[i-1])<0){s[i]=60-s[i];m[i]-=1;}
if((m[i]-=m[i-1])<0){m[i]=60-b[i];h[i]-=1;}
h[i]-=h[i-1];
}
for(int i=1;i<6;i+=2){
System.out.println(h[i]+" "+m[i]+" "+s[i]);
}
}
} | Main.java:3: error: <identifier> expected
class public Main{
^
Main.java:3: error: class, interface, enum, or record expected
class public Main{
^
Main.java:7: error: illegal character: '\u3000'
h?= new int[6];
^
Main.java:7: error: not a statement
h?= new int[6];
^
Main.java:7: error: not a statement
h?= new int[6];
^
Main.java:8: error: illegal character: '\u3000'
m?= new int[6];
^
Main.java:8: error: not a statement
m?= new int[6];
^
Main.java:8: error: not a statement
m?= new int[6];
^
Main.java:9: error: illegal character: '\u3000'
s?= new int[6];
^
Main.java:9: error: not a statement
s?= new int[6];
^
Main.java:9: error: not a statement
s?= new int[6];
^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String args[]){
^
(use --enable-preview to enable unnamed classes)
Main.java:24: error: class, interface, enum, or record expected
}
^
13 errors
|
s713408884 | p00455 | C | #include <stdio.h>
int main(){
int sh,sm,ss,th,tm,ts,h,m,s,ks,ps,x;
for (i = 1;i <= 3;i++){
scanf("%d %d %d %d %d %d",&sh,&sm,&ss,&th,&tm,&ts);
ks = sh*60*60+sm*60+ss;
ps = th*60*60+tm*60+ts;
x=ps-ks;
h=x/3600;
m=(x-h*3600)/60;
s=x-h*3600-m*60;
}
return0;
} | main.c: In function 'main':
main.c:6:6: error: 'i' undeclared (first use in this function)
6 | for (i = 1;i <= 3;i++){
| ^
main.c:6:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:1: error: 'return0' undeclared (first use in this function)
19 | return0;
| ^~~~~~~
|
s769101579 | p00455 | C | #include <stdio.h>
int main(){
int sh,sm,ss,th,tm,ts,h,m,s,ks,ps,x,i;
for (i = 1;i <= 3;i++){
scanf("%d %d %d %d %d %d",&sh,&sm,&ss,&th,&tm,&ts);
ks = sh*60*60+sm*60+ss;
ps = th*60*60+tm*60+ts;
x=ps-ks;
h=x/3600;
m=(x-h*3600)/60;
s=x-h*3600-m*60;
}
return0;
} | main.c: In function 'main':
main.c:19:1: error: 'return0' undeclared (first use in this function)
19 | return0;
| ^~~~~~~
main.c:19:1: note: each undeclared identifier is reported only once for each function it appears in
|
s912774130 | p00455 | C | #include <stdio.h>
int main()
{
int ah, am, as, bh, bm, bs, h, m, s;
scanf_s("%d%d%d", &ah, &am, &as);
as = 3600 * ah + 60 * am + as;
scanf_s("%d%d%d", &bh, &bm, &bs);
bs = bh * 3600 + bm * 60 + bs;
h = (bs - as) / 3600;
m = ((bs - as) % 3600) / 60;
s = ((bs - as) % 3600) % 60;
printf("%d %d %d", h, m, s);
return 0;
} | main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
6 | scanf_s("%d%d%d", &ah, &am, &as);
| ^~~~~~~
| scanf
|
s618479390 | p00455 | C | #include <stdio.h>
int main(){
int h[3][2],m[3][2],s[3][2],i,k,koh[3],kom[3],kos[3];
for(k=0;k<3;k++){
scanf("%d %d %d %d %d %d",&h[k][0],&m[k][0],&s[k][0],&h[k][1],&m[k][1],&s[k][1]);
if(k<=2){printf("\n");}}
for(i=0;i<3;i++){
if(s[i][0]<=s[i][1]){
kos[i]=s[i][1]-s[i][0];
}
else{kos[i]=s[i][1]+60-s[i][0]; kom[i]--;}
if(m[i][0]<=m[i][1]){
kom[i]=m[i][1]-m[i][0];
}
else{kom[i]=m[i][1]+60-m[i][0]; koh[i]--;}
koh[i]=h[i][1]-h[i][0];
prinf("%d %d %d\n",koh[i],kom[i],kos[i]);
}
return 0;
} | main.c: In function 'main':
main.c:25:1: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
25 | prinf("%d %d %d\n",koh[i],kom[i],kos[i]);
| ^~~~~
| printf
|
s141299346 | p00455 | C | #include "stdafx.h"
#include "stdio.h"
typedef struct {
int Arrive[3];
int Leave[3];
}Time;
void timecal(int arrive[3], int leave[3], int result[3])
{
int temp;
for (temp = 2; temp > 0; temp--) {
result[temp] = (leave[temp] - arrive[temp]);
if (result[temp] < 0) {
result[temp] = 60 + result[temp];
leave[temp - 1]--;
}
result[0] = leave[0] - arrive[0];
}
}
int main(void) {
int temp;
int res1[3], res2[3], res3[3];
Time A;
Time B;
Time C;
for (temp = 0; temp < 3; temp++)
{
scanf("%d", &A.Arrive[temp]);
}
for (temp = 0; temp < 3; temp++) {
scanf("%d", &A.Leave[temp]);
}
for (temp = 0; temp < 3; temp++)
{
scanf("%d", &B.Arrive[temp]);
}
for (temp = 0; temp < 3; temp++) {
scanf("%d", &B.Leave[temp]);
}
for (temp = 0; temp < 3; temp++)
{
scanf("%d", &C.Arrive[temp]);
}
for (temp = 0; temp < 3; temp++) {
scanf("%d", &C.Leave[temp]);
}
timecal(A.Arrive, A.Leave,res1);
printf("%d%d%d", res1[0], res1[1], res1[2]);
timecal(B.Arrive, B.Leave,res2);
printf("%d%d%d", res2[0], res2[1], res2[2]);
timecal(C.Arrive, C.Leave,res3);
printf("%d%d%d", res3[0], res3[1], res3[2]);
return 0;
} | main.c:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s905896892 | p00455 | C | #include <stdio.h>
int main(){
int h1[3],m1[3],s1[3];
int h2[3],m2[3],s2[3];
int h[3],m[3],s[3];
int i;
for(i=0;i<3;i++){
scanf("%d%d%d%d%d%d",&h1[i],&m1[i],&s1[i]",&h2[i],&m2[i],&s2[i]);
}
for(i=0;i<3;i++){
int x[3];
int y[3];
y[i]=h2[i]*3600+m2[i]*60+s2[i];
x[i]=h1[i]*3600+m1[i]*60+s1[i];
int z[3];
z[i]=y[i]-x[i];
h[i]=z[i]/3600;
z[i] -= h[i]*3600;
m[i] = z[i]/60;
z[i] -= m[i]*60;
s[i] = z[i];
printf("%d%d%d\n",h[i],m[i],s[i]);
}
return 0;
} | main.c: In function 'main':
main.c:8:54: warning: missing terminating " character
8 | scanf("%d%d%d%d%d%d",&h1[i],&m1[i],&s1[i]",&h2[i],&m2[i],&s2[i]);
| ^
main.c:8:54: error: missing terminating " character
8 | scanf("%d%d%d%d%d%d",&h1[i],&m1[i],&s1[i]",&h2[i],&m2[i],&s2[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:8:54: error: expected ')' before '}' token
8 | scanf("%d%d%d%d%d%d",&h1[i],&m1[i],&s1[i]",&h2[i],&m2[i],&s2[i]);
| ~ ^
| )
9 | }
| ~
main.c:8:54: error: expected ';' before '}' token
8 | scanf("%d%d%d%d%d%d",&h1[i],&m1[i],&s1[i]",&h2[i],&m2[i],&s2[i]);
| ^
| ;
9 | }
| ~
|
s524203788 | p00455 | C | #include<stdio.h>
int main(){
int a;
int b;
int c;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
if(b1 == 1){
if(b2 == 1){
printf("Open\n");
}else{
printf("Close\n");
}
}else{
if(b3 == 1){
printf("Open\n");
}else{
printf("Close\n");
}
}
return 0;
} | main.c: In function 'main':
main.c:10:12: error: 'b1' undeclared (first use in this function); did you mean 'b'?
10 | if(b1 == 1){
| ^~
| b
main.c:10:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:20: error: 'b2' undeclared (first use in this function); did you mean 'b'?
11 | if(b2 == 1){
| ^~
| b
main.c:17:20: error: 'b3' undeclared (first use in this function); did you mean 'b'?
17 | if(b3 == 1){
| ^~
| b
|
s415330249 | p00455 | C | #include <stdio.h>
int main(){
int toki[3],tokide[3],fun[3],funde[3],byou[3],byoude[3];
int i,f,t;
int kekkat[3],kekkaf[3],kekkab[3];
for(i=0;i<3;i++){
scanf("%d %d %d %d %d %d",&toki[i],&fun[i],&byou[i],&tokide[i],&funde[i],&byoude[i]);
}
for(i=0;i<3;i++){
f=0;
t=0;
kekkab[i]=byoude[i]-byou[i];
if(kekkab[i]<0){
kekkab[i]=60+kekkab[i];
f++;
}
kekkaf[i]=funde[i]-fun[i]-f;
if(kakkaf[i]<0){
kekkaf[i]=60+kakkaf[i];
t++;
}
kekkat[i]=tokide[i]-toki[i]-t;
printf("%d %d %d\n",kekkat[i],kekkaf[i],kekkab[i]);
}
return 0;
} | main.c: In function 'main':
main.c:20:4: error: 'kakkaf' undeclared (first use in this function); did you mean 'kekkaf'?
20 | if(kakkaf[i]<0){
| ^~~~~~
| kekkaf
main.c:20:4: note: each undeclared identifier is reported only once for each function it appears in
|
s397044610 | p00455 | C | #include <stdio.h>
int main(){
int toki[3],tokide[3],fun[3],funde[3],byou[3],byoude[3];
int i,f,t;
int kekkat[3],kekkaf[3],kekkab[3];
for(i=0;i<3;i++){
scanf("%d %d %d %d %d %d",&toki[i],&fun[i],&byou[i],&tokide[i],&funde[i],&byoude[i]);
}
for(i=0;i<3;i++){
f=0;
t=0;
kekkab[i]=byoude[i]-byou[i];
if(kekkab[i]<0){
kekkab[i]=60+kekkab[i];
f++;
}
kekkaf[i]=funde[i]-fun[i]-f;
if(kekkaf[i]<0){
kekkaf[i]=60+kakkaf[i];
t++;
}
kekkat[i]=tokide[i]-toki[i]-t;
printf("%d %d %d\n",kekkat[i],kekkaf[i],kekkab[i]);
}
return 0;
} | main.c: In function 'main':
main.c:21:14: error: 'kakkaf' undeclared (first use in this function); did you mean 'kekkaf'?
21 | kekkaf[i]=60+kakkaf[i];
| ^~~~~~
| kekkaf
main.c:21:14: note: each undeclared identifier is reported only once for each function it appears in
|
s700097334 | p00455 | C | #include<stdio.h>
int main(void)
{
int h1,h2,h3,m1,m2,m3,s1,s2,s3;
for(i=1;i<=3;i++) {
scanf("%d %d %d %d %d %d",&h1,&m1,&s1,&h2,&m2,&s2);
s3=s2-s1;
m3=m2-m1;
h3=h2-h1;
if(s3<0) {
m3--;
s3+=60;
}
if(m3<0) {
h3--;
m3+=60;
}
printf("%d %d %d\n",h3,m3,s3);
}
return 0;
} | main.c: In function 'main':
main.c:5:13: error: 'i' undeclared (first use in this function)
5 | for(i=1;i<=3;i++) {
| ^
main.c:5:13: note: each undeclared identifier is reported only once for each function it appears in
|
s241394929 | p00455 | C | #include <stdio.h>
int main(){
int time[3][9]= {{0},{0}}, i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 6; j++) {
scanf("%d", &time[i][j]);
}
}
for (i = 0; i < 3; i++) {
if ((time[i][8] += time[i][5] - time[i][2]) < 0){
time[i][8] += 60;
time[i][7] -= 1;
}
if((time[i][7] += time[i][4] - time[i][1]) < 0){
time[i][7] += 60;
time[i][6] -= 1;
}
time[i][6] += time[i][3] - time[i][0];
}
for (i = 0; i < 3; i++)
printf("%d %d %d\n", time[i][6], time[i][7], time[i][8])
return 0;
} | main.c: In function 'main':
main.c:25:65: error: expected ';' before 'return'
25 | printf("%d %d %d\n", time[i][6], time[i][7], time[i][8])
| ^
| ;
26 |
27 | return 0;
| ~~~~~~
|
s815017749 | p00455 | C | #include<stdio.h>
int main(void)
{
int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J;
scanf("%d %d %d %d %d %d\n%d %d %d %d %d %d\n%d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f,&G,&H,&i,&j,&k,&l,&m,&n,&o,&p,&q,&r);
s=3600*a+60*b+c;t=3600*d+60*e+f;u=3600*g+60*h+i;v=3600*j+60*k+l;W=3600*m+60*n+o;x=3600*p+60*q+r;
y=t-x;z=v-u;A=x-w;
B=y/3600;C=y/60-B*60;D=y-B*3600-C*60;
E=z/3600;F=z/60-E*60;G=z-E*3600-F*60;
H=A/3600;I=A/60-H*60;J=A-H*3600-I*60;
printf("%d %d %d\n%d %d %d\n%d %d %d\n",B,C,D,E,F,G,H,I,J);
return 0;
} | main.c: In function 'main':
main.c:6:69: error: 'W' undeclared (first use in this function)
6 | s=3600*a+60*b+c;t=3600*d+60*e+f;u=3600*g+60*h+i;v=3600*j+60*k+l;W=3600*m+60*n+o;x=3600*p+60*q+r;
| ^
main.c:6:69: note: each undeclared identifier is reported only once for each function it appears in
|
s669084328 | p00455 | C++ | #include<iostream>
int main() {
cout<<"hello"<<endl;
} | a.cc: In function 'int main()':
a.cc:4:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
4 | cout<<"hello"<<endl;
| ^~~~
| std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:4:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
4 | cout<<"hello"<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s005977930 | p00455 | C++ | #include<iostream>
int main() {
std::cout<<"hello"<<endl;
} | a.cc: In function 'int main()':
a.cc:4:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
4 | std::cout<<"hello"<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s000609962 | p00455 | C++ | #include "stdafx.h"
#include <iostream>
using namespace std;
long getLongTime(int* t) {
long longt = 0;
longt += 60 * 60 * t[0];
longt += 60 * t[1];
longt += t[2];
return longt;
}
void getFormattedTime(long longt, int* t) {
t[0] = longt / (60 * 60);
longt -= t[0] * (60 * 60);
t[1] = longt / 60;
longt -= t[1] * 60;
t[2] = longt;
}
int main(void){
int times[3][2][3];
long longTime[3][3];
int workTime[3][3];
for (int i = 0; i < 3; i++) {
cin >> times[i][0][0] >> times[i][0][1] >> times[i][0][2] >> times[i][1][0] >> times[i][1][1] >> times[i][1][2];
longTime[i][0] = getLongTime(times[i][0]);
longTime[i][1] = getLongTime(times[i][1]);
longTime[i][2] = longTime[i][1] - longTime[i][0];
getFormattedTime(longTime[i][2], workTime[i]);
}
for (int i = 0; i < 3; i++) {
cout << workTime[i][0] << " " << workTime[i][1] << " " << workTime[i][2] << endl;
}
} | a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s816307216 | p00455 | C++ | #incude<iostream>
using namespace std;
int main(){
int h1,h2,m1,m2,s1,s2,sum1=0,sum2=0;
cin>>h1>>m1>>s1>>h2>>m2>>s2;
sum1=3600*h1+60*m1+s1;
sum2=3600*h2+60*m2+s2;
sum2-=sum1;
h2=sum2/3600;m2=(sum2%3600)/60;s2=(sum2%3600)%60;
cout<<h2<<" "<<m2<<" "<<s2<<endl;
sum1=0,sum2=0;
cin>>h1>>m1>>s1>>h2>>m2>>s2;
sum1=3600*h1+60*m1+s1;
sum2=3600*h2+60*m2+s2;
sum2-=sum1;
h2=sum2/3600;m2=(sum2%3600)/60;s2=(sum2%3600)%60;
cout<<h2<<" "<<m2<<" "<<s2<<endl;
sum1=0,sum2=0;
cin>>h1>>m1>>s1>>h2>>m2>>s2;
sum1=3600*h1+60*m1+s1;
sum2=3600*h2+60*m2+s2;
sum2-=sum1;
h2=sum2/3600;m2=(sum2%3600)/60;s2=(sum2%3600)%60;
cout<<h2<<" "<<m2<<" "<<s2<<endl;
sum1=0,sum2=0;
return 0;
} | a.cc:1:2: error: invalid preprocessing directive #incude; did you mean #include?
1 | #incude<iostream>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:6:1: error: 'cin' was not declared in this scope
6 | cin>>h1>>m1>>s1>>h2>>m2>>s2;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #incude<iostream>
a.cc:11:1: error: 'cout' was not declared in this scope
11 | cout<<h2<<" "<<m2<<" "<<s2<<endl;
| ^~~~
a.cc:11:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:11:29: error: 'endl' was not declared in this scope
11 | cout<<h2<<" "<<m2<<" "<<s2<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #incude<iostream>
|
s344725836 | p00455 | C++ | int main()
{
for (int i = 0; i < 3; i++){
int hin, min, sin, hout, mout, sout, total;
cin >> hin >> min >> sin >> hout >> mout >> sout;
total = hout * 3600 + mout * 60 + sout - hin * 3600 - min * 60 - sin;
cout << hin / 3600 << " " << (total % 3600) / 60 << " " << st << total%60;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:5:17: error: 'cin' was not declared in this scope; did you mean 'sin'?
5 | cin >> hin >> min >> sin >> hout >> mout >> sout;
| ^~~
| sin
a.cc:9:17: error: 'cout' was not declared in this scope; did you mean 'sout'?
9 | cout << hin / 3600 << " " << (total % 3600) / 60 << " " << st << total%60;
| ^~~~
| sout
a.cc:9:76: error: 'st' was not declared in this scope; did you mean 'std'?
9 | cout << hin / 3600 << " " << (total % 3600) / 60 << " " << st << total%60;
| ^~
| std
|
s405279615 | p00455 | C++ | int main()
{
for (int i = 0; i < 3; i++){
int hin, min, sin, hout, mout, sout, total;
cin >> hin >> min >> sin >> hout >> mout >> sout;
total = hout * 3600 + mout * 60 + sout - hin * 3600 - min * 60 - sin;
cout << hin / 3600 << " " << (total % 3600) / 60 << " " << total%60;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:5:17: error: 'cin' was not declared in this scope; did you mean 'sin'?
5 | cin >> hin >> min >> sin >> hout >> mout >> sout;
| ^~~
| sin
a.cc:9:17: error: 'cout' was not declared in this scope; did you mean 'sout'?
9 | cout << hin / 3600 << " " << (total % 3600) / 60 << " " << total%60;
| ^~~~
| sout
|
s843313785 | p00455 | C++ | #include<iostream>
using namespace std;
int main()
{
int i,a,b,c,A,B,C,x,y,z,i;
for(i=0;i<3;i++){
cout>>a>>b>>c>>A>>B>>C;
i=(3600*A+60*B+C)-(3600*a+60*b+c);
x=i/3600;
y=(i-3600*x)/60;
z=i-(3600*x+60*y)
cout<<x<<' '<<y<<' '<<z<<'\n';
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:25: error: redeclaration of 'int i'
6 | int i,a,b,c,A,B,C,x,y,z,i;
| ^
a.cc:6:5: note: 'int i' previously declared here
6 | int i,a,b,c,A,B,C,x,y,z,i;
| ^
a.cc:8:5: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
8 | cout>>a>>b>>c>>A>>B>>C;
| ~~~~^~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:8:5: note: candidate: 'operator>>(int, int)' (built-in)
8 | cout>>a>>b>>c>>A>>B>>C;
| ~~~~^~~
a.cc:8:5: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:8:1: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]':
a.cc:8:7: required from here
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
a.cc:12:18: error: expected ';' before 'cout'
12 | z=i-(3600*x+60*y)
| ^
| ;
13 | cout<<x<<' '<<y<<' '<<z<<'\n';
| ~~~~
|
s946700230 | p00455 | C++ | #include<iostream>
using namespace std;
int main()
{
int i,a,b,c,A,B,C,x,y,z,i;
for(i=0;i<3;i++){
cout>>a>>b>>c>>A>>B>>C;
i=(3600*A+60*B+C)-(3600*a+60*b+c);
x=i/3600;
y=(i-3600*x)/60;
z=i-(3600*x+60*y);
cout<<x<<' '<<y<<' '<<z<<'\n';
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:25: error: redeclaration of 'int i'
6 | int i,a,b,c,A,B,C,x,y,z,i;
| ^
a.cc:6:5: note: 'int i' previously declared here
6 | int i,a,b,c,A,B,C,x,y,z,i;
| ^
a.cc:8:5: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
8 | cout>>a>>b>>c>>A>>B>>C;
| ~~~~^~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:8:5: note: candidate: 'operator>>(int, int)' (built-in)
8 | cout>>a>>b>>c>>A>>B>>C;
| ~~~~^~~
a.cc:8:5: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:8:1: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]':
a.cc:8:7: required from here
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s546277926 | p00455 | C++ | #include<iostream>
using namespace std;
int main()
{
int i,a,b,c,A,B,C,x,y,z,i;
for(i=0;i<3;i++){
cout>>a>>b>>c>>A>>B>>C;
i=(3600*A+60*B+C)-(3600*a+60*b+c);
x=i/3600;
y=(i-3600*x)/60;
z=i-(3600*x+60*y);
cout<<x<<' '<<y<<' '<<z<<'\n';
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:25: error: redeclaration of 'int i'
6 | int i,a,b,c,A,B,C,x,y,z,i;
| ^
a.cc:6:5: note: 'int i' previously declared here
6 | int i,a,b,c,A,B,C,x,y,z,i;
| ^
a.cc:8:5: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
8 | cout>>a>>b>>c>>A>>B>>C;
| ~~~~^~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:8:5: note: candidate: 'operator>>(int, int)' (built-in)
8 | cout>>a>>b>>c>>A>>B>>C;
| ~~~~^~~
a.cc:8:5: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:8:1: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:8:7: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]':
a.cc:8:7: required from here
8 | cout>>a>>b>>c>>A>>B>>C;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s508084951 | p00455 | C++ | #include<iostream>
using namespace std;
int main(){
for(int i=0;i++i<3){
int h1,m1,s1,h2,m2,s2,ans;
cin>>h1>>m1>>s1>>h2>>m2>>s2;
ans = ((h2*3600)+(m2*60)+s2)-((h1*3600)+(m1*60)+s1);
cout<<ans/3600<<" " <<(ans%3600)/60<<" "<<(ans%3600)%60;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:4:16: error: expected ';' before 'i'
4 | for(int i=0;i++i<3){
| ^
| ;
|
s647974058 | p00455 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[6];
for(int b=0;b<3;b++){
for(int c=0;c<6;c++)scanf("%d",&a[c]);
int d=(a[3]-a[0])*3600+(a[4]-a[1])*60+(a[5]-a[2]);
printf("%d %d %d\n",d/3600,d%3600/60,d%3600%60)
}
} | a.cc: In function 'int main()':
a.cc:9:64: error: expected ';' before '}' token
9 | printf("%d %d %d\n",d/3600,d%3600/60,d%3600%60)
| ^
| ;
10 | }
| ~
|
s881985710 | p00455 | C++ | #include <array>
#include <utility>
#include <iostream>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;
using std::pair;
using std::array;
using std::for_each;
using time = struct _time {int h,m,s;}; // type of time
using emp = pair<time,time>; // type of employee
time operator-(time t1,time t2) {
time delta_time;
int borrow = 0;
delta_time.s = t1.s - t2.s;
if (delta_time.s < 0) {
delta_time.s += 60;
borrow = 1;
}
delta_time.m = t1.m - t2.m - borrow;
if (delta_time.m < 0) {
delta_time.m += 60;
borrow = 1;
} else {
borrow = 0;
}
delta_time.h = t1.h - t2.h - borrow;
return delta_time;
}
int main() {
array<emp,3> emps;
for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
for (auto e : emps) {
time delta_time = e.second - e.first;
cout << delta_time.h << " " << delta_time.m << " " << delta_time.s << endl;
}
} | a.cc:13:39: error: 'using time = struct _time' redeclared as different kind of entity
13 | using time = struct _time {int h,m,s;}; // type of time
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:3:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc:14:27: error: type/value mismatch at argument 1 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
14 | using emp = pair<time,time>; // type of employee
| ^
a.cc:14:27: note: expected a type, got 'time'
a.cc:14:27: error: type/value mismatch at argument 2 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
a.cc:14:27: note: expected a type, got 'time'
a.cc:16:1: error: 'time' does not name a type
16 | time operator-(time t1,time t2) {
| ^~~~
a.cc:5:1: note: 'time' is defined in header '<ctime>'; this is probably fixable by adding '#include <ctime>'
4 | #include <algorithm>
+++ |+#include <ctime>
5 |
a.cc: In function 'int main()':
a.cc:36:15: error: 'emp' was not declared in this scope
36 | array<emp,3> emps;
| ^~~
a.cc:36:20: error: template argument 1 is invalid
36 | array<emp,3> emps;
| ^
a.cc:37:23: error: request for member 'begin' in 'emps', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~
a.cc:37:36: error: request for member 'end' in 'emps', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~
a.cc:37:45: error: 'emp' is not a type
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~
a.cc: In lambda function:
a.cc:37:62: error: request for member 'first' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~
a.cc:37:75: error: request for member 'first' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~
a.cc:37:88: error: request for member 'first' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~
a.cc:37:101: error: request for member 'second' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~~
a.cc:37:115: error: request for member 'second' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~~
a.cc:37:129: error: request for member 'second' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~~
a.cc: In function 'int main()':
a.cc:38:23: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
38 | for (auto e : emps) {
| ^~~~
| std::begin
In file included from /usr/include/c++/14/array:44,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
| ^~~~~
a.cc:38:23: error: 'end' was not declared in this scope; did you mean 'std::end'?
38 | for (auto e : emps) {
| ^~~~
| std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc:39:21: error: expected ';' before 'delta_time'
39 | time delta_time = e.second - e.first;
| ^~~~~~~~~~~
| ;
a.cc:40:25: error: 'delta_time' was not declared in this scope
40 | cout << delta_time.h << " " << delta_time.m << " " << delta_time.s << endl;
| ^~~~~~~~~~
|
s679717636 | p00455 | C++ | #include <array>
#include <utility>
#include <iostream>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;
using std::pair;
using std::array;
using std::for_each;
using time = struct _time {int h,m,s;}; // type of time
using emp = pair<time,time>; // type of employee
time operator-(time t1,time t2) {
time delta_time;
int borrow = 0;
delta_time.s = t1.s - t2.s;
if (delta_time.s < 0) {
delta_time.s += 60;
borrow = 1;
}
delta_time.m = t1.m - t2.m - borrow;
if (delta_time.m < 0) {
delta_time.m += 60;
borrow = 1;
} else {
borrow = 0;
}
delta_time.h = t1.h - t2.h - borrow;
return delta_time;
}
int main() {
array<emp,3> emps;
for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
for (auto e : emps) {
time delta_time = e.second - e.first;
cout << delta_time.h << " " << delta_time.m << " " << delta_time.s << endl;
}
} | a.cc:13:39: error: 'using time = struct _time' redeclared as different kind of entity
13 | using time = struct _time {int h,m,s;}; // type of time
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:3:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc:14:27: error: type/value mismatch at argument 1 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
14 | using emp = pair<time,time>; // type of employee
| ^
a.cc:14:27: note: expected a type, got 'time'
a.cc:14:27: error: type/value mismatch at argument 2 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
a.cc:14:27: note: expected a type, got 'time'
a.cc:16:1: error: 'time' does not name a type
16 | time operator-(time t1,time t2) {
| ^~~~
a.cc:5:1: note: 'time' is defined in header '<ctime>'; this is probably fixable by adding '#include <ctime>'
4 | #include <algorithm>
+++ |+#include <ctime>
5 |
a.cc: In function 'int main()':
a.cc:36:15: error: 'emp' was not declared in this scope
36 | array<emp,3> emps;
| ^~~
a.cc:36:20: error: template argument 1 is invalid
36 | array<emp,3> emps;
| ^
a.cc:37:23: error: request for member 'begin' in 'emps', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~
a.cc:37:36: error: request for member 'end' in 'emps', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~
a.cc:37:45: error: 'emp' is not a type
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~
a.cc: In lambda function:
a.cc:37:62: error: request for member 'first' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~
a.cc:37:75: error: request for member 'first' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~
a.cc:37:88: error: request for member 'first' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~
a.cc:37:101: error: request for member 'second' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~~
a.cc:37:115: error: request for member 'second' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~~
a.cc:37:129: error: request for member 'second' in 'e', which is of non-class type 'int'
37 | for_each(emps.begin(),emps.end(),[](emp &e){cin >> e.first.h >> e.first.m >> e.first.s >> e.second.h >> e.second.m >> e.second.s;});
| ^~~~~~
a.cc: In function 'int main()':
a.cc:38:23: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
38 | for (auto e : emps) {
| ^~~~
| std::begin
In file included from /usr/include/c++/14/array:44,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
| ^~~~~
a.cc:38:23: error: 'end' was not declared in this scope; did you mean 'std::end'?
38 | for (auto e : emps) {
| ^~~~
| std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc:39:21: error: expected ';' before 'delta_time'
39 | time delta_time = e.second - e.first;
| ^~~~~~~~~~~
| ;
a.cc:40:25: error: 'delta_time' was not declared in this scope
40 | cout << delta_time.h << " " << delta_time.m << " " << delta_time.s << endl;
| ^~~~~~~~~~
|
s797199396 | p00455 | C++ | 7 0 0 7 0 1
7 0 1 7 1 0
7 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 7 0 0 7 0 1
| ^
|
s046815859 | p00455 | C++ | #include <iostream>
using namespace std;
int main(void)
{
int a,b,c,d,e,f,g,h,i,j,k;
for (a=0;a<3;a++)
{
cin>>b>>c>>d>>e>>f>>g;
h=e-b;
j=g-d;
if (j<0)
{
j=60+j;
i=i-1;
}
i=f-c;
}
if (i<0)
{
i=60+i;
h=h-1;
}
cout<<h<<" "<<i<<" "<<j<<endl;
}
return 0;
} | a.cc:25:9: error: expected unqualified-id before 'return'
25 | return 0;
| ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
26 | }
| ^
|
s990954347 | p00455 | C++ | #include <iostream>
#include <stdio.h>
#include <string.h>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <stdlib.h>
using namespace std;
int main (void)
{
int a,aa,aaa,b,bb,bbb,T,TT,TTT;
for (int i = 0; i < 3; i++)
{
cin >> a >> aa >> aaa >> b >> bb >> bbb;
if (aaa > bbb)
{
if (aa < bb)
{
bb--;
bbb += 60;
}
else if (aa >= bb)
{
bb--;
bbb += 60;
b--;
bb += 60;
}
else if (aaa <= bbb)
{
if (aa < bb)
{
}
else if (aa > bb)
{
b--;
bb += 60;
}
}
T = b - a;
TT = bb - aa;
TTT = bbb - aaa;
cout << T << " " << TT << " " << TTT << endl;
}
} | a.cc: In function 'int main()':
a.cc:53:3: error: expected '}' at end of input
53 | }
| ^
a.cc:15:1: note: to match this '{'
15 | {
| ^
|
s484338121 | p00455 | C++ | import java.util.*;
import static java.lang.System.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
while (sc.hasNext()) {
int arrive = 0;
for (int i=0; i<3; i++) {
if (i==0) arrive += sc.nextInt()*3600;
else if (i==1) arrive += sc.nextInt()*60;
else if (i==2) arrive += sc.nextInt();
}
int leave = 0;
for (int i=0; i<3; i++) {
if (i==0) leave += sc.nextInt()*3600;
else if (i==1) leave += sc.nextInt()*60;
else if (i==2) leave += sc.nextInt();
}
int time = leave - arrive;
int h = time/3600;
time %= 3600;
int m = time/60;
time %= 60;
int s = time;
out.println(h+" "+m+" "+s);
}
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import static java.lang.System.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class Main {
| ^~~~~~
|
s021587072 | p00455 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[3][2][3]={};
for(int i=0;i<3;i++){
cin>>a[i][0][0]>>a[i][0][1]>>a[i][0][2]>>a[i][1][0]>>a[i][1][1]>>a[i][1][2];
a[i][0][2]=a[i][1][2]-a[i][0][2];
if(a[i][0][2]<0){a[i][0][2]+=60; a[i][1][1]-=1;}
a[i][0][1]=a[i][1][1]-a[i][0][1];
if(a[i][0][1]<0){a[i][0][1]+=60; a[i][1][0]-=1;}
a[i][0][0]=a[i][1][0]-a[i][0][0];
}
for(int i=0;i<3;i++){
cout<<a[i][0][0]<<" "<<a[i][0][1]<<" "<<a[i][0][2]<<endl;
}
retu
| a.cc: In function 'int main()':
a.cc:27:3: error: 'retu' was not declared in this scope
27 | retu
| ^~~~
a.cc:27:7: error: expected '}' at end of input
27 | retu
| ^
a.cc:8:11: note: to match this '{'
8 | int main(){
| ^
|
s365067859 | p00455 | C++ | #include<bits.stdc++.h>
using namespace std;
int main(){
for(int i = 0; i < 3; i ++){
int h, m, s, ah, am, as;
cin>>h>>m>>s>>ah>>am>>as;
int a, b, c, b;
a = {(3600 * ah + 60 * am + as) - (3600 * h + 60 * m + s)};
b = a / 3600;
c = (a - 3600 * b) / 60;
d = a - 3600 * b - 60 * c;
cout<<a<<" "<<b<<" "<<c<<endl;
}
return0;
}
| a.cc:1:9: fatal error: bits.stdc++.h: No such file or directory
1 | #include<bits.stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s604706243 | p00455 | C++ | #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
//2.すごろく
/*
int n;
cin >> n;
int A, _A = 1;
int k = 0;
int A_count[100];
A_count[0] = 1;
for (int i = 0; i < n; i++)
{
cin >> A;
if (A == 1)
{
if (A == _A)
{
A_count[k]++;
}
else
{
k++;
A_count[k] = 2;
}
}
_A = A;
}
sort(A_count, A_count + k + 1);
cout << A_count[k] << endl;
*/
//タイムカード
int t[2][3];
int x[3][3];
for (int n=0; n < 3; n++)
{
for (int i=0; i < 2; i++)
for (int k=0; k < 3; k++)
cin >> t[i][k];
for (int m = 2; m >= 0; m--)
{
x[n][m] = t[1][m] - t[0][m];
if (t[0][m] > t[1][m])
{
x[n][m] += 60;
x[n][m - 1]--;
}
}
}
for (int n= 0; n < 3; n++)
{
cout << x[n][0] << x[n][1] << x[n][2] <<endl:
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:58:61: error: expected ';' before ':' token
58 | cout << x[n][0] << x[n][1] << x[n][2] <<endl:
| ^
| ;
|
s829460380 | p00455 | C++ | #include<iostream>
using namespace std;
int main() {
for (int i = 0; i < 3; i++) {
int h, m, s, H, M, S,x,y.z;
cin >> h >> m >> s >> H >> M >> S;
if (S - s < 0) {
z = S + 60 - s;
if (M - m = 0) {
H--;
M = M + 60;
}
M--;
}
else {
z = S - s;
}
if (M - m < 0) {
H--;
y = M + 60 - m;
}
else {
y = M - m;
}
x = H - h;
cout << x << y << z << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:41: error: expected initializer before '.' token
7 | int h, m, s, H, M, S,x,y.z;
| ^
a.cc:11:25: error: 'z' was not declared in this scope
11 | z = S + 60 - s;
| ^
a.cc:12:31: error: lvalue required as left operand of assignment
12 | if (M - m = 0) {
| ~~^~~
a.cc:19:25: error: 'z' was not declared in this scope
19 | z = S - s;
| ^
a.cc:23:25: error: 'y' was not declared in this scope
23 | y = M + 60 - m;
| ^
a.cc:26:25: error: 'y' was not declared in this scope
26 | y = M - m;
| ^
a.cc:30:30: error: 'y' was not declared in this scope
30 | cout << x << y << z << endl;
| ^
a.cc:30:35: error: 'z' was not declared in this scope
30 | cout << x << y << z << endl;
| ^
|
s861215996 | p00455 | C++ | #include<iostream>
using namespace std;
int main() {
for (int i = 0; i < 3; i++) {
int h, m, s, H, M, S,x,y,z;
cin >> h >> m >> s >> H >> M >> S;
if (S - s < 0) {
z = S + 60 - s;
if (M - m = 0) {
H--;
M = M + 60;
}
M--;
}
else {
z = S - s;
}
if (M - m < 0) {
H--;
y = M + 60 - m;
}
else {
y = M - m;
}
x = H - h;
cout << x << y << z << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:31: error: lvalue required as left operand of assignment
12 | if (M - m = 0) {
| ~~^~~
|
s088382665 | p00455 | C++ | #include <iostream>
#include <vector>
using namespace std;
struct time{
int h,m,s;
};
int main(){
time as,af,bs,bf,cs,cf;
cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
int amin = (af.h)*60*60 + (af.m)*60 + af.s - ((as.h)*60*60 + (as.m)*60 + as.s);
int bmin = (bf.h)*60*60 + (bf.m)*60 + bf.s - ((bs.h)*60*60 + (bs.m)*60 + bs.s);
int cmin = (cf.h)*60*60 + (cf.m)*60 + cf.s - ((cs.h)*60*60 + (cs.m)*60 + cs.s);
time retA;
retA.h = amin / 3600;
retA.m = (amin % 3600) / 60;
retA.s = (amin % 3600) % 60;
time retB;
retB.h = bmin / 3600;
retB.m = (bmin % 3600) / 60;
retB.s = (bmin % 3600) % 60;
time retC;
retC.h = cmin / 3600;
retC.m = (cmin % 3600) / 60;
retC.s = (cmin % 3600) % 60;
cout << retA.h << " " << retA.m << " " << retA.s << endl;
cout << retB.h << " " << retB.m << " " << retB.s << endl;
cout << retC.h << " " << retC.m << " " << retC.s << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:13: error: expected ';' before 'as'
12 | time as,af,bs,bf,cs,cf;
| ^~~
| ;
a.cc:13:16: error: 'as' was not declared in this scope; did you mean 'abs'?
13 | cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
| ^~
| abs
a.cc:13:40: error: 'af' was not declared in this scope
13 | cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
| ^~
a.cc:14:16: error: 'bs' was not declared in this scope; did you mean 'abs'?
14 | cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
| ^~
| abs
a.cc:14:40: error: 'bf' was not declared in this scope
14 | cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
| ^~
a.cc:15:16: error: 'cs' was not declared in this scope
15 | cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
| ^~
a.cc:15:40: error: 'cf' was not declared in this scope
15 | cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
| ^~
a.cc:21:13: error: expected ';' before 'retA'
21 | time retA;
| ^~~~~
| ;
a.cc:22:9: error: 'retA' was not declared in this scope
22 | retA.h = amin / 3600;
| ^~~~
a.cc:25:13: error: expected ';' before 'retB'
25 | time retB;
| ^~~~~
| ;
a.cc:26:9: error: 'retB' was not declared in this scope
26 | retB.h = bmin / 3600;
| ^~~~
a.cc:29:13: error: expected ';' before 'retC'
29 | time retC;
| ^~~~~
| ;
a.cc:30:9: error: 'retC' was not declared in this scope
30 | retC.h = cmin / 3600;
| ^~~~
|
s006849553 | p00455 | C++ | #include <iostream>
#include <vector>
using namespace std;
class time{
public:
int h,m,s;
};
int main(){
time as,af,bs,bf,cs,cf;
cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
int amin = (af.h)*60*60 + (af.m)*60 + af.s - ((as.h)*60*60 + (as.m)*60 + as.s);
int bmin = (bf.h)*60*60 + (bf.m)*60 + bf.s - ((bs.h)*60*60 + (bs.m)*60 + bs.s);
int cmin = (cf.h)*60*60 + (cf.m)*60 + cf.s - ((cs.h)*60*60 + (cs.m)*60 + cs.s);
time retA;
retA.h = amin / 3600;
retA.m = (amin % 3600) / 60;
retA.s = (amin % 3600) % 60;
time retB;
retB.h = bmin / 3600;
retB.m = (bmin % 3600) / 60;
retB.s = (bmin % 3600) % 60;
time retC;
retC.h = cmin / 3600;
retC.m = (cmin % 3600) / 60;
retC.s = (cmin % 3600) % 60;
cout << retA.h << " " << retA.m << " " << retA.s << endl;
cout << retB.h << " " << retB.m << " " << retB.s << endl;
cout << retC.h << " " << retC.m << " " << retC.s << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:13: error: expected ';' before 'as'
13 | time as,af,bs,bf,cs,cf;
| ^~~
| ;
a.cc:14:16: error: 'as' was not declared in this scope; did you mean 'abs'?
14 | cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
| ^~
| abs
a.cc:14:40: error: 'af' was not declared in this scope
14 | cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
| ^~
a.cc:15:16: error: 'bs' was not declared in this scope; did you mean 'abs'?
15 | cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
| ^~
| abs
a.cc:15:40: error: 'bf' was not declared in this scope
15 | cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
| ^~
a.cc:16:16: error: 'cs' was not declared in this scope
16 | cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
| ^~
a.cc:16:40: error: 'cf' was not declared in this scope
16 | cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
| ^~
a.cc:22:13: error: expected ';' before 'retA'
22 | time retA;
| ^~~~~
| ;
a.cc:23:9: error: 'retA' was not declared in this scope
23 | retA.h = amin / 3600;
| ^~~~
a.cc:26:13: error: expected ';' before 'retB'
26 | time retB;
| ^~~~~
| ;
a.cc:27:9: error: 'retB' was not declared in this scope
27 | retB.h = bmin / 3600;
| ^~~~
a.cc:30:13: error: expected ';' before 'retC'
30 | time retC;
| ^~~~~
| ;
a.cc:31:9: error: 'retC' was not declared in this scope
31 | retC.h = cmin / 3600;
| ^~~~
|
s282185182 | p00455 | C++ | #include <iostream>
#include <vector>
using namespace std;
class time{
public:
int h,m,s;
};
int main(){
time as,af,bs,bf,cs,cf;
cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:13: error: expected ';' before 'as'
13 | time as,af,bs,bf,cs,cf;
| ^~~
| ;
a.cc:14:16: error: 'as' was not declared in this scope; did you mean 'abs'?
14 | cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
| ^~
| abs
a.cc:14:40: error: 'af' was not declared in this scope
14 | cin >> as.h >> as.m >> as.s >> af.h >> af.m >> af.s;
| ^~
a.cc:15:16: error: 'bs' was not declared in this scope; did you mean 'abs'?
15 | cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
| ^~
| abs
a.cc:15:40: error: 'bf' was not declared in this scope
15 | cin >> bs.h >> bs.m >> bs.s >> bf.h >> bf.m >> bf.s;
| ^~
a.cc:16:16: error: 'cs' was not declared in this scope
16 | cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
| ^~
a.cc:16:40: error: 'cf' was not declared in this scope
16 | cin >> cs.h >> cs.m >> cs.s >> cf.h >> cf.m >> cf.s;
| ^~
|
s430701957 | p00455 | C++ | #include <iostream>
#include <vector>
using namespace std;
class time{
public:
int h,m,s;
};
int main(){
time as,af,bs,bf,cs,cf;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:13: error: expected ';' before 'as'
13 | time as,af,bs,bf,cs,cf;
| ^~~
| ;
|
s201149716 | p00455 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int a;
int b;
int c;
int d;
int e;
int f;
int g;
int h;
int i;
int j;
g=0;
while(g<3){
cin >>a;
cin >>b;
cin >>c;
cin >>d;
cin >>e;
cin >>f;
if(c>f){f=f+60; e=e-1;}
if(b>e){e=e+60; d=d-1;}
h=d-a;
i=e-b;
j=f-c;
cout <<h<<" "<<i<<" "<<j<<endl;
g=g+1;} | a.cc: In function 'int main()':
a.cc:29:8: error: expected '}' at end of input
29 | g=g+1;}
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s506751021 | p00455 | C++ | #include <cstdio>
int main()
{
for(int i = 0; i < 3; ++i) {
int l[3], r[3];
for(int j = 0; j < 3; ++j)
scanf("%d", l + j);
for(int j = 0; j < 3; ++j)
scanf("%d", r + j);
}
int h, m, s;
s = r[0] - l[0];
if(s < 0) {s += 60; r[1] -= 1; }
m = r[1] - l[1];
if(m < 0) {m += 60; r[2] -= 1; }
h = r[2] - l[2];
printf("%d %d %d\n", h, m, s);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:5: error: 'r' was not declared in this scope
13 | s = r[0] - l[0];
| ^
a.cc:13:12: error: 'l' was not declared in this scope
13 | s = r[0] - l[0];
| ^
a.cc: At global scope:
a.cc:20:1: error: expected unqualified-id before 'return'
20 | return 0;
| ^~~~~~
a.cc:21:1: error: expected declaration before '}' token
21 | }
| ^
|
s246082076 | p00455 | C++ | #include<iostream>
using namespace std;
struct time{
int h, m, s;
};
int main(void){
time s[3],t[3];
int st,tt,zt;
for(int i = 0; i < 3; i++){
cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
}
for (int i = 0; i < 3; i++){
st = s[i].s + s[i].m * 60 + s[i].h * 60 * 60;
tt = t[i].s + t[i].m * 60 + t[i].h * 60 * 60;
zt = tt - st;
cout << zt / 3600 << " " << (zt % 3600) / 60 << " " << ((zt % 3600) % 60) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:13: error: expected ';' before 's'
11 | time s[3],t[3];
| ^~
| ;
a.cc:15:24: error: 's' was not declared in this scope
15 | cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
| ^
a.cc:15:54: error: 't' was not declared in this scope
15 | cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
| ^
a.cc:19:22: error: 's' was not declared in this scope
19 | st = s[i].s + s[i].m * 60 + s[i].h * 60 * 60;
| ^
a.cc:20:22: error: 't' was not declared in this scope
20 | tt = t[i].s + t[i].m * 60 + t[i].h * 60 * 60;
| ^
|
s207628601 | p00455 | C++ | #include<iostream>
using namespace std;
typedef struct time{
int h, m, s;
};
int main(void){
time s[3],t[3];
int st,tt,zt;
for(int i = 0; i < 3; i++){
cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
}
for (int i = 0; i < 3; i++){
st = s[i].s + s[i].m * 60 + s[i].h * 60 * 60;
tt = t[i].s + t[i].m * 60 + t[i].h * 60 * 60;
zt = tt - st;
cout << zt / 3600 << " " << (zt % 3600) / 60 << " " << ((zt % 3600) % 60) << endl;
}
return 0;
} | a.cc:5:1: warning: 'typedef' was ignored in this declaration
5 | typedef struct time{
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:13: error: expected ';' before 's'
11 | time s[3],t[3];
| ^~
| ;
a.cc:15:24: error: 's' was not declared in this scope
15 | cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
| ^
a.cc:15:54: error: 't' was not declared in this scope
15 | cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
| ^
a.cc:19:22: error: 's' was not declared in this scope
19 | st = s[i].s + s[i].m * 60 + s[i].h * 60 * 60;
| ^
a.cc:20:22: error: 't' was not declared in this scope
20 | tt = t[i].s + t[i].m * 60 + t[i].h * 60 * 60;
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.