submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s656093534 | p00516 | Java | import java.util.Scanner;
public class Main1 {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int a[] = new int[n];//??¶???????????¨
int b[] = new int[m];//????????????
int cnt[] = new int[n];//????????????
int max = 0, idx = 0;//?????§?????¨????????????????????????
for(int i = 0;i < n;i++){
a[i] = sc.nextInt();
cnt[i] = 0;//????????????????????????
}
for(int i = 0;i < m;i++){
b[i] = sc.nextInt();
}
for(int i = 0;i < m;i++){
for(int k = 0;k < n;k++){
if(a[k] <= b[i]){
cnt[k]++;
break;
}
}
}
for(int i = 0;i < n;i++){
if(max < cnt[i]){
max = cnt[i];
idx = i;
}
}
System.out.println(idx + 1);
}
} | Main.java:2: error: class Main1 is public, should be declared in a file named Main1.java
public class Main1 {
^
1 error
|
s876884716 | p00516 | Java | 8 | Main.java:1: error: class, interface, enum, or record expected
8
^
1 error
|
s296163100 | p00516 | Java |
import java.util.Scanner;
public class AOJ0593 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] Ai = new int[N];
int[] Bi = new int[M];
int[] point = new int[N];
int res = 0;
for(int i = 0; i < N; i++){
Ai[i] = sc.nextInt();
}
for(int j = 0; j < M; j++){
Bi[j] = sc.nextInt();
}
for(int j = 0; j < M; j++){
for(int i = N - 1; 0 <= i; i--){
if(Bi[j] >= Ai[i]){
res = i + 1;
}
}
point[res]++;
}
int Maxp = 0;
int pointer = 0;
for(int i = N - 1; 0 <= i; i--){
if(Maxp < point[i]){
Maxp = point[i];
pointer = i;
}
}
System.out.println(pointer);
}
} | Main.java:4: error: class AOJ0593 is public, should be declared in a file named AOJ0593.java
public class AOJ0593 {
^
1 error
|
s955566573 | p00516 | Java | mport java.util.*;
public class AOJ0593{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int i,j,x,c;
int max=0,maxn=0;
int s=sc.nextInt();
int o=sc.nextInt();
int [][]sn = new int [s][2];
int []ol = new int [o];
for(i=0;i<s;i++){
int m=sc.nextInt();
sn[i][0]=m;
sn[i][1]=0;
}
for(i=0;i<o;i++){
int e=sc.nextInt();
ol[i]=e;
}
for(i=0;i<o;i++){
for(j=0;j<s;j++){
System.out.println("d");
if(ol[i]>=sn[j][0]) {
sn[j][1]++;
break;
}
}
}
for(i=0;i<s;i++){
if(sn[i][1]>max) {
max=sn[i][1];
maxn=i+1;
}
}
System.out.printf("%d\n",maxn);
sc.close();
System.exit(0);
}
} | Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
|
s266467543 | p00516 | Java | mport java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int i,j,x,c;
int max=0,maxn=0;
int s=sc.nextInt();
int o=sc.nextInt();
int [][]sn = new int [s][2];
int []ol = new int [o];
for(i=0;i<s;i++){
int m=sc.nextInt();
sn[i][0]=m;
sn[i][1]=0;
}
for(i=0;i<o;i++){
int e=sc.nextInt();
ol[i]=e;
}
for(i=0;i<o;i++){
for(j=0;j<s;j++){
System.out.println("d");
if(ol[i]>=sn[j][0]) {
sn[j][1]++;
break;
}
}
}
for(i=0;i<s;i++){
if(sn[i][1]>max) {
max=sn[i][1];
maxn=i+1;
}
}
System.out.printf("%d\n",maxn);
sc.close();
System.exit(0);
}
} | Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
|
s569430888 | p00516 | Java | import java.util.Scanner;
public class AOJ0593 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[][] cost = new int[n][2];
int[] std = new int[m];
for (int i=0; i<n; i++)
cost[i][0] = sc.nextInt();
for (int i=0; i<m; i++)
std[i] = sc.nextInt();
java.util.Arrays.sort(std);
for (int i=0; i<m; i++) {
for (int j=0; j<n; j++) {
if (cost[j][0] <= std[i]) {
cost[j][1] += 1;
break;
}
}
}
int tmp = cost[0][1];
int ans = 1;
for (int i=0; i<n; i++) {
if (tmp <cost[i][1]) {
tmp = cost[i][1];
ans = i+1;
}
}
System.out.println(ans);
}
} | Main.java:3: error: class AOJ0593 is public, should be declared in a file named AOJ0593.java
public class AOJ0593 {
^
1 error
|
s511775173 | p00516 | Java | import java.util.*;
public class AOJ_0593 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[]k = new int[n];
int[]s = new int[m];
int[]count = new int[n];
for(int i = 0; i < n; i++){
k[i] = sc.nextInt();
}
for(int i = 0; i < m; i++){
s[i] = sc.nextInt();
}
for(int i = 0; i < n; i++){
count[i] = 0;
}
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
if(s[i] >= k[j]){
count[j] = count[j] + 1;
break;
}
}
}
int h = 0;
int c = 0;
int i;
for(i = 0; i < n; i++){
if(h > count[i]){
}else if(h < count[i]){
h = count[i];
c = i;
}
}
System.out.println(c + 1);
}
} | Main.java:2: error: class AOJ_0593 is public, should be declared in a file named AOJ_0593.java
public class AOJ_0593 {
^
1 error
|
s196211078 | p00516 | C | main(i,k,n,m,a[1001],c[1001]){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);} | main.c:1:15: error: expected ')' before '[' token
1 | main(i,k,n,m,a[1001],c[1001]){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);}
| ^
| )
|
s967338056 | p00516 | C | #include <cstdio>
int main(){
int N,M;
scanf("%d %d",&N,&M);
int A[1000];
int Ai;
int Bj;
int count[1000];
for(int i=0;i<N;i++){
scanf("%d",&Ai);
A[i]=Ai;
count[i]=0;
}
for(int j=0;j<M;j++){
scanf("%d",&Bj);
for(int i=0;i<N;i++){
if(A[i]<=Bj){count[i]++;break;}
}
}
int max_count=0;
int max_game=-1;
for(int i=0;i<N;i++){
if(max_count<count[i]){
max_count=count[i];
max_game=i;
}
}
printf("%d\r\n",max_game+1);
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s807375518 | p00516 | C | #include<stdio.h>
int main(void){
int i,j,a[1000],b[1000],c,d=0,N,M,o;
scanf("%d%d",&N,&M);
for(i=0;i<N;i++){
b[i]=0;
}
for(i=0;i<N;i++){
scanf("%d",&a[i]);
}
for(i=0;i<M;i++){
scanf("%d",&c);
for(j=0;j<N;j++){
if(a[j]<=c){
b[j]++;
break;
}
}
}
for(i=0;i<N;i++){
if(d<b[i]){
d=b[i]
o=i;
}
}
printf("%d\n",d+1);
return 0;
} | main.c: In function 'main':
main.c:24:7: error: expected ';' before 'o'
24 | d=b[i]
| ^
| ;
25 | o=i;
| ~
|
s966566323 | p00516 | C | #include<stdio.h>
int main(void){
int i,j,a[1000],b[1000],c,d,N,M,o=0;
scanf("%d %d",&N,&M);
for(i=0;i<N;i++){
scanf("%d",&a[i]);
b[i]=0;
}
for(i=0;i<M;i++){
scanf("%d",&c);
for(j=0;j<N;j++){
if(a[j]<=c){
b[j]++;
break;
}
}
}
for(i=0;i<N;i++){
if(o<b[i]){
o=b[i]
d=i+1;
}
}
printf("%d\n",d);
return 0;
} | main.c: In function 'main':
main.c:20:7: error: expected ';' before 'd'
20 | o=b[i]
| ^
| ;
21 | d=i+1;
| ~
|
s650701222 | p00516 | C | #include <stdio.h>
int main() {
int i, j, n, m;
int game[1000], judge[1000], ticket[1000] = { 0 };
scanf("%d %d", &n, &m);
for( i = 0; i < n; i++) scanf("%d", &game[i]);
for( i = 0; i < m; i++) scanf("%d", &judge[1000]);
for( i = 0; i < m; i++){
for( j = 0; j < n; i++) {
if( game[j] <= judge[i] ) {
ticket[j]++;
break;
}
}
}
for( i = 1; i < n; i++) {
if( ticket[max] < ticket[i] ) max = i;
}
printf("%d\n", max);
return 0;
} | main.c: In function 'main':
main.c:18:28: error: 'max' undeclared (first use in this function)
18 | if( ticket[max] < ticket[i] ) max = i;
| ^~~
main.c:18:28: note: each undeclared identifier is reported only once for each function it appears in
|
s281023251 | p00516 | C | #include <stdio.h>
int main(void){
int n, m, i, j, x, A;
scanf("%d %d", &n, &m);
int a[n], b[m], c[n] = {0};
for(i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for(i = 0; i < m; i++) {
scanf("%d", &b[i]);
}
for(i = 0; i < m; i++) {
x = n;
for(j = 0; j < n; j++) {
if(b[i] > = a[j] && x > j){
x = j;
}
}
c[x] = c[x] + 1;
}
x = 0;
for(i = 0; i < n; i++) {
if(x < c[i]){
x = c[i];
A = i;
}
}
printf("%f", A);
return 0;
} | main.c: In function 'main':
main.c:6:26: error: variable-sized object may not be initialized except with an empty initializer
6 | int a[n], b[m], c[n] = {0};
| ^
main.c:16:17: error: expected expression before '=' token
16 | if(b[i] > = a[j] && x > j){
| ^
|
s405736873 | p00516 | C | #include <stdio.h>
int main(void){
int n, m, i, j, x, A;
scanf("%d %d", &n, &m);
int a[n], b[m], c[n] = {0};
for(i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for(i = 0; i < m; i++) {
scanf("%d", &b[i]);
}
for(i = 0; i < m; i++) {
x = n;
for(j = 0; j < n; j++) {
if(b[i] > = a[j] && x > j){
x = j;
}
}
c[x] = c[x] + 1;
}
x = 0;
for(i = 0; i < n; i++) {
if(x < c[i]){
x = c[i];
A = i;
}
}
printf("%d", A);
return 0;
} | main.c: In function 'main':
main.c:6:26: error: variable-sized object may not be initialized except with an empty initializer
6 | int a[n], b[m], c[n] = {0};
| ^
main.c:16:17: error: expected expression before '=' token
16 | if(b[i] > = a[j] && x > j){
| ^
|
s956972140 | p00516 | C | /*????\¨(Vote)*/
#include <stdio.h>
int main(){
int i, j, x, y, z, N, M;
int A[1000] = {0};
int B[1000] = {0};
int data[1000] = {0};
scanf("%d %d", &N, &M);
for (i = 1; i - 1 < N; i++) {
scanf("%d", &A[i - 1]);
}
for (j = 1; j - 1 < M; j++) {
scanf("%d", &B[j - 1]);
}
for (j = 1; j - 1 < M; j++) {
x = 0;
for (i = N; 0 < i; i--) {
if (A[i - 1] <= B[j - 1]) {
x = i - 1;
}
}
data[x]++;
}
y = data[0];
for (i = 1; i - 1 < N; i++) {
if (y < data[i - 1]) {
y = [i - 1];
z = i - 1;
}
}
printf("%d\n", z);
return 0;
} | main.c: In function 'main':
main.c:27:13: error: expected expression before '[' token
27 | y = [i - 1];
| ^
|
s026142090 | p00516 | C | #include <stdio.h>
int main(void)
{
int N,M,i,j;
scanf("%d %d",&N,&M);
int a[N+1];
//a[]????????¢??????????????¶?????????????????????????????????????????¨???
for(i=1;i<N+1;i++)scanf("%d",&a[i]);
int b[M+1],vote[M+1],max,kixyougi[N+1];
//b[]???????§????M????????????????????????kixyougi[]?????????????????¶??????????\¨??\??£????????????
for(i=1;i<M+1;i++)
{
scanf("%d",&b[i]);
for(j=1;j<N+1;j++)
{
if(b[i]>a[j]){
vote[i]=j
kixyougi[j]++
break;
}
}
for(j=1;j<N+1;j++){
max=kixyougi[1];
if(kixyougi[j]>max)max=kixyougi[j];
}
printf("%d\n",max);
return 0;
}
| main.c: In function 'main':
main.c:19:42: error: expected ';' before 'kixyougi'
19 | vote[i]=j
| ^
| ;
20 | kixyougi[j]++
| ~~~~~~~~
main.c:30:1: error: expected declaration or statement at end of input
30 | }
| ^
|
s935630246 | p00516 | C | #include <stdio.h>
int main(void){
int n,m,i,j,max;
scanf("%d %d",&n,&m);
int a[n],b[m],count[n];
for(i=0;i<n;i++) count[i]=0;
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<m;i++) scanf("%d",&b[i]);
for(i=0;i<m;i++){
for(j=0;;j++){
if (b[i]>=a[j]) {
count[j]++;
break;
}
}
}
max=1;
for(i=0;i<n-1;i++){
if (count[max-1]<count[i+1]) max=i+2;
}
printf("%d\n",max);
return 0; | main.c: In function 'main':
main.c:23:5: error: expected declaration or statement at end of input
23 | return 0;
| ^~~~~~
|
s136169749 | p00516 | C++ | #include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) REP(i, 0, n)
#define ALL(v) begin(v), end(v)
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<int> a(n);
for(auto &e : a) cin >> e;
vector<int> cnt(n, 0);
rep(i, m) {
int b;
cin >> b;
rep(j, n) {
if(a[j] <= b) {
++cnt[j];
break;
}
}
}
cout << max_element(ALL(cnt)) - cnt.begin() + 1 << endl;
return EXIT_SUCCESS;
} | a.cc: In function 'int main()':
a.cc:33:17: error: 'max_element' was not declared in this scope
33 | cout << max_element(ALL(cnt)) - cnt.begin() + 1 << endl;
| ^~~~~~~~~~~
|
s207652676 | p00516 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int N[1000],M[1000],hyo[1000];
int n,m;
cin>>n>>m;
int tmp;
for(int i=0;i<n;i++)cin>>N[i];
for(int i=0;i<m;i++)cin>>M[i];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
if(M[i]>=N[j]){
hyo[j]++;
break;
}
}
}
int a=0;ma=hyo[0];
for(int i=1;i<=n;i++){
if(hyo[i]>ma)ma=hyo[i],a=i+1;
}
//if(a==0)cout<<1<<endl;
else cout<<a<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:21:17: error: 'ma' was not declared in this scope; did you mean 'a'?
21 | int a=0;ma=hyo[0];
| ^~
| a
a.cc:26:9: error: 'else' without a previous 'if'
26 | else cout<<a<<endl;
| ^~~~
|
s304477773 | p00516 | C++ | #include <iostream>
#include <vector>
#include <Algorithm>
using namespace std;
int main(void){
int mem, kyogi;
cin >> kyogi >> mem;
int money[kyogi];
int kijun[mem];
int score[mem];
//かかる費用を入力
for(int i = 0; i < kyogi; i++){
cin >> money[i];
}
//審査員の基準を入力
for(int i = 0; i < mem; i++){
cin >> kijun[i];
score[i] = 0;
}
for(int i = 0; i < mem; i++){
for(int j = 0; j < kyogi; j++){
if(kijun[i] >= money[j]){
score[j]++;
break;
}
}
}
int log, max = 0;
for(int i = 0; i < mem; i++){
if(score[i] > max){
max = score[i];
log = i;
}
}
cout << log+1 << endl;
} | a.cc:3:10: fatal error: Algorithm: No such file or directory
3 | #include <Algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s586052447 | p00516 | C++ | #include <cstdio>
using namespace std;
int cnt[1024];
int main(void)
{
int n, m;
scanf("%d %d",&n, &m);
int a[1024];
for (int i = 0; i < n; i++){
scnaf("%d", &a[i]);
}
int b[1024];
for (int i = 0; i < m; i++){
scanf("%d", &b[i];
}
for (int j = 0; j < m; j++){
for (int i = 0; i < n; i++){
if (b[i] >= a[i]){
cnt[i]++;
break;
}
}
}
int ans = 0;
for (int i = 0; i < n; i++){
if (cnt[ans] < ans[i]){
ans = i;
}
}
printf("%d\n", ans + 1);
return (0);
} | a.cc: In function 'int main()':
a.cc:14:17: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
14 | scnaf("%d", &a[i]);
| ^~~~~
| scanf
a.cc:19:34: error: expected ')' before ';' token
19 | scanf("%d", &b[i];
| ~ ^
| )
a.cc:33:35: error: invalid types 'int[int]' for array subscript
33 | if (cnt[ans] < ans[i]){
| ^
|
s645330770 | p00516 | C++ | #include <iostream>
#include <algorithm>
#define rep(X, Y) for( int X = 0; X < Y; ++X )
int n, m;
int N[1001], M[1001];
int cnt[1001];
int main(){
memset( cnt, 0, sizeof(cnt) );
std::cin >> n >> m;
rep( i, n ) std::cin >> N[i];
rep( i, m ) std::cin >> M[i];
rep( i, m ) rep( l, n ) if( N[l] <= M[i] ){
cnt[l]++;
break;
}
std::cout << std::max_element( cnt, cnt + n ) - cnt + 1 << std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
11 | memset( cnt, 0, sizeof(cnt) );
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 |
|
s628649483 | p00516 | C++ | #include <stdio.h>
int main(void) {
int vote[1000];
int list[1000];
int i,f;
memset( vote,NULL,sizeof( vote ));
int a = 0,b = 0,c = 0;
scanf( "%d %d",&i,&f );
for( a = 0;a < i;a++ ){
scanf( "%d",&list[a] );
}
for( a = 0;a < f;a++ ){
scanf( "%d",&c );
for( b = 0;b < i;b++ ){
if( list[b] <= c ){ vote[b]++; break; }
}
}
for( a = 0;a < i - 1;a++ ){
for( b = a + 1;b < i;b++ ){
if( vote[a] < vote[b] ){
c = vote[a];
vote[a] = vote[b];
vote[b] = c;
}
}
}
printf( "%d",vote[0] );
return 0;
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'memset' was not declared in this scope
7 | memset( vote,NULL,sizeof( vote ));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <stdio.h>
+++ |+#include <cstring>
2 |
|
s139487489 | p00516 | C++ | #include <stdio.h>
int main(void) {
int vote[1000];
int list[1000];
int i,f;
memset( vote,NULL,sizeof( vote ));
int a = 0,b = 0,c = 0;
scanf( "%d %d",&i,&f );
for( a = 0;a < i;a++ ){
scanf( "%d",&list[a] );
}
for( a = 0;a < f;a++ ){
scanf( "%d",&c );
for( b = 0;b < i;b++ ){
if( list[b] < c ){ vote[b]++; break; }
}
}
for( a = 0;a < i - 1;a++ ){
for( b = a + 1;b < i;b++ ){
if( vote[a] < vote[b] ){
c = vote[a];
vote[a] = vote[b];
vote[b] = c;
}
}
}
printf( "%d\n",vote[0] );
return 0;
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'memset' was not declared in this scope
7 | memset( vote,NULL,sizeof( vote ));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <stdio.h>
+++ |+#include <cstring>
2 |
|
s803676615 | p00516 | C++ | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);} | a.cc:1:1: error: 'i' does not name a type
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^~~~
a.cc: In function 'int main()':
a.cc:1:50: error: 'n' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:53: error: 'm' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:36: error: 'scanf' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^~~~~
a.cc:1:56: error: 'i' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:71: error: 'a' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:84: error: 'm' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:88: error: 'k' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:105: error: 'i' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:93: error: 'scanf' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^~~~~
a.cc:1:115: error: 'n' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:124: error: 'a' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:132: error: 'c' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:151: error: 'n' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:159: error: 'c' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:164: error: 'k' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:173: error: 'i' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:191: error: 'i' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^
a.cc:1:177: error: 'printf' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
a.cc:1:196: error: 'exit' was not declared in this scope
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
| ^~~~
a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
+++ |+#include <cstdlib>
1 | i,k,n,m,a[1001],c[1001];main(){for(scanf("%d%d",&n,&m);i<n;scanf("%d",a+i++));for(;m--;k=0){scanf("%d",&i);for(;k<n;k++)if(a[k]<=i)c[k]++,k=n;}for(;--n+1;)if(c[n]>k)k=c[n],i=n;printf("%d\n",i+1);exit(0);}
|
s017574365 | p00516 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a; i ++)
int main(void){
int N,M;
cin>>N>>M;
vector<int> a(N);
vector<int> sum(N,0);
vector<int> a(M);
rep(i,N)cin>>a[i];
rep(i,M)cin>>b[i];
rep(i,M)
rep(j,N)
if(a[j]<=b[i]){
sum[j]++;
break;
}
int maxx = 0;
int num;
rep(i,n){
if(maxx<sum[i]){
maxx = sum[i];
num = i;
}
}
cout<<num+1<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:15: error: redeclaration of 'std::vector<int> a'
11 | vector<int> a(M);
| ^
a.cc:9:15: note: 'std::vector<int> a' previously declared here
9 | vector<int> a(N);
| ^
a.cc:14:16: error: 'b' was not declared in this scope
14 | rep(i,M)cin>>b[i];
| ^
a.cc:18:16: error: 'b' was not declared in this scope
18 | if(a[j]<=b[i]){
| ^
a.cc:26:9: error: 'n' was not declared in this scope
26 | rep(i,n){
| ^
a.cc:5:38: note: in definition of macro 'rep'
5 | #define rep(i,a) for(int i = 0 ; i < a; i ++)
| ^
|
s785727331 | p00516 | C++ | #include<stdio.h>
int main(){
int n[1001]={};
int m[1001]={};
int m,n,x;
scanf("%d %d",&n,&m);
for(int i=0;i<n;i++)
scanf("%d",&n[i]);
for(int i=0;i<m;i++)
{scanf("%d",&x);
for(int j=0;j<n;j++)
if(x>=n[j])m[j]++;
}
int t=0;
for(int i=0;i<1000;i++)
if(m[i]>t)t=i+1;
printf("%d\n",t);
return 0;
} | a.cc: In function 'int main()':
a.cc:7:5: error: conflicting declaration 'int m'
7 | int m,n,x;
| ^
a.cc:6:5: note: previous declaration as 'int m [1001]'
6 | int m[1001]={};
| ^
a.cc:7:7: error: conflicting declaration 'int n'
7 | int m,n,x;
| ^
a.cc:5:5: note: previous declaration as 'int n [1001]'
5 | int n[1001]={};
| ^
a.cc:10:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | for(int i=0;i<n;i++)
| ~^~
a.cc:13:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
13 | for(int i=0;i<m;i++)
| ~^~
a.cc:15:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
15 | for(int j=0;j<n;j++)
| ~^~
|
s846177904 | p00516 | C++ | import java.util.Scanner;
public class vote {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int m = s.nextInt();
int[] A = new int[n];
int[] a_= new int[n];
int[] b = new int[m];
int answer = 0;
for(int i = 0;i < n;i++){
A[i] = s.nextInt();
}
for(int i = 0;i < m;i++){
b[i] = s.nextInt();
}
for(int i = 0;i < m;i++){
int s = b[i];
for(int j = 0;j < n;j++){
if(s >= A[j]){
a_[j]++;
break;
}
}
}
int max = a_[0];
for(int i = 0;i < n;i++){
if(max <= a_[i]){
max = a_[i];
answer = i + 1;
}
}
System.out.print(answer);
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:9: error: expected unqualified-id before 'public'
3 | public class vote {
| ^~~~~~
|
s973121367 | p00516 | C++ | int d[1000];
int ushi;
int uma;
int main(){
cin>>n>>m;
for(int i;i<n;i++){
cin>>a[i];}
for(int j;j<m;j++){
cin>>b[j];}
for(int k=0;k<n;k++){
for(int l=0;l<m;l++){
if(d[l]==0&&a[k]<=b[l]){
c[k]++;
d[l]=1;
}
}
if(c[k]>ushi){
ushi=c[k];
uma=k;
}
}
cout<<uma+1<<endl;
} | a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
5 | cin>>n>>m;
| ^~~
a.cc:5:8: error: 'n' was not declared in this scope
5 | cin>>n>>m;
| ^
a.cc:5:11: error: 'm' was not declared in this scope
5 | cin>>n>>m;
| ^
a.cc:7:10: error: 'a' was not declared in this scope
7 | cin>>a[i];}
| ^
a.cc:9:10: error: 'b' was not declared in this scope
9 | cin>>b[j];}
| ^
a.cc:12:19: error: 'a' was not declared in this scope
12 | if(d[l]==0&&a[k]<=b[l]){
| ^
a.cc:12:25: error: 'b' was not declared in this scope
12 | if(d[l]==0&&a[k]<=b[l]){
| ^
a.cc:13:9: error: 'c' was not declared in this scope
13 | c[k]++;
| ^
a.cc:17:6: error: 'c' was not declared in this scope
17 | if(c[k]>ushi){
| ^
a.cc:22:3: error: 'cout' was not declared in this scope
22 | cout<<uma+1<<endl;
| ^~~~
a.cc:22:16: error: 'endl' was not declared in this scope
22 | cout<<uma+1<<endl;
| ^~~~
|
s674278430 | p00516 | C++ | #include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
/*
int max(map<int, int> m){
int maxkey = 0;
for (map<int, int>::iterator it = m.begin(); it != m.end(); it++) {
if (maxkey < it->second) maxkey = it->first;
}
return maxkey;
}
*/
int main(int argc, char const *argv[]) {
int n, m;
int a[1000], b[1000];
vector<int> kyogi(n, 0);
cin >> n >> m;
for (int i = 0; i < n; ++i)
{
cin >> a[i];
}
for (int i = 0; i < m; ++i)
{
cin >> b[i];
}
for (int i = 0; i < m; ++i)
{
for (int j = 0; j < n; ++i)
{
if (a[j] <= b[i])
{
int pos = kyogi.begin() + i;
int tmp = kyogi.at(i);
kyogi.insert(pos, ++tmp);
}
}
}
cout << max_element(kyogi.begin(), kyogi.end()) << endl;
return 0;
} | a.cc: In function 'int main(int, const char**)':
a.cc:20:9: error: 'vector' was not declared in this scope
20 | vector<int> kyogi(n, 0);
| ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
4 | #include <algorithm>
+++ |+#include <vector>
5 | using namespace std;
a.cc:20:16: error: expected primary-expression before 'int'
20 | vector<int> kyogi(n, 0);
| ^~~
a.cc:38:43: error: 'kyogi' was not declared in this scope
38 | int pos = kyogi.begin() + i;
| ^~~~~
a.cc:45:29: error: 'kyogi' was not declared in this scope
45 | cout << max_element(kyogi.begin(), kyogi.end()) << endl;
| ^~~~~
|
s706345204 | p00516 | C++ | #include<bits/stdc++.h>
using namespace std;int i,j,N,M,C[1000],K[1000],T[1000],X[2];
main(){cin>>N>>M;
for(i=0;i<N;i++){cin>>C[i];}
for(i=0;i<M;i++){cin>>K[i];
for(j=0;j<N;j++){if(C[j]<=K[i]){T[j] += 1;break;}}}X[0]=0;
for(i=0;i<N;i++){if(T[i]>X[0]){X[0]=T[i];X[1]=i+1;}cout<<X[1]<<endl;} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){cin>>N>>M;
| ^~~~
a.cc: In function 'int main()':
a.cc:7:70: error: expected '}' at end of input
7 | for(i=0;i<N;i++){if(T[i]>X[0]){X[0]=T[i];X[1]=i+1;}cout<<X[1]<<endl;}
| ^
a.cc:3:7: note: to match this '{'
3 | main(){cin>>N>>M;
| ^
|
s361249188 | p00516 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
??
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
??
int main(){
??
????????int n,m,kyo,iin,de,max;
????????vector<int> a,b;
??
????????cin >> n >> m;
??????????
????????int res[n];
??
????????rep(i,n){
????????????????cin >> kyo;
????????????????a.push_back(kyo);
????????????????res[i] = 0;
????????}
??
????????rep(i,m){
????????????????cin >> iin;
????????????????b.push_back(iin);
????????}
??????????
????????rep(i,b.size()){
????????????????rep(j,a.size()){
????????????????????????if(b[i] >= a[j]){
????????????????????????????????res[j] += 1;
????????????????????????????????break;
????????????????????????}
????????????????}
????????}
??
????????//rep(i,n) cout << i+1 << "," << res[i] << endl;
??
????????de = 1;
????????max = res[1];
??
????????rep(i,n){
????????????????if(max <= res[i]){
????????????????????????de = i + 1;
????????????????????????max = res[i];
????????????????}
????????}
??????????
????????//cout << "max:" << max << endl;
??
????????cout << de << endl;
??????????????????
????????return 0;????
} | a.cc:40:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
40 | ????????//rep(i,n) cout << i+1 << "," << res[i] << endl;
a.cc:52:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
52 | ????????//cout << "max:" << max << endl;
a.cc:7:1: error: expected unqualified-id before '?' token
7 | ??
| ^
a.cc:10:1: error: expected unqualified-id before '?' token
10 | ??
| ^
|
s176988219 | p00516 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<int> a(n);
vector<int> b(n);
vector<int> c(n);
vector<bool> u(n);
vector<int> ans(n);
fill(u.begin(),u.end(),true);
for(int i=0;i<n;i++){
cin >> a[i];
};
for(int i=0;i<m;i++){
cin >> b[i];
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(u[j] && a[i] <= b[j]){
u[i] = false;
ans[i]++;
}
}
}
int res = 0,ansnum = 0;;
for(int i=0;i<n;i++){
if(res < ans[i]){
res = ans[i];
ansnum = i + 1;
}
}
cout << ansnum << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'vector' was not declared in this scope
10 | vector<int> a(n);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <algorithm>
+++ |+#include <vector>
3 |
a.cc:10:12: error: expected primary-expression before 'int'
10 | vector<int> a(n);
| ^~~
a.cc:11:12: error: expected primary-expression before 'int'
11 | vector<int> b(n);
| ^~~
a.cc:12:12: error: expected primary-expression before 'int'
12 | vector<int> c(n);
| ^~~
a.cc:13:12: error: expected primary-expression before 'bool'
13 | vector<bool> u(n);
| ^~~~
a.cc:14:12: error: expected primary-expression before 'int'
14 | vector<int> ans(n);
| ^~~
a.cc:15:10: error: 'u' was not declared in this scope
15 | fill(u.begin(),u.end(),true);
| ^
a.cc:17:16: error: 'a' was not declared in this scope
17 | cin >> a[i];
| ^
a.cc:20:16: error: 'b' was not declared in this scope
20 | cin >> b[i];
| ^
a.cc:24:24: error: 'a' was not declared in this scope
24 | if(u[j] && a[i] <= b[j]){
| ^
a.cc:24:32: error: 'b' was not declared in this scope
24 | if(u[j] && a[i] <= b[j]){
| ^
a.cc:26:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
26 | ans[i]++;
| ^~~
| abs
a.cc:32:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
32 | if(res < ans[i]){
| ^~~
| abs
|
s175425409 | p00516 | C++ | #include <iostream>
using namespace std;
int main(){
int n, m;
cin >> n;
cin >> m;
int a[1000] = {};
int b[1000] = {};
int point[4];
int selected;
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = 0; i < m; i++){
cin >> b[i];
}
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
if(a[i] => b[j]){
point[i]++;
break;
}
}
}
for(int i = 0; i < n - 1; i++){
if(point[i] < point[i + 1]){
selected = i;
}
}
cout << selected << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:34: error: expected primary-expression before '>' token
23 | if(a[i] => b[j]){
| ^
|
s325073880 | p00516 | C++ | #include<stdio.h>
int main(void)
{
int n,m,x,hi[1001],i,j,cnt[1001],temp,max=-1;
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++){
scanf("%d",&hi[i]);
cnt[i]=0;
}
for(i=0;i<m;i++){
scanf("%d",&x);
for(j=1;j<=n;j++){
if(x>=hi[j]){
cnt[j]++;
break;
}
}
}
// for(j=1;j<=n;j++){
printf(":%d\n",cnt[j]);
}
for(i=1;i<=n;i++) {
if(max<cnt[i]) {
max=cnt[i];
temp=i;
}
}
printf("%d\n",temp);
return 0;
} | a.cc:22:9: error: expected unqualified-id before 'for'
22 | for(i=1;i<=n;i++) {
| ^~~
a.cc:22:17: error: 'i' does not name a type
22 | for(i=1;i<=n;i++) {
| ^
a.cc:22:22: error: 'i' does not name a type
22 | for(i=1;i<=n;i++) {
| ^
a.cc:28:15: error: expected constructor, destructor, or type conversion before '(' token
28 | printf("%d\n",temp);
| ^
a.cc:29:9: error: expected unqualified-id before 'return'
29 | return 0;
| ^~~~~~
a.cc:30:1: error: expected declaration before '}' token
30 | }
| ^
|
s314670386 | p00516 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ZERO(a) memset(a,0,sizeof(a))
#define pb push_back
int rank[1020];
int main() {
int n, m;
ZERO(rank);
cin >> n >> m;
vector<int> v;
rep(i,n) {
int cost; scanf("%d",&cost);
v.pb(cost);
}
rep(i,m) {
int c; scanf("%d",&c);
rep(j,n) if(c >= v[j]) {
rank[j+1]++; break;
}
}
int ans = 0, m = 0;
rep(i,1001) if(m < rank[i]) {
m = rank[i];
ans = i;
}
cout << ans << "\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:13:10: error: reference to 'rank' is ambiguous
13 | ZERO(rank);
| ^~~~
a.cc:6:24: note: in definition of macro 'ZERO'
6 | #define ZERO(a) memset(a,0,sizeof(a))
| ^
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:5: note: 'int rank [1020]'
9 | int rank[1020];
| ^~~~
a.cc:13:10: error: reference to 'rank' is ambiguous
13 | ZERO(rank);
| ^~~~
a.cc:6:35: note: in definition of macro 'ZERO'
6 | #define ZERO(a) memset(a,0,sizeof(a))
| ^
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:5: note: 'int rank [1020]'
9 | int rank[1020];
| ^~~~
a.cc:24:13: error: reference to 'rank' is ambiguous
24 | rank[j+1]++; break;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:5: note: 'int rank [1020]'
9 | int rank[1020];
| ^~~~
a.cc:28:18: error: redeclaration of 'int m'
28 | int ans = 0, m = 0;
| ^
a.cc:12:12: note: 'int m' previously declared here
12 | int n, m;
| ^
a.cc:29:24: error: reference to 'rank' is ambiguous
29 | rep(i,1001) if(m < rank[i]) {
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:5: note: 'int rank [1020]'
9 | int rank[1020];
| ^~~~
a.cc:30:13: error: reference to 'rank' is ambiguous
30 | m = rank[i];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:5: note: 'int rank [1020]'
9 | int rank[1020];
| ^~~~
|
s095839743 | p00516 | C++ | #include<stdio.h>
int main(void)
{
int n,m,a[101],b,z[101],i,j,w,d;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
z[i]=0;
}
for(i=0;i<m;i++){
scanf("%d",&b);
for(j=0;j<n;j++){
if(b<=a[j]){
z[i]++;
break;
}
}
}
d=0;
for(i=0;i<n;i++){
if(d<z[i]){
d=z[i];
w=i;
}
printf("%d\n",w);
return 0;
} | a.cc: In function 'int main()':
a.cc:27:2: error: expected '}' at end of input
27 | }
| ^
a.cc:3:1: note: to match this '{'
3 | {
| ^
|
s504227211 | p00516 | C++ | #include<stdio.h>
int main(void)
{
int n,m,a[101],b,z[101],i,j,w,d;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
z[i]=0;
}
for(i=0;i<m;i++){
scanf("%d",&b);
for(j=0;j<n;j++){
if(b<=a[j]){
z[i]++;
break;
}
}
}
d=0;
for(i=0;i<n;i++){
if(d<z[i]){
d=z[i];
w=i;
}
}
printf("%d\n",w);
return 0; | a.cc: In function 'int main()':
a.cc:27:18: error: expected '}' at end of input
27 | return 0;
| ^
a.cc:3:1: note: to match this '{'
3 | {
| ^
|
s697176189 | p00516 | C++ | #include<iostream>
using namespace std;
int n,m,a[1005],p[1005];
int main(){
cin>>n>>m;for(int i=0;i<n;i++){cin>>a[i];}
for(int i=0;i<m;i++){
int b;cin>>b;
for(int j=0;j<n;j++){
if(a[j]<=b){p[j]++;break;}
}
}
int maxn=0,maxid=0;
for(int i=0;i<n;i++){
if(maxn<p[j]){maxn=p[j];maxid=j;}
}
cout<<maxid+1<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:27: error: 'j' was not declared in this scope
14 | if(maxn<p[j]){maxn=p[j];maxid=j;}
| ^
|
s765451137 | p00516 | C++ | #include<iostream>
using namespace std;
int Mx = 0, num;
int A [1001], B[1001], K[1001;
int main(){
int N, M;
int i, j;
cin >> N >> M;
for (j=1; j<=M; j++) { K[j] = 0; }
for (i=1; i<=N; i++) { cin >> A[i]; }
for (j=1; j<=M; j++) { cin >> B[j]; }
for (j=1; J<=M; j++) {
for (i=1; i<=N; i++) {
if(A[i] <= B[j]) {
K[i]++;
if( Mx < K[i] ){ Mx = K[i]; num = i; }
break;
}
}
}
cout << num << endl;
return 0;
} | a.cc:4:30: error: expected ']' before ';' token
4 | int A [1001], B[1001], K[1001;
| ^
| ]
a.cc: In function 'int main()':
a.cc:9:28: error: 'K' was not declared in this scope
9 | for (j=1; j<=M; j++) { K[j] = 0; }
| ^
a.cc:12:15: error: 'J' was not declared in this scope
12 | for (j=1; J<=M; j++) {
| ^
a.cc:15:17: error: 'K' was not declared in this scope
15 | K[i]++;
| ^
|
s161233370 | p00516 | C++ | #include<iostream>
using namespace std;
int Mx = 0, num;
int A [1001], B[1001], K[1001;
int main(){
int N, M;
int i, j;
cin >> N >> M;
for (j=1; j<=M; j++) { K[j] = 0; }
for (i=1; i<=N; i++) { cin >> A[i]; }
for (j=1; j<=M; j++) { cin >> B[j]; }
for (j=1; J<=M; j++) {
for (i=1; i<=N; i++) {
if(A[i] <= B[j]) {
K[i]++;
if( Mx < K[i] ){ Mx = K[i]; num = i; }
break;
}
}
}
cout << num << endl;
return 0;
} | a.cc:4:30: error: expected ']' before ';' token
4 | int A [1001], B[1001], K[1001;
| ^
| ]
a.cc: In function 'int main()':
a.cc:9:28: error: 'K' was not declared in this scope
9 | for (j=1; j<=M; j++) { K[j] = 0; }
| ^
a.cc:12:15: error: 'J' was not declared in this scope
12 | for (j=1; J<=M; j++) {
| ^
a.cc:15:17: error: 'K' was not declared in this scope
15 | K[i]++;
| ^
|
s115161415 | p00516 | C++ | #include<iostream>
using namespace std;
int Mx = 0, num;
int A [1001], B[1001], K[1001];
int main(){
int N, M;
int i, j;
cin >> N >> M;
for (j=1; j<=M; j++) { K[j] = 0; }
for (i=1; i<=N; i++) { cin >> A[i]; }
for (j=1; j<=M; j++) { cin >> B[j]; }
for (j=1; J<=M; j++) {
for (i=1; i<=N; i++) {
if(A[i] <= B[j]) {
K[i]++;
if( Mx < K[i] ){ Mx = K[i]; num = i; }
break;
}
}
}
cout << num << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:15: error: 'J' was not declared in this scope
12 | for (j=1; J<=M; j++) {
| ^
|
s302753443 | p00516 | C++ | #include<stdio.h>
#include<iostream>
#include<alorithm>
using namespace std;
int p[1001]={0},h[1001]={0};
int main(){
int n,m,i,j,l,k,a,b
cin>>n>>m;
for(i=1;i<=n;i++)cin>>h[i];
for(i=0;i<m;i++){
cin>>l;
for(j=1;j<=n;j++){
if(l<=h[j])p[j]++;
}
}
k=0;
for(i=1;i<n;i++){
if(h[k]<h[i])k=i;
}
cout<<k<<endl;
return 0;
} | a.cc:3:9: fatal error: alorithm: No such file or directory
3 | #include<alorithm>
| ^~~~~~~~~~
compilation terminated.
|
s910169418 | p00516 | C++ | #include<stdio.h>
#include<iostream>
#include<alorithm>
using namespace std;
int p[1001]={0},h[1001]={0};
int main(){
int n,m,i,j,l,k,a,b
cin>>n>>m;
for(i=1;i<=n;i++)cin>>h[i];
for(i=0;i<m;i++){
cin>>l;
for(j=1;j<=n;j++){
if(l<=h[j])p[j]++;
}
}
k=0;
for(i=1;i<n;i++){
if(h[k]<h[i])k=i;
}
cout<<k<<endl;
return 0;
} | a.cc:3:9: fatal error: alorithm: No such file or directory
3 | #include<alorithm>
| ^~~~~~~~~~
compilation terminated.
|
s026963041 | p00516 | C++ | #include<stdio.h>
#include<iostream>
#include<alorithm>
using namespace std;
int p[1001]={0},h[1001]={0};
int main(){
int n,m,i,j,l,k,a,b;
cin>>n>>m;
for(i=1;i<=n;i++)cin>>h[i];
for(i=0;i<m;i++){
cin>>l;
for(j=1;j<=n;j++){
if(l<=h[j])p[j]++;
}
}
k=0;
for(i=1;i<n;i++){
if(h[k]<h[i])k=i;
}
cout<<k<<endl;
return 0;
} | a.cc:3:9: fatal error: alorithm: No such file or directory
3 | #include<alorithm>
| ^~~~~~~~~~
compilation terminated.
|
s178125464 | p00516 | C++ | #include<stdio.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<sstream>
#include<math.h>
#define FOR(i,a) for(int i=0;i<a;i++)
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[n];
int b[m];
int ans[n];
int maxcount = 0;
FOR(i, n) {
cin >> a[i];
ans[i] = 0;
}
FOR(i, m) {
cin >> b[i];
FOR(j, n) {
if (a[j] <= b[i]) {
ans[j]++;
}
}
}
int pos = 0;
FOR(i, n) {
if (maxcount < ans[i]) {
maxcount = ans[i];
pos = i;
}
}
cout << pos + 1; << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:35:26: error: expected primary-expression before '<<' token
35 | cout << pos + 1; << endl;
| ^~
|
s680997102 | p00516 | C++ | #include<iostream>
#include<string>
#include<set>
#include<utility>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(){
/*
//数あて
int n;
cin >> n;
int p[200][3];
for(int i=0;i<n;i++)
{
cin >> p[i][0] >> p[i][1] >> p[i][2];
}
int _p;
for(int k=0;k<3;k++)
{
for(int i=0;i<n;i++)
{
_p = p[i][k];
for(int j=i+1;j<n;j++)
{
if(_p == p[j][k])
{
p[i][k] = 0;
p[j][k] = 0;
}
}
}
}
for(int i=0;i<n;i++)
{
cout << p[i][0] + p[i][1] + p[i][2] << endl;
}
*/
/*
//得点
int ai,am,as,ae,bi,bm,bs,be;
cin >> ai >> am >> as >> ae >> bi >> bm >> bs >> be;
int answer=ai+am+as+ae;
if(answer < bi+bm+bs+be)
{
/ answer=bi+bm+bs+be;
}
cout << answer << endl;
*/
//おつり
/* int onum;
while(true){
int N;
cin >> N;
if(N == 0) break;
onum=0;
int oturi = 1000-N;
if(oturi >= 500)
{
onum++;
oturi -= 500;
}
while(oturi>=100)
{
onum++;
oturi -= 100;
}
if(oturi >= 50)
{
onum++;
oturi -= 50;
}
while(oturi>=10)
{
onum++;
oturi -= 10;
}
if(oturi >= 5)
{
onum++;
oturi -= 5;
}
while(oturi>=1)
{
onum++;
oturi -= 1;
}
cout << onum << endl;
}
*/
//レシート
/*
while(true){
int N;
cin >> N;
if(N==0) break;
int a[9];
for(int i=0;i<9;i++){
cin >> a[0];
}
}
/*
int N;
int i = 0;
while(i<N){
i++;
}
for(int i=0; i<N; i++)
*/
/*
int N;
int x;
set<int> a;
cin >> N;
for(int i=0; i<N; i++){
cin >> x;
a.insert(x);
}
cout << a.size() << endl;
*/
//投票
int N,M;
cin >> N >> M;
int a;
int A[1000];
int B[1000];
vector<pair<int,int>> X;
for(int i=0; i<N; i++){
cin >> A[i];
X[i] = make_pair(i,0);
}
for(int j=0; j<M;j++){
cin >> B[j];
}
for(int j=0; j<N; j++){
for(int i=0; i<M; i++){
if(A[i] < B[j]){
X[i].second++;
break;
}
}
}
sort(X.begin,X.end);
reverse(X.begin,X.end);
cout << X[0].first << endl;
return 0;
}
/*
int max(int i,int j){
if(i < j) i=j;
return i;
}
*/
| a.cc: In function 'int main()':
a.cc:156:13: error: no matching function for call to 'sort(<unresolved overloaded function type>, <unresolved overloaded function type>)'
156 | sort(X.begin,X.end);
| ~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: template argument deduction/substitution failed:
a.cc:156:13: note: couldn't deduce template parameter '_RAIter'
156 | sort(X.begin,X.end);
| ~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
a.cc:157:16: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
157 | reverse(X.begin,X.end);
| ~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:157:16: note: couldn't deduce template parameter '_BIter'
157 | reverse(X.begin,X.end);
| ~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
|
s104965344 | p00516 | C++ | #include<iostream>
#include<string>
#include<set>
#include<utility>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(){
/*
//数あて
int n;
cin >> n;
int p[200][3];
for(int i=0;i<n;i++)
{
cin >> p[i][0] >> p[i][1] >> p[i][2];
}
int _p;
for(int k=0;k<3;k++)
{
for(int i=0;i<n;i++)
{
_p = p[i][k];
for(int j=i+1;j<n;j++)
{
if(_p == p[j][k])
{
p[i][k] = 0;
p[j][k] = 0;
}
}
}
}
for(int i=0;i<n;i++)
{
cout << p[i][0] + p[i][1] + p[i][2] << endl;
}
*/
/*
//得点
int ai,am,as,ae,bi,bm,bs,be;
cin >> ai >> am >> as >> ae >> bi >> bm >> bs >> be;
int answer=ai+am+as+ae;
if(answer < bi+bm+bs+be)
{
/ answer=bi+bm+bs+be;
}
cout << answer << endl;
*/
//おつり
/* int onum;
while(true){
int N;
cin >> N;
if(N == 0) break;
onum=0;
int oturi = 1000-N;
if(oturi >= 500)
{
onum++;
oturi -= 500;
}
while(oturi>=100)
{
onum++;
oturi -= 100;
}
if(oturi >= 50)
{
onum++;
oturi -= 50;
}
while(oturi>=10)
{
onum++;
oturi -= 10;
}
if(oturi >= 5)
{
onum++;
oturi -= 5;
}
while(oturi>=1)
{
onum++;
oturi -= 1;
}
cout << onum << endl;
}
*/
//レシート
/*
while(true){
int N;
cin >> N;
if(N==0) break;
int a[9];
for(int i=0;i<9;i++){
cin >> a[0];
}
}
/*
int N;
int i = 0;
while(i<N){
i++;
}
for(int i=0; i<N; i++)
*/
/*
int N;
int x;
set<int> a;
cin >> N;
for(int i=0; i<N; i++){
cin >> x;
a.insert(x);
}
cout << a.size() << endl;
*/
//投票
int N,M;
cin >> N >> M;
int a;
int A[1000];
int B[1000];
int X[1000][2];
for(int i=0; i<N; i++){
cin >> A[i];
X[i][0] = i;
X[i][1] = 0;
}
for(int j=0; j<M;j++){
cin >> B[j];
}
for(int j=0; j<N; j++){
for(int i=0; i<M; i++){
if(A[i] < B[j]){
X[i][1]++;
break;
}
}
}
sort(X,X+N);
reverse(X,X+N);
cout << X[0][1] << endl;
return 0;
}
/*
int max(int i,int j){
if(i < j) i=j;
return i;
}
*/
| In file included from /usr/include/c++/14/algorithm:61,
from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int (*)[2]]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:157:6: required from here
157 | sort(X,X+N);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1780:17: error: array must be initialized with a brace-enclosed initializer
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1782:24: error: invalid array assignment
1782 | *__first = _GLIBCXX_MOVE(__val);
| ^
In file included from /usr/include/c++/14/bits/stl_algo.h:61:
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1593 | std::__make_heap(__first, __middle, __comp);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int (*)[2]; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int (*)[2]]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:157:6: required from here
157 | sort(X,X+N);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_heap.h:355:22: error: array must be initialized with a brace-enclosed initializer
355 | _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent));
| ^~~~~~~
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1596 | std::__pop_heap(__first, __middle, __i, __comp);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int (*)[2]; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[2]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int (*)[2]]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:157:6: required from here
157 | sort(X,X+N);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_heap.h:262:18: error: array must be initialized with a brace-enclosed initializer
262 | _ValueType __value = _GLIBCXX_MOVE(*__result);
| ^~~~~~~
/usr/include/c++/14/bits/stl_heap.h:263:17: error: invalid array assignment
263 | *__result = _GLIBCXX_MOVE(*__first);
| ^
|
s536757443 | p00516 | C++ | #include<iostream>
#include<string>
#include<set>
#include<utility>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(){
/*
//数あて
int n;
cin >> n;
int p[200][3];
for(int i=0;i<n;i++)
{
cin >> p[i][0] >> p[i][1] >> p[i][2];
}
int _p;
for(int k=0;k<3;k++)
{
for(int i=0;i<n;i++)
{
_p = p[i][k];
for(int j=i+1;j<n;j++)
{
if(_p == p[j][k])
{
p[i][k] = 0;
p[j][k] = 0;
}
}
}
}
for(int i=0;i<n;i++)
{
cout << p[i][0] + p[i][1] + p[i][2] << endl;
}
*/
/*
//得点
int ai,am,as,ae,bi,bm,bs,be;
cin >> ai >> am >> as >> ae >> bi >> bm >> bs >> be;
int answer=ai+am+as+ae;
if(answer < bi+bm+bs+be)
{
/ answer=bi+bm+bs+be;
}
cout << answer << endl;
*/
//おつり
/* int onum;
while(true){
int N;
cin >> N;
if(N == 0) break;
onum=0;
int oturi = 1000-N;
if(oturi >= 500)
{
onum++;
oturi -= 500;
}
while(oturi>=100)
{
onum++;
oturi -= 100;
}
if(oturi >= 50)
{
onum++;
oturi -= 50;
}
while(oturi>=10)
{
onum++;
oturi -= 10;
}
if(oturi >= 5)
{
onum++;
oturi -= 5;
}
while(oturi>=1)
{
onum++;
oturi -= 1;
}
cout << onum << endl;
}
*/
//レシート
/*
while(true){
int N;
cin >> N;
if(N==0) break;
int a[9];
for(int i=0;i<9;i++){
cin >> a[0];
}
}
/*
int N;
int i = 0;
while(i<N){
i++;
}
for(int i=0; i<N; i++)
*/
/*
int N;
int x;
set<int> a;
cin >> N;
for(int i=0; i<N; i++){
cin >> x;
a.insert(x);
}
cout << a.size() << endl;
*/
//投票
/*
int N,M;
cin >> N >> M;
int a;
int A[1000];
int B[1000];
int X[1000][2];
for(int i=0; i<N; i++){
cin >> A[i];
X[i][0] = i;
X[i][1] = 0;
}
for(int j=0; j<M;j++){
cin >> B[j];
}
for(int j=0; j<M; j++){
for(int i=0; i<N; i++){
if(A[i] < B[j]){
X[i][1]++;
break;
}
}
}
for(int i=1; i<N; i++){
if(X[i-1][1]<X[i][1])
X[i-1][0] = X[i][0];
}
cout << X[0][0]+1 << endl;
*/
int N,M;
cin >> N >> M;
int A[1000];
int vote[1000];
for(int i; i<N; i++){
cin >> A[i];
vote[i] =0;
}
int B;
for(int i=0; i<M; i++){
cin >> B;
for(int j=0; j<N; j++){
if(A[j]<=B){
vote[j] = A[j];
break;
}
}
}
int temps = 0;
int ans;
for(int i=0; i<N; i++){
if(vote[i] > temps){
temps = temps[i];
ans = i;
}
cout << ans+1 << endl;
}
return 0;
}
/*
int max(int i,int j){
if(i < j) i=j;
return i;
}
*/
| a.cc: In function 'int main()':
a.cc:187:38: error: invalid types 'int[int]' for array subscript
187 | temps = temps[i];
| ^
|
s800771873 | p00516 | C++ | #include<iostream>
using namespace std;
int main() {
int n, m, x, y, z;
cin >> n >> m;
int A[n];
int B[m];
int C[m];
y = 0;
for (int i = 0; i < n; i++) {
cin >> A[i];
}
for (int i = 0; i < m; i++) {
cin >> B[i];
for (int j = 0; j < n; j++) {
if (B[i] >= A[j]) {
C[i] = j;
break;
}
}
}
for (int i = 0; i < n; i++) {
x = C.count(i);
y = max(x, y);
}
for (int i = 0;i < n;i++) {
if (C.count(i) = y) {
z = i;
break;
}
}
cout << z << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:23: error: request for member 'count' in 'C', which is of non-class type 'int [m]'
25 | x = C.count(i);
| ^~~~~
a.cc:29:23: error: request for member 'count' in 'C', which is of non-class type 'int [m]'
29 | if (C.count(i) = y) {
| ^~~~~
|
s579538373 | p00516 | C++ | #include<iostream>
using namespace std;
int main() {
int n, m, x, y, z;
cin >> n >> m;
int A[n];
int B[m];
int C[m];
y = 0;
for (int i = 0; i < n; i++) {
cin >> A[i];
}
for (int i = 0; i < m; i++) {
cin >> B[i];
for (int j = 0; j < n; j++) {
if (B[i] >= A[j]) {
C[i] = j;
break;
}
}
}
for (int i = 0; i < n; i++) {
x = C.count(i);
y = max(x, y);
}
for (int i = 0;i < n;i++) {
if (C.count(i) = y) {
z = i;
break;
}
}
cout << z << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:23: error: request for member 'count' in 'C', which is of non-class type 'int [m]'
25 | x = C.count(i);
| ^~~~~
a.cc:29:23: error: request for member 'count' in 'C', which is of non-class type 'int [m]'
29 | if (C.count(i) = y) {
| ^~~~~
|
s404464798 | p00517 | Java | import java.util.Scanner;
public class Main2014C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int W = sc.nextInt();
int H = sc.nextInt();
int N = sc.nextInt();
int[] X = new int[N];
int[] Y = new int[N];
int ans = 0;
for(int i=0;i<N;i++) {
X[i] = sc.nextInt();
Y[i] = sc.nextInt();
}
int x0 = X[0];
int y0 = Y[0];
int x1, y1;
for(int i=1;i<N;i++) {
x1 = X[i];
y1 = Y[i];
if(x0==x1) {
ans += Math.abs(y0-y1);
x0 = x1;
y0 = y1;
}else if(y0==y1) {
ans += Math.abs(x0-x1);
x0 = x1;
y0 = y1;
}else if(x0-x1 == y0-y1) {
ans += Math.abs(x0-x1);
x0 = x1;
y0 = y1;
}else {
ans += Math.abs(x0-x1);
ans += Math.abs(y0-y1);
if(y1>y0) {
ans -= Math.abs(x0-x1);
}
x0 = x1;
y0 = y1;
}
}
System.out.println(ans);
}
}
| Main.java:2: error: class Main2014C is public, should be declared in a file named Main2014C.java
public class Main2014C {
^
1 error
|
s203064906 | p00517 | Java | import java.io.*;
import java.util.StringTokenizer;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
public sttic void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputSteamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st1=new StringTokenizer(line);
int w=Integer.parseInt(st1.nextToken());
int h=Integer.parseInt(st1.nextToken());
int n=Integer.parseInt(st1.nextToken());
int[] x=new int[n];
int[] y=new int[n];
for(int i=0;i<n;i++){
line=br.readLine();
StringTokenizer st2=new StringTokenizer(line);
x[i]=Integer.parseInt(st2.nextToken());
y[i]=Integer.parseInt(st2.nextToken());
}
int cnt=0;
for(int i=0;i<n-1;i++){
cnt+=minRoad(x[i],y[i],x[i+1],y[i+1]);
}
out.println(cnt);
}
}
private static int minRoad(int a,int b,int c,int d){
if(a==c) return Math.abs(b-d);
if(b==d) return Math.abs(a-c);
int x=a-c;
int y=b-d;
if(x*y>0){
x=Math.abs(x);
y=Math.abs(y);
return Math.max(x,y);
}
x=Math.abs(x);
y=Math.abs(y);
return x+y;
}
} | Main.java:8: error: <identifier> expected
public sttic void main(String[] args) throws IOException{
^
1 error
|
s772182922 | p00517 | Java | import java.io.*;
import java.util.StringTokenizer;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputSteamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st1=new StringTokenizer(line);
int w=Integer.parseInt(st1.nextToken());
int h=Integer.parseInt(st1.nextToken());
int n=Integer.parseInt(st1.nextToken());
int[] x=new int[n];
int[] y=new int[n];
for(int i=0;i<n;i++){
line=br.readLine();
StringTokenizer st2=new StringTokenizer(line);
x[i]=Integer.parseInt(st2.nextToken());
y[i]=Integer.parseInt(st2.nextToken());
}
int cnt=0;
for(int i=0;i<n-1;i++){
cnt+=minRoad(x[i],y[i],x[i+1],y[i+1]);
}
out.println(cnt);
}
}
private static int minRoad(int a,int b,int c,int d){
if(a==c) return Math.abs(b-d);
if(b==d) return Math.abs(a-c);
int x=a-c;
int y=b-d;
if(x*y>0){
x=Math.abs(x);
y=Math.abs(y);
return Math.max(x,y);
}
x=Math.abs(x);
y=Math.abs(y);
return x+y;
}
} | Main.java:9: error: cannot find symbol
BufferedReader br=new BufferedReader(new InputSteamReader(System.in));
^
symbol: class InputSteamReader
location: class Main
1 error
|
s445310322 | p00517 | Java | //============================================================================
// Name : JOI.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
char chr;
int W,H,N;
int X[10001],Y[10001];
int main() {
cin>>W>>H>>N;
for(int i=0;i<N;i++){
cin>>X[i]>>Y[i];
}
int S=0;
int R=0;
for(int i=0;i<N-1;i++){
if(X[i]==X[i+1])S=fabs(Y[i+1]-Y[i]);
if(Y[i]==Y[i+1])S=fabs(X[i+1]-X[i]);
if((X[i]-X[i+1])*(Y[i]-Y[i+1])>0)S=max(fabs(X[i+1]-X[i]),fabs(Y[i+1]-Y[i]));
if((X[i]-X[i+1])*(Y[i]-Y[i+1])<0)S=fabs(X[i+1]-X[i])+fabs(Y[i+1]-Y[i]);
R+=S;
}
cout<<R<<endl;
return 0;
} | Main.java:9: error: illegal character: '#'
#include <iostream>
^
Main.java:9: error: class, interface, enum, or record expected
#include <iostream>
^
Main.java:11: error: unnamed classes are a preview feature and are disabled by default.
char chr;
^
(use --enable-preview to enable unnamed classes)
Main.java:12: error: class, interface, enum, or record expected
int W,H,N;
^
Main.java:13: error: class, interface, enum, or record expected
int X[10001],Y[10001];
^
Main.java:15: error: not a statement
cin>>W>>H>>N;
^
Main.java:18: error: not a statement
cin>>X[i]>>Y[i];
^
Main.java:33: error: not a statement
cout<<R<<endl;
^
8 errors
|
s095598633 | p00517 | Java | //============================================================================
// Name : JOI.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
char chr;
int W,H,N;
int X[10001],Y[10001];
int main() {
cin>>W>>H>>N;
for(int i=0;i<N;i++){
cin>>X[i]>>Y[i];
}
int S=0;
int R=0;
for(int i=0;i<N-1;i++){
if(X[i]==X[i+1])S=abs(Y[i+1]-Y[i]);
if(Y[i]==Y[i+1])S=abs(X[i+1]-X[i]);
if((X[i]-X[i+1])*(Y[i]-Y[i+1])>0)S=max(abs(X[i+1]-X[i]),abs(Y[i+1]-Y[i]));
if((X[i]-X[i+1])*(Y[i]-Y[i+1])<0)S=abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i]);
R+=S;
}
cout<<R<<endl;
return 0;
} | Main.java:9: error: illegal character: '#'
#include <iostream>
^
Main.java:9: error: class, interface, enum, or record expected
#include <iostream>
^
Main.java:11: error: unnamed classes are a preview feature and are disabled by default.
char chr;
^
(use --enable-preview to enable unnamed classes)
Main.java:12: error: class, interface, enum, or record expected
int W,H,N;
^
Main.java:13: error: class, interface, enum, or record expected
int X[10001],Y[10001];
^
Main.java:15: error: not a statement
cin>>W>>H>>N;
^
Main.java:18: error: not a statement
cin>>X[i]>>Y[i];
^
Main.java:33: error: not a statement
cout<<R<<endl;
^
8 errors
|
s421744239 | p00517 | Java | import java.util.Scanner;
public class AOJ0594 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594 {
^
1 error
|
s926341040 | p00517 | Java | public class AOJ0594 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:1: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594 {
^
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
3 errors
|
s543014461 | p00517 | Java | public class AOJ0594 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:1: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594 {
^
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
3 errors
|
s639489577 | p00517 | Java | public class AOJ0594 {
public static void main(String[] args) {
java.util.Scanner sc = new java.util.Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:1: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594 {
^
1 error
|
s449044326 | p00517 | Java | public class AOJ0594 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:1: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594 {
^
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
3 errors
|
s778361586 | p00517 | Java | public class AOJ0594 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:1: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594 {
^
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
3 errors
|
s607985735 | p00517 | Java | public class main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:1: error: class main is public, should be declared in a file named main.java
public class main {
^
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class main
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class main
3 errors
|
s138043066 | p00517 | Java | public class AOJ0594 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:1: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594 {
^
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0594
3 errors
|
s798435561 | p00517 | Java | import java.util.Scanner;
public class AOJ0594 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594 {
^
1 error
|
s453777963 | p00517 | Java | import java.util.Scanner;
public class AOJ0594{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594{
^
1 error
|
s140896579 | p00517 | Java | import java.util.Scanner;
public class AOJ0594{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594{
^
1 error
|
s285732628 | p00517 | Java | import java.util.Scanner;
public class AOJ0594{
public static void AOJ0594(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594{
^
1 error
|
s852630666 | p00517 | Java | import java.util.Scanner;
public class AOJ0594{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int gowhere[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
gowhere[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = gowhere[i][0] - gowhere[i-1][0];
x = Math.abs(result);
result2 = gowhere[i][1] - gowhere[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594{
^
1 error
|
s751686836 | p00517 | Java | import java.util.Scanner;
public class main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int gowhere[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
gowhere[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = gowhere[i][0] - gowhere[i-1][0];
x = Math.abs(result);
result2 = gowhere[i][1] - gowhere[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class main is public, should be declared in a file named main.java
public class main{
^
1 error
|
s374716793 | p00517 | Java | import java.util.Scanner;
public class AOJ0594{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int ikisaki[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
ikisaki[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = ikisaki[i][0] - ikisaki[i-1][0];
x = Math.abs(result);
result2 = ikisaki[i][1] - ikisaki[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594{
^
1 error
|
s632757107 | p00517 | Java | import java.util.Scanner;
public class AOJ0594{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int n = sc.nextInt();
int result,x,result2,y;
int mov = 0;
int go[][] = new int[n][2];
for(int i = 0; i < n; i++){
for(int k = 0; k < 2; k++){
go[i][k] = sc.nextInt();
}
}
for(int i = 1; i < n; i++){
result = go[i][0] - go[i-1][0];
x = Math.abs(result);
result2 = go[i][1] - go[i-1][1];
y = Math.abs(result2);
mov = mov + x + y;
if(result > 0 && result2 > 0 || result < 0 && result2 < 0){
if(x <= y){
mov = mov - x;
}else{
mov = mov - y;
}
}
}
System.out.println(mov);
}
} | Main.java:3: error: class AOJ0594 is public, should be declared in a file named AOJ0594.java
public class AOJ0594{
^
1 error
|
s901027696 | p00517 | C | #include<bits/stdc++.h>
using namespace std;
int main(){
int i;
int W,H,N,sum;
int x,y,dx,dy;
scanf("%d %d %d",&W,&H,&N);
scanf("%d %d",&x,&y);
sum=0;
for(i=0;i<N-1;i++){
scanf("%d %d",&dx,&dy);
dx=dx-x;
dy=dy-y;
if(0<=dx&&0<=dy){
if(dx>dy){
sum=sum+dx;
}else{
sum=sum+dy;
}
}else if(dx<=0&&0<=dy){
dx=-dx;
sum=sum+dx+dy;
}else if(dx<=0&&dy<=0){
dx=-dx;
dy=-dy;
if(dx>dy){
sum=sum+dx;
}else{
sum=sum+dy;
}
}else if(0<=dx&&dy<=0){
dy=-dy;
sum=sum+dx+dy;
}
}
cout<<sum<<endl;
} | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s098597453 | p00517 | C | #include <stdio.h>
int main(void)
{
int W,H,N,i,j,ans;
ans=0;
scanf("%d %d %d",&W,&H,&N);
int xs,ys,xg,yg,xnow,ynow;
scanf("%d %d",&xs,&ys);
for(i=1;i<N;i++){
if(i==1){
xnow=xs;
ynow=ys;
}
else {
xnow=xg;
ynow=yg;
}
scanf("%d %d",&xg,&yg); //goal scan
while(!(xnow==xg&&ynow==yg)){
if(xnow<xg){
if(ynow<yg){//??????
xnow++;
ynow++;
}
else if(ynow>yg){//??????
ynow--;
}
else {//???
xnow++;
}
}
if(xnow>xg){
if(ynow==yg){ //???
xnow--;
}
else if(ynow<yg){ //??????
ynow++;
}
else {//??????
xnow--;
ynow--;
}
else {
if(xnow==xg&&ynow<yg){//???
ynow--;
}
else { //???
ynow++;
}
ans++;
}
}
printf("%d\n",ans);
return 0;
} | main.c: In function 'main':
main.c:47:25: error: expected '}' before 'else'
47 | else {
| ^~~~
main.c:60:1: error: expected declaration or statement at end of input
60 | }
| ^
|
s737202932 | p00517 | C | #include <stdio.h>
int main(void)
{
int W,H,N,i,j,ans;
ans=0;
scanf("%d %d %d",&W,&H,&N);
int xs,ys,xg,yg,xnow,ynow;
scanf("%d %d",&xs,&ys);
xnow=xs;
ynow=ys;
scanf("%d %d",&xg,&yg); //goal scan
while(!(xnow==xg&&ynow==yg)){
if(xnow<xg){
if(ynow<yg){//??????
xnow++;
ynow++;
}
else if(ynow>yg){//??????
ynow--;
}
else {//???
xnow++;
}
}
if(xnow>xg){
if(ynow==yg){ //???
xnow--;
}
else if(ynow<yg){ //??????
ynow++;
}
else {//??????
xnow--;
ynow--;
}
}
else {
if(xnow==xg&&ynow<yg){//???
ynow--;
}
else { //???
ynow++;
}
}
ans++;
}
}
for(i=2;i<N;i++){
xnow=xg;
ynow=yg;
scanf("%d %d",&xg,&yg); //goal scan
while(!(xnow==xg&&ynow==yg)){
if(xnow<xg){
if(ynow<yg){//??????
xnow++;
ynow++;
}
else if(ynow>yg){//??????
ynow--;
}
else {//???
xnow++;
}
}
if(xnow>xg){
if(ynow==yg){ //???
xnow--;
}
else if(ynow<yg){ //??????
ynow++;
}
else {//??????
xnow--;
ynow--;
}
}
else {
if(xnow==xg&&ynow<yg){//???
ynow--;
}
else { //???
ynow++;
}
}
ans++;
}
}
printf("%d\n",ans);
return 0;
} | main.c:57:9: error: expected identifier or '(' before 'for'
57 | for(i=2;i<N;i++){
| ^~~
main.c:57:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
57 | for(i=2;i<N;i++){
| ^
main.c:57:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
57 | for(i=2;i<N;i++){
| ^~
main.c:101:16: error: expected declaration specifiers or '...' before string constant
101 | printf("%d\n",ans);
| ^~~~~~
main.c:101:23: error: unknown type name 'ans'
101 | printf("%d\n",ans);
| ^~~
main.c:102:9: error: expected identifier or '(' before 'return'
102 | return 0;
| ^~~~~~
main.c:103:1: error: expected identifier or '(' before '}' token
103 | }
| ^
|
s808293088 | p00517 | C | #include <stdio.h>
int main(void)
{
int W,H,N,i,j,ans;
ans=0;
scanf("%d %d %d",&W,&H,&N);
int xs,ys,xg,yg;
scanf("%d %d",&xs,&ys);
scanf("%d %d",&xg,&yg); //goal scan
if(xs<xg&&xy<yg){
if(xg-xs<yg-ys){
ans=yg-ys;
}
else {
ans=xg-xs;
}
}
if(xs>xg&&xy>yg){
if(xs-xg<ys-yg){
ans=ys-yg;
}
else {
ans=xs-xg;
}
}
if(xs>=xg&&xy<=yg){
ans=(xs-xg)+(yg-ys);
}
if(xs<=xg&&xy>=yg){
ans=(xg-xs)+(ys-yg);
}
printf("%d\n",ans);
return 0;
} | main.c: In function 'main':
main.c:12:19: error: 'xy' undeclared (first use in this function); did you mean 'xg'?
12 | if(xs<xg&&xy<yg){
| ^~
| xg
main.c:12:19: note: each undeclared identifier is reported only once for each function it appears in
|
s165641888 | p00517 | C | #include <iostream>
#include <stdafx.h>
#include <stdio.h>
#define fo(i,a) for(i=0;i<a;i++)
using namespace std;
int main()
{
int i, n, x, y, ans, w[1000000], h[1000000];
scanf("%d", &n);
fo(i, n) scanf("%d%d", &w[i], &h[i] );
fo(i, n) {
if ((w[i] > w[i] && h[i] < h[i - 1]) || (w[i] < w[i - 1] && h[i] < h[i - 1]))
ans += max(abs(w[i] - w[i - 1]), abs(h[i] - h[i - 1]));
else
ans = abs(w[i] - w[i - 1]) + abs(h[i] - h[i - 1]);
}
printf("%d\n", ans);
return 0;
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s693822916 | p00517 | C++ | #include <stdio.h>
#include <algorithm>
int main(void)
{
int w, h, n, i, j, cost = 0;
int sx, sy, gx, gy;
scanf("%d %d %d", &w, &h, &n);
scanf("%d %d", &sx, &sy);
for (i = 1; i < n; i++){
scanf("%d %d", &gx, &gy);
if (sx < gx && sy < gy){
if (gx - sx < gy - sy){
cost += gx - sx;
sy += gx - sx;
sx = gx;
}
else{
cost += gy - sy;;
sx += gy - sy;
sy = gy;
}
}
else if (sx > gx && sy > gy){
if (sx - gx < sy - gy){
cost += sx - gx;
sy += sx - gx;
sx = gx;
}
else{
cost += sy - gy;;
sx -= sy - gy;
sy = gy;
}
}
cost += max(sx - gx, gx - sx);
cost += max(sy - gy, gy - sy);
sx = gx;sy = gy;
}
printf("%d\n", cost);
return (0);
} | a.cc: In function 'int main()':
a.cc:41:25: error: 'max' was not declared in this scope; did you mean 'std::max'?
41 | cost += max(sx - gx, gx - sx);
| ^~~
| std::max
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s351433874 | p00517 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
int n,m,q;
cin>>m>>n>>q;
int x,y;
cin>>y>>x;
int sum=0;
rep(i,q-1){
int a,b;
cin>>b>>a;
int c=a-x,d=b-y;
if(c<0){c*=-1;d*=-1;}
if(c==0)sum+=abs(d);
else if(d<0)sum+=c-d;
else sum+=max(c,d);
x=a;
y=b;
}
cout<<sum<<endl; | a.cc: In function 'int main()':
a.cc:36:25: error: expected '}' at end of input
36 | cout<<sum<<endl;
| ^
a.cc:19:11: note: to match this '{'
19 | int main(){
| ^
|
s873232021 | p00517 | C++ | +#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
int w,h,n,x[20000],y[20000];
int sum=0,dis;
int i,j;
scanf("%d %d %d",&w,&h,&n);
for(i=0;i<=n-1;i++){
scanf("%d %d",&x[i],&y[i]);
}
for(i=0;i<=n-2;i++){
j=i+1;
if(x[i]==x[j]) {dis=abs(y[i]-y[j]);sum=sum+dis;continue;}
else if(y[i]==y[j]) {dis=abs(x[i]-x[j]);sum=sum+dis;continue;}
else if(((x[i]<=x[j])&&(y[i]<=y[j]))||(x[i]>=x[j])&&(y[i]>=y[j])) {dis=min(abs(x[i]-x[j]),abs(y[i]-y[j]));sum=sum+dis;continue;}
else if(((x[i]<=x[j])&&(y[i]>=y[j]))||(x[i]>=x[j])&&(y[i]<=y[j])) {dis=abs(x[i]-x[j])+abs(y[i]-y[j]);sum=sum+dis;continue;}
}
printf("%d\n",sum);
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | +#include <cstdio>
| ^
a.cc:1:1: error: expected unqualified-id before '+' token
1 | +#include <cstdio>
| ^
In file included from /usr/include/c++/14/cmath:45,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/stdlib.h:32,
from /usr/include/c++/14/bits/std_abs.h:38,
from /usr/include/c++/14/cmath:49:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:65:
/usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type
125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
+++ |+#include <cstddef>
1 | // Types used in iterator implementation -*- C++ -*-
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type
214 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type
225 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type
112 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
65 | #include <debug/assertions.h>
+++ |+#include <cstddef>
66 | #include <bits/stl_iterator_base_types.h>
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type
118 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_iterator.h:67,
|
s087664899 | p00517 | C++ | // JOI13-quest3.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
int absolute(int *n) {
if (*n >= 0) {
return *n;
}
else {
*n *= -1;
return *n;
}
}
int big(int n, int m) {
int max;
absolute(&n);
absolute(&m);
if (n >= m) {
max = n;
}
else {
max = m;
}
return max;
}
int _tmain(int argc, _TCHAR* argv[])
{
int width, height, number;
scanf("%d %d %d", &width, &height, &number);
int x1, y1, x2, y2, minus_x, minus_y, sum = 0;
scanf("%d %d", &x1, &y1);
for (int i = 0; i < number - 1; i++) {
scanf("%d %d", &x2, &y2);
minus_x = x1 - x2;
minus_y = y1 - y2;
if ((minus_x > 0 && minus_y > 0) || (minus_x < 0 && minus_y < 0)) {
sum += big(minus_x, minus_y);
}
else if (minus_x == 0) {
absolute(&minus_y);
sum += minus_y;
}
else if (minus_y == 0) {
absolute(&minus_x);
sum += minus_x;
}
else {
absolute(&minus_x);
absolute(&minus_y);
sum += (minus_x + minus_y);
}
x1 = x2;
y1 = y2;
}
printf("%d\n", sum);
return 0;
} | a.cc:33:22: error: '_TCHAR' has not been declared
33 | int _tmain(int argc, _TCHAR* argv[])
| ^~~~~~
|
s966726559 | p00517 | C++ | #include<bits/stdc++.h>
using namespace std;
int h,w,n,c,s,x[10000],y[10000];main(){cin>>h>>w>>n;x[0]=1;y[0]=1;for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}for(int i=1;i<n;i++){c=((x[i+1]>=x[i] && y[i+1]>=y[i]) || (x[i+1]<=x[i] && y[i+1]<=y[i]))?max(abs(x[i+1]-x[i]),abs(y[i+1]-y[i])):abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);}s+=c;}cout<<sum<<endl;} | a.cc:3:33: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | int h,w,n,c,s,x[10000],y[10000];main(){cin>>h>>w>>n;x[0]=1;y[0]=1;for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}for(int i=1;i<n;i++){c=((x[i+1]>=x[i] && y[i+1]>=y[i]) || (x[i+1]<=x[i] && y[i+1]<=y[i]))?max(abs(x[i+1]-x[i]),abs(y[i+1]-y[i])):abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);}s+=c;}cout<<sum<<endl;}
| ^~~~
a.cc:3:276: error: 'cout' does not name a type
3 | int h,w,n,c,s,x[10000],y[10000];main(){cin>>h>>w>>n;x[0]=1;y[0]=1;for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}for(int i=1;i<n;i++){c=((x[i+1]>=x[i] && y[i+1]>=y[i]) || (x[i+1]<=x[i] && y[i+1]<=y[i]))?max(abs(x[i+1]-x[i]),abs(y[i+1]-y[i])):abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);}s+=c;}cout<<sum<<endl;}
| ^~~~
a.cc:3:292: error: expected declaration before '}' token
3 | int h,w,n,c,s,x[10000],y[10000];main(){cin>>h>>w>>n;x[0]=1;y[0]=1;for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}for(int i=1;i<n;i++){c=((x[i+1]>=x[i] && y[i+1]>=y[i]) || (x[i+1]<=x[i] && y[i+1]<=y[i]))?max(abs(x[i+1]-x[i]),abs(y[i+1]-y[i])):abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);}s+=c;}cout<<sum<<endl;}
| ^
|
s731691919 | p00517 | C++ | #include<bits/stdc++.h>
using namespace std;
int h,w,n,c,s,x[10000],y[10000];main(){cin>>h>>w>>n;x[0]=1;y[0]=1;for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}for(int i=1;i<n;i++){c=((x[i+1]>=x[i] && y[i+1]>=y[i]) || (x[i+1]<=x[i] && y[i+1]<=y[i]))?max(abs(x[i+1]-x[i]),abs(y[i+1]-y[i])):abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);}s+=c;}cout<<s<<endl;} | a.cc:3:33: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | int h,w,n,c,s,x[10000],y[10000];main(){cin>>h>>w>>n;x[0]=1;y[0]=1;for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}for(int i=1;i<n;i++){c=((x[i+1]>=x[i] && y[i+1]>=y[i]) || (x[i+1]<=x[i] && y[i+1]<=y[i]))?max(abs(x[i+1]-x[i]),abs(y[i+1]-y[i])):abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);}s+=c;}cout<<s<<endl;}
| ^~~~
a.cc:3:276: error: 'cout' does not name a type
3 | int h,w,n,c,s,x[10000],y[10000];main(){cin>>h>>w>>n;x[0]=1;y[0]=1;for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}for(int i=1;i<n;i++){c=((x[i+1]>=x[i] && y[i+1]>=y[i]) || (x[i+1]<=x[i] && y[i+1]<=y[i]))?max(abs(x[i+1]-x[i]),abs(y[i+1]-y[i])):abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);}s+=c;}cout<<s<<endl;}
| ^~~~
a.cc:3:290: error: expected declaration before '}' token
3 | int h,w,n,c,s,x[10000],y[10000];main(){cin>>h>>w>>n;x[0]=1;y[0]=1;for(int i=1;i<=n;i++){cin>>x[i]>>y[i];}for(int i=1;i<n;i++){c=((x[i+1]>=x[i] && y[i+1]>=y[i]) || (x[i+1]<=x[i] && y[i+1]<=y[i]))?max(abs(x[i+1]-x[i]),abs(y[i+1]-y[i])):abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);}s+=c;}cout<<s<<endl;}
| ^
|
s817481994 | p00517 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int w, h, n;
cin >> w >> h >> n;
int a[10000], b[10000];
for (int i = 0, i < n; i++){
int c, d;
cin >> c >> d;
a[i] = c;
b[i] = d;
}
int sum = 0;
for (int i = 0, i < n - 1; i++){
if (a[i] < a[i + 1] && b[i] < b[i + 1]){
sum += max(a[i + 1] - a[i], b[i + 1] - b[i]);
}
else if (a[i] > a[i + 1] && b[i] > b[i + 1]){
sum += max(a[i] - a[i + 1], b[i] - b[i + 1]);
}
else {
sum += abs(a[i + 1] - a[i]) + abs(b[i + 1] - b[i]);
}
}
CL(sum);
return (0);
} | a.cc: In function 'int main()':
a.cc:11:22: error: expected ';' before '<' token
11 | for (int i = 0, i < n; i++){
| ^~
| ;
a.cc:11:23: error: expected primary-expression before '<' token
11 | for (int i = 0, i < n; i++){
| ^
a.cc:19:22: error: expected ';' before '<' token
19 | for (int i = 0, i < n - 1; i++){
| ^~
| ;
a.cc:19:23: error: expected primary-expression before '<' token
19 | for (int i = 0, i < n - 1; i++){
| ^
a.cc:31:5: error: 'CL' was not declared in this scope
31 | CL(sum);
| ^~
|
s557612953 | p00517 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int w, h, n;
cin >> w >> h >> n;
int a[10000], b[10000];
for (int i = 0, i < n; i++){
int c, d;
cin >> c >> d;
a[i] = c;
b[i] = d;
}
int sum = 0;
for (int i = 0, i < n - 1; i++){
if (a[i] < a[i + 1] && b[i] < b[i + 1]){
sum += max(a[i + 1] - a[i], b[i + 1] - b[i]);
}
else if (a[i] > a[i + 1] && b[i] > b[i + 1]){
sum += max(a[i] - a[i + 1], b[i] - b[i + 1]);
}
else {
sum += abs(a[i + 1] - a[i]) + abs(b[i + 1] - b[i]);
}
}
cout << sum << endl;
return (0);
} | a.cc: In function 'int main()':
a.cc:11:22: error: expected ';' before '<' token
11 | for (int i = 0, i < n; i++){
| ^~
| ;
a.cc:11:23: error: expected primary-expression before '<' token
11 | for (int i = 0, i < n; i++){
| ^
a.cc:19:22: error: expected ';' before '<' token
19 | for (int i = 0, i < n - 1; i++){
| ^~
| ;
a.cc:19:23: error: expected primary-expression before '<' token
19 | for (int i = 0, i < n - 1; i++){
| ^
|
s962173931 | p00517 | C++ | //============================================================================
// Name : JOI.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
char chr;
int W,H,N;
int X[10001],Y[10001];
int main() {
cin>>W>>H>>N;
for(int i=0;i<N;i++){
cin>>X[i]>>Y[i];
}
int S=0;
int R=0;
for(int i=0;i<N-1;i++){
if(X[i]==X[i+1])S=fabs(Y[i+1]-Y[i]);
if(Y[i]==Y[i+1])S=fabs(X[i+1]-X[i]);
if((X[i]-X[i+1])*(Y[i]-Y[i+1])>0)S=max(fabs(X[i+1]-X[i]),fabs(Y[i+1]-Y[i]));
if((X[i]-X[i+1])*(Y[i]-Y[i+1])<0)S=fabs(X[i+1]-X[i])+fabs(Y[i+1]-Y[i]);
R+=S;
}
cout<<R<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:35: error: 'fabs' was not declared in this scope; did you mean 'labs'?
23 | if(X[i]==X[i+1])S=fabs(Y[i+1]-Y[i]);
| ^~~~
| labs
a.cc:24:35: error: 'fabs' was not declared in this scope; did you mean 'labs'?
24 | if(Y[i]==Y[i+1])S=fabs(X[i+1]-X[i]);
| ^~~~
| labs
a.cc:25:56: error: 'fabs' was not declared in this scope; did you mean 'labs'?
25 | if((X[i]-X[i+1])*(Y[i]-Y[i+1])>0)S=max(fabs(X[i+1]-X[i]),fabs(Y[i+1]-Y[i]));
| ^~~~
| labs
a.cc:26:52: error: 'fabs' was not declared in this scope; did you mean 'labs'?
26 | if((X[i]-X[i+1])*(Y[i]-Y[i+1])<0)S=fabs(X[i+1]-X[i])+fabs(Y[i+1]-Y[i]);
| ^~~~
| labs
|
s850711268 | p00517 | C++ | #include<stdio.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<sstream>
#include<math.h>
#define FOR(i,a) for(int i=0;i<a;i++)
using namespace std;
int main() {
int w,h,n;
cin >> w >> h >> n;
int pos[n][2];
FOR(i,n) {
cin >> pos[i][0] >> pos[i][1];
}
int count = 0;
FOR(i, n - 1) {
if(pos[i][0]>pos[i+1][0] && pos[i][1]>pos[i + 1][1])
count+= pos[i][0]-pos[i+1][0]+ pos[i][1] - pos[i+1][1]-min(pos[i + 1][0] - pos[i][0], pos[i + 1][1] - pos[i][1])
else if (pos[i][0]>pos[i + 1][0] && pos[i][1]<pos[i + 1][1])
count += pos[i][0] - pos[i+1][0] + pos[i][1] - pos[i][1])
else if (pos[i][0]<pos[i + 1][0] && pos[i][1]<pos[i + 1][1])
count += pos[i+1][0] - pos[i][0] + pos[i+1][1] - pos[i][1] - min(pos[i][0] - pos[i+1][0], pos[i][1] - pos[i+1][1])
else if (pos[i][0]<pos[i + 1][0] && pos[i][1]>pos[i + 1][1])
count += pos[i+1][0] - pos[i][0] + pos[i][1] - pos[i + 1][1])
}
cout << count << end;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:137: error: expected ';' before 'else'
19 | count+= pos[i][0]-pos[i+1][0]+ pos[i][1] - pos[i+1][1]-min(pos[i + 1][0] - pos[i][0], pos[i + 1][1] - pos[i][1])
| ^
| ;
20 | else if (pos[i][0]>pos[i + 1][0] && pos[i][1]<pos[i + 1][1])
| ~~~~
a.cc:27:23: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
27 | cout << count << end;
| ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no know |
s359768233 | p00517 | C++ | #include<stdio.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<sstream>
#include<math.h>
#define FOR(i,a) for(int i=0;i<a;i++)
using namespace std;
int main() {
int w,h,n;
cin >> w >> h >> n;
int pos[n][2];
FOR(i,n) {
cin >> pos[i][0] >> pos[i][1];
}
int count = 0;
FOR(i, n - 1) {
if (pos[i][0] > pos[i + 1][0] && pos[i][1] > pos[i + 1][1])
count += pos[i][0] - pos[i + 1][0] + pos[i][1] - pos[i + 1][1] - min(pos[i + 1][0] - pos[i][0], pos[i + 1][1] - pos[i][1]);
else if (pos[i][0] > pos[i + 1][0] && pos[i][1] < pos[i + 1][1])
count += pos[i][0] - pos[i + 1][0] + pos[i][1] - pos[i][1];
else if (pos[i][0] < pos[i + 1][0] && pos[i][1] < pos[i + 1][1])
count += pos[i + 1][0] - pos[i][0] + pos[i + 1][1] - pos[i][1] - min(pos[i][0] - pos[i + 1][0], pos[i][1] - pos[i + 1][1]);
else if (pos[i][0]<pos[i + 1][0] && pos[i][1]>pos[i + 1][1])
count += pos[i + 1][0] - pos[i][0] + pos[i][1] - pos[i + 1][1];
}
cout << count << end;
return 0;
} | a.cc: In function 'int main()':
a.cc:27:23: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
27 | cout << count << end;
| ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
|
s492449387 | p00517 | C++ | #include "iostream"
#include "stdafx.h"
#include "stdio.h"
#define fo(i,a) for(i=0;i<a;i++)
using namespace std;
int main()
{
int i, n, x, y, ans, w[1000000], h[1000000];
scanf("%d", &n);
fo(i, n) scanf("%d%d", &w[i], &h[i] );
fo(i, n) {
if ((w[i] > w[i] && h[i] < h[i - 1]) || (w[i] < w[i - 1] && h[i] < h[i - 1]))
ans += max(abs(w[i] - w[i - 1]), abs(h[i] - h[i - 1]));
else
ans = abs(w[i] - w[i - 1]) + abs(h[i] - h[i - 1]);
}
printf("%d\n", ans);
return 0;
}
| a.cc:2:10: fatal error: stdafx.h: No such file or directory
2 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s622711836 | p00517 | C++ | #include <iostream>
#include <stdafx.h>
#include <stdio.h>
#define fo(i,a) for(i=0;i<a;i++)
using namespace std;
int main()
{
int i, n, x, y, ans, w[1000000], h[1000000];
scanf("%d", &n);
fo(i, n) scanf("%d%d", &w[i], &h[i] );
fo(i, n) {
if ((w[i] > w[i] && h[i] < h[i - 1]) || (w[i] < w[i - 1] && h[i] < h[i - 1]))
ans += max(abs(w[i] - w[i - 1]), abs(h[i] - h[i - 1]));
else
ans = abs(w[i] - w[i - 1]) + abs(h[i] - h[i - 1]);
}
printf("%d\n", ans);
return 0;
}
| a.cc:2:10: fatal error: stdafx.h: No such file or directory
2 | #include <stdafx.h>
| ^~~~~~~~~~
compilation terminated.
|
s380556840 | p00517 | C++ | #include <iostream>
#include <stdafx.h>
#include <stdio.h>
#define fo(i,a) for(i=0;i<a;i++)
using namespace std;
int main()
{
int i, n, x, y, ans, w[1000000], h[1000000];
scanf("%d", &n);
fo(i, n) scanf("%d%d", &w[i], &h[i] );
fo(i, n) {
if ((w[i] > w[i] && h[i] < h[i - 1]) || (w[i] < w[i - 1] && h[i] < h[i - 1]))
ans += max(abs(w[i] - w[i - 1]), abs(h[i] - h[i - 1]));
else
ans = abs(w[i] - w[i - 1]) + abs(h[i] - h[i - 1]);
}
printf("%d\n", ans);
return 0;
}
| a.cc:2:10: fatal error: stdafx.h: No such file or directory
2 | #include <stdafx.h>
| ^~~~~~~~~~
compilation terminated.
|
s736866090 | p00517 | C++ | #include <iostream>
#include <stdafx.h>
#include <stdio.h>
#define fo(i,a) for(i=0;i<a;i++)
using namespace std;
int main()
{
int i, n, x, y, ans, w[1000000], h[1000000];
scanf("%d", &n);
fo(i, n) scanf("%d%d", &w[i], &h[i] );
fo(i, n) {
if ((w[i] > w[i] && h[i] < h[i - 1]) || (w[i] < w[i - 1] && h[i] < h[i - 1]))
ans += max(abs(w[i] - w[i - 1]), abs(h[i] - h[i - 1]));
else
ans = abs(w[i] - w[i - 1]) + abs(h[i] - h[i - 1]);
}
printf("%d\n", ans);
return 0;
}
| a.cc:2:10: fatal error: stdafx.h: No such file or directory
2 | #include <stdafx.h>
| ^~~~~~~~~~
compilation terminated.
|
s423750000 | p00517 | C++ | #include <iostream>
#include <stdafx.h>
#include <stdio.h>
#define fo(i,a) for(i=0;i<a;i++)
using namespace std;
int main()
{
int i, n, x, y, ans, w[1000000], h[1000000];
scanf("%d", &n);
fo(i, n) scanf("%d%d", &w[i], &h[i] );
fo(i, n) {
if ((w[i] > w[i] && h[i] < h[i - 1]) || (w[i] < w[i - 1] && h[i] < h[i - 1]))
ans += max(abs(w[i] - w[i - 1]), abs(h[i] - h[i - 1]));
else
ans = abs(w[i] - w[i - 1]) + abs(h[i] - h[i - 1]);
}
printf("%d\n", ans);
return 0;
}
| a.cc:2:10: fatal error: stdafx.h: No such file or directory
2 | #include <stdafx.h>
| ^~~~~~~~~~
compilation terminated.
|
s192118434 | p00517 | C++ | #include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#define push_back pb
typedef pair<int,int> iP;
using namespace std;
int main(){
int w,h,n;
ll cnt = 0;
cin >> w >> h >> n;
vector<iP> v;
for(int i=0;i<n;i++){
int x,y; cin >> x >> y; v.pb(iP(--x,--y));
}
for(int i=0;i<n-1;i++){
int x = v[i].fr,y = v[i].sc;
int gx = v[i+1].fr,gy = v[i+1].sc;
if(x > gx && y > gy) cnt += max(abs(x - gx),abs(gy-y));
else if(x < gx && y < gy) cnt += max(abs(gx - x),abs(gy-y));
else if(gx != x && gy != y) cnt += abs(gx - x) + abs(gy - y);
else if(gx == x && gy != y) cnt += abs(y - gy);
else if(gx != x && gy == y) cnt += abs(x - gx);
}
cout << cnt << endl;
}
| a.cc:6:9: error: 'pair' does not name a type
6 | typedef pair<int,int> iP;
| ^~~~
a.cc: In function 'int main()':
a.cc:11:3: error: 'll' was not declared in this scope
11 | ll cnt = 0;
| ^~
a.cc:13:10: error: 'iP' was not declared in this scope
13 | vector<iP> v;
| ^~
a.cc:13:12: error: template argument 1 is invalid
13 | vector<iP> v;
| ^
a.cc:13:12: error: template argument 2 is invalid
a.cc:15:31: error: request for member 'pb' in 'v', which is of non-class type 'int'
15 | int x,y; cin >> x >> y; v.pb(iP(--x,--y));
| ^~
a.cc:18:14: error: invalid types 'int[int]' for array subscript
18 | int x = v[i].fr,y = v[i].sc;
| ^
a.cc:19:15: error: invalid types 'int[int]' for array subscript
19 | int gx = v[i+1].fr,gy = v[i+1].sc;
| ^
a.cc:20:18: error: 'y' was not declared in this scope
20 | if(x > gx && y > gy) cnt += max(abs(x - gx),abs(gy-y));
| ^
a.cc:20:22: error: 'gy' was not declared in this scope; did you mean 'gx'?
20 | if(x > gx && y > gy) cnt += max(abs(x - gx),abs(gy-y));
| ^~
| gx
a.cc:20:26: error: 'cnt' was not declared in this scope; did you mean 'int'?
20 | if(x > gx && y > gy) cnt += max(abs(x - gx),abs(gy-y));
| ^~~
| int
a.cc:21:31: error: 'cnt' was not declared in this scope; did you mean 'int'?
21 | else if(x < gx && y < gy) cnt += max(abs(gx - x),abs(gy-y));
| ^~~
| int
a.cc:22:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
22 | else if(gx != x && gy != y) cnt += abs(gx - x) + abs(gy - y);
| ^~~
| int
a.cc:23:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
23 | else if(gx == x && gy != y) cnt += abs(y - gy);
| ^~~
| int
a.cc:24:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
24 | else if(gx != x && gy == y) cnt += abs(x - gx);
| ^~~
| int
a.cc:26:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
26 | cout << cnt << endl;
| ^~~
| int
|
s104922047 | p00517 | C++ | #include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define push_back pb
typedef pair<int,int> iP;
using namespace std;
int main(){
int w,h,n;
ll cnt = 0;
cin >> w >> h >> n;
vector<iP> v;
for(int i=0;i<n;i++){
int x,y; cin >> x >> y; v.pb(iP(--x,--y));
}
for(int i=0;i<n-1;i++){
int x = v[i].fr,y = v[i].sc;
int gx = v[i+1].fr,gy = v[i+1].sc;
if(x > gx && y > gy) cnt += max(abs(x - gx),abs(gy-y));
else if(x < gx && y < gy) cnt += max(abs(gx - x),abs(gy-y));
else if(gx != x && gy != y) cnt += abs(gx - x) + abs(gy - y);
else if(gx == x && gy != y) cnt += abs(y - gy);
else if(gx != x && gy == y) cnt += abs(x - gx);
}
cout << cnt << endl;
}
| a.cc:7:9: error: 'pair' does not name a type
7 | typedef pair<int,int> iP;
| ^~~~
a.cc: In function 'int main()':
a.cc:12:3: error: 'll' was not declared in this scope
12 | ll cnt = 0;
| ^~
a.cc:14:10: error: 'iP' was not declared in this scope
14 | vector<iP> v;
| ^~
a.cc:14:12: error: template argument 1 is invalid
14 | vector<iP> v;
| ^
a.cc:14:12: error: template argument 2 is invalid
a.cc:16:31: error: request for member 'pb' in 'v', which is of non-class type 'int'
16 | int x,y; cin >> x >> y; v.pb(iP(--x,--y));
| ^~
a.cc:19:14: error: invalid types 'int[int]' for array subscript
19 | int x = v[i].fr,y = v[i].sc;
| ^
a.cc:20:15: error: invalid types 'int[int]' for array subscript
20 | int gx = v[i+1].fr,gy = v[i+1].sc;
| ^
a.cc:21:18: error: 'y' was not declared in this scope
21 | if(x > gx && y > gy) cnt += max(abs(x - gx),abs(gy-y));
| ^
a.cc:21:22: error: 'gy' was not declared in this scope; did you mean 'gx'?
21 | if(x > gx && y > gy) cnt += max(abs(x - gx),abs(gy-y));
| ^~
| gx
a.cc:21:26: error: 'cnt' was not declared in this scope; did you mean 'int'?
21 | if(x > gx && y > gy) cnt += max(abs(x - gx),abs(gy-y));
| ^~~
| int
a.cc:22:31: error: 'cnt' was not declared in this scope; did you mean 'int'?
22 | else if(x < gx && y < gy) cnt += max(abs(gx - x),abs(gy-y));
| ^~~
| int
a.cc:23:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
23 | else if(gx != x && gy != y) cnt += abs(gx - x) + abs(gy - y);
| ^~~
| int
a.cc:24:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
24 | else if(gx == x && gy != y) cnt += abs(y - gy);
| ^~~
| int
a.cc:25:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
25 | else if(gx != x && gy == y) cnt += abs(x - gx);
| ^~~
| int
a.cc:27:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
27 | cout << cnt << endl;
| ^~~
| int
|
s113341653 | p00518 | Java | import java.io.*;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
char[] mem={'J','O','I'};
char[] pic=br.readLine().toCharArray();
long[][] dp=new long[n][8];
if(pic[0]=='J'){
dp[0][1]=1;
dp[0][4]=1;
dp[0][6]=1;
dp[0][7]=1;
}
if(pic[0]=='O'){
dp[0][4]=1;
dp[0][7]=1;
}
if(pic[0]=='I'){
dp[0][6]=1;
dp[0][7]=1;
}
for(int i=1;i<n;i++){
if(pic[i]=='J'){
dp[i][1]+=dp[i-1][1]+dp[i-1][4]+dp[i-1][6]++dp[i-1][7];
dp[i][4]+=dp[i-1][1]+dp[i-1][2]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][6]+=dp[i-1][1]+dp[i-1][3]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][7]+=dp[i-1][1]+dp[i-1][2]+dp[i-1][3]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
}
if(pic[i]=='O'){
dp[i][2]+=dp[i-1][2]+dp[i-1][4]+dp[i-1][5]++dp[i-1][7];
dp[i][4]+=dp[i-1][2]+dp[i-1][1]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
dp[i][5]+=dp[i-1][2]+dp[i-1][3]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
dp[i][7]+=dp[i-1][2]+dp[i-1][1]+dp[i-1][3]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
}
if(pic[i]=='I'){
dp[i][3]+=dp[i-1][3]+dp[i-1][5]+dp[i-1][6]++dp[i-1][7];
dp[i][5]+=dp[i-1][3]+dp[i-1][2]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][6]+=dp[i-1][3]+dp[i-1][1]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][7]+=dp[i-1][3]+dp[i-1][2]+dp[i-1][1]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
}
}
out.println(dp[n-1][1]+dp[n-1][2]+dp[n-1][3]+dp[n-1][4]+dp[n-1][5]+dp[n-1][6]+dp[n-1][7]/10007);
out.flush();
}
}
} | Main.java:30: error: ';' expected
dp[i][1]+=dp[i-1][1]+dp[i-1][4]+dp[i-1][6]++dp[i-1][7];
^
Main.java:30: error: not a statement
dp[i][1]+=dp[i-1][1]+dp[i-1][4]+dp[i-1][6]++dp[i-1][7];
^
Main.java:36: error: ';' expected
dp[i][2]+=dp[i-1][2]+dp[i-1][4]+dp[i-1][5]++dp[i-1][7];
^
Main.java:36: error: not a statement
dp[i][2]+=dp[i-1][2]+dp[i-1][4]+dp[i-1][5]++dp[i-1][7];
^
Main.java:42: error: ';' expected
dp[i][3]+=dp[i-1][3]+dp[i-1][5]+dp[i-1][6]++dp[i-1][7];
^
Main.java:42: error: not a statement
dp[i][3]+=dp[i-1][3]+dp[i-1][5]+dp[i-1][6]++dp[i-1][7];
^
6 errors
|
s881153766 | p00518 | Java | import java.io.*;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
char[] mem={'J','O','I'};
char[] pic=br.readLine().toCharArray();
long[][] dp=new long[n][8];
if(pic[0]=='J'){
dp[0][1]=1;
dp[0][4]=1;
dp[0][6]=1;
dp[0][7]=1;
}
if(pic[0]=='O'){
dp[0][4]=1;
dp[0][7]=1;
}
if(pic[0]=='I'){
dp[0][6]=1;
dp[0][7]=1;
}
for(int i=1;i<n;i++){
if(pic[i]=='J'){
dp[i][1]+=dp[i-1][1]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][4]+=dp[i-1][1]+dp[i-1][2]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][6]+=dp[i-1][1]+dp[i-1][3]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][7]+=dp[i-1][1]+dp[i-1][2]+dp[i-1][3]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
}
if(pic[i]=='O'){
dp[i][2]+=dp[i-1][2]+dp[i-1][4]+dp[i-1][5]+dp[i-1][7];
dp[i][4]+=dp[i-1][2]+dp[i-1][1]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
dp[i][5]+=dp[i-1][2]+dp[i-1][3]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
dp[i][7]+=dp[i-1][2]+dp[i-1][1]+dp[i-1][3]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
}
if(pic[i]=='I'){
dp[i][3]+=dp[i-1][3]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][5]+=dp[i-1][3]+dp[i-1][2]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][6]+=dp[i-1][3]+dp[i-1][1]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][7]+=dp[i-1][3]+dp[i-1][2]+dp[i-1][1]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
}
}
out.println(dp[n-1][1]+dp[n-1][2]+dp[n-1][3]+dp[n-1][4]+dp[n-1][5]+dp[n-1][6]+dp[n-1][7]/10007);
out.flush();
}
}
} | Main.java:9: error: cannot find symbol
while((line=br.readLine())!=null&&!line.isEmpty()){
^
symbol: variable line
location: class Main
Main.java:9: error: cannot find symbol
while((line=br.readLine())!=null&&!line.isEmpty()){
^
symbol: variable line
location: class Main
Main.java:10: error: cannot find symbol
int n=Integer.parseInt(line);
^
symbol: variable line
location: class Main
3 errors
|
s678451989 | p00518 | Java | import java.io.*;
import java.util.Arrays;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if(i>>0&1&&i>>pic[0]&1) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<(1<<3);j++){
for(int k=0;k<(1<<3);k++){
if(j>>pic[i]&1&&k>>pic[i]&1) dp[i][k]+=dp[i-1][j];
if(!j>>pic[i]&1&&k>>pic[i]&1&&j&k!=0) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<=7;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}
public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
} | Main.java:19: error: bad operand types for binary operator '&&'
if(i>>0&1&&i>>pic[0]&1) dp[0][i]=1;
^
first type: int
second type: int
Main.java:24: error: bad operand types for binary operator '&&'
if(j>>pic[i]&1&&k>>pic[i]&1) dp[i][k]+=dp[i-1][j];
^
first type: int
second type: int
Main.java:25: error: bad operand type int for unary operator '!'
if(!j>>pic[i]&1&&k>>pic[i]&1&&j&k!=0) dp[i][k]+=dp[i-1][j];
^
Main.java:25: error: bad operand types for binary operator '&'
if(!j>>pic[i]&1&&k>>pic[i]&1&&j&k!=0) dp[i][k]+=dp[i-1][j];
^
first type: int
second type: boolean
4 errors
|
s568720215 | p00518 | Java | import java.io.*;
import java.util.Arrays;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if(i>>(1<<0)&1==0&&i>>pic[0]&1==0) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<(1<<3);j++){
for(int k=0;k<(1<<3);k++){
if(j>>pic[i]&1==0&&k>>pic[i]&1==0) dp[i][k]+=dp[i-1][j];
if(!j>>pic[i]&1==0&&k>>pic[i]&1==0&&j&k!=0) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<=7;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}
public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
} | Main.java:19: error: bad operand types for binary operator '&'
if(i>>(1<<0)&1==0&&i>>pic[0]&1==0) dp[0][i]=1;
^
first type: int
second type: boolean
Main.java:19: error: bad operand types for binary operator '&'
if(i>>(1<<0)&1==0&&i>>pic[0]&1==0) dp[0][i]=1;
^
first type: int
second type: boolean
Main.java:24: error: bad operand types for binary operator '&'
if(j>>pic[i]&1==0&&k>>pic[i]&1==0) dp[i][k]+=dp[i-1][j];
^
first type: int
second type: boolean
Main.java:24: error: bad operand types for binary operator '&'
if(j>>pic[i]&1==0&&k>>pic[i]&1==0) dp[i][k]+=dp[i-1][j];
^
first type: int
second type: boolean
Main.java:25: error: bad operand type int for unary operator '!'
if(!j>>pic[i]&1==0&&k>>pic[i]&1==0&&j&k!=0) dp[i][k]+=dp[i-1][j];
^
Main.java:25: error: bad operand types for binary operator '&'
if(!j>>pic[i]&1==0&&k>>pic[i]&1==0&&j&k!=0) dp[i][k]+=dp[i-1][j];
^
first type: int
second type: boolean
Main.java:25: error: bad operand types for binary operator '&'
if(!j>>pic[i]&1==0&&k>>pic[i]&1==0&&j&k!=0) dp[i][k]+=dp[i-1][j];
^
first type: int
second type: boolean
7 errors
|
s242896105 | p00518 | Java |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.*;
import java.util.Arrays;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if((i>>(1<<0)&1)&&(i>>pic[0]&1)) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<(1<<3);j++){
for(int k=0;k<(1<<3);k++){
if((j>>pic[i]&1==0)&&(k>>pic[i]&1==0)) dp[i][k]+=dp[i-1][j];
if((!j>>pic[i]&1==0)&&(k>>pic[i]&1==0)&&(j&k!=0)) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<=7;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}
public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
} | Main.java:2: error: class, interface, enum, or record expected
1
^
Main.java:45: error: class, interface, enum, or record expected
import java.util.Arrays;
^
2 errors
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.