submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s339232878 | p03774 | Java | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception{
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int m = scn.nextInt();
int[][] a = new int[n][2];
for(int i=0; i<n; i++){
for(int j=0; j<2; j++){
a[i][j] = scn.nextInt();
}
}
int[] c = new int[m][2];
for(int i=0; i<m; i++){
for(int j=0; j<2; j++){
c[i][j] = scn.nextInt();
}
}
for(int i=0; i<n; i++) {
int min = Math.pow(10, 8);
int min2 = 0;
for(int j=0; j<m; j++) {
int x = Math.abs(a[i][0]-c[j][0])+Math.abs(a[i][1]-c[j][1]);
if(x<min) {
min = x;
min2 = j;
}
}
System.out.println(min2 + 1);
}
} | Main.java:32: error: reached end of file while parsing
}
^
1 error
|
s153915545 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,M,min_i,min_j,check;
cin >> N >> M;
vector<int> a(N);vector<int> b(N);vector<int> c(M);vector<int> d(M);
for(int i=0; i<N; i++) cin >> a.at(i) >> b.at(i);
for(int i=0; i<M; i++) cin >> c.at(i) >> d.at(i);
for(int i=0; i<N; i++){
min_i = abs(a.at(i)-c.at(0))+abs(b.at(i)-d.at(i));
check=1;
for(int j=0; j<M; j++){
min_j = abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j));
if(min_i>min_j) {
min_i = min_j;
check = 1 + j;
}
}
cout << check << endl; | a.cc: In function 'int main()':
a.cc:21:27: error: expected '}' at end of input
21 | cout << check << endl;
| ^
a.cc:11:25: note: to match this '{'
11 | for(int i=0; i<N; i++){
| ^
a.cc:21:27: error: expected '}' at end of input
21 | cout << check << endl;
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s559102005 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
int man(int x1, int x2, int y1, int y2) {
return abs(x1-x2)+abs(y1-y2);
}
void solve() {
int n, m;
cin >> n >> m;
vector<pair<int,int>> a(n), b(m);
for(int i=0; i<n; ++i) cin >> a.at(i).first >> a.at(i).second;
for(int i=0; i<m; ++i) cin >> b.at(i).first >> b.at(i).second;
for(int i=0; i<n; ++i) {
int min=100, d, ans=0;
for(int j=0; j<n; ++j) {
d = man(a.at(i).first, b.at(j).first, a.at(i).second, b.at(j).second);
if(min>d) {
#include <bits/stdc++.h>
using namespace std;
#define ll long long
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
int man(int x1, int x2, int y1, int y2) {
return abs(x1-x2)+abs(y1-y2);
}
void solve() {
int n, m;
cin >> n >> m;
vector<pair<int,int>> a(n), b(m);
for(int i=0; i<n; ++i) cin >> a.at(i).first >> a.at(i).second;
for(int i=0; i<m; ++i) cin >> b.at(i).first >> b.at(i).second;
for(int i=0; i<n; ++i) {
int min=100, d, ans=0;
for(int j=0; j<m; ++j) {
d = man(a.at(i).first, b.at(j).first, a.at(i).second, b.at(j).second);
if(min>d) {
min=d; ans=j+1;
}
}
cout << ans << endl;
}
return;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T=1;
//cin >> T;
while(T--) solve();
return 0;
}
min=d; ans=j+1;
}
}
cout << ans << endl;
}
return;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T=1;
//cin >> T;
while(T--) solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:29:1: error: a template declaration cannot appear at block scope
29 | template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
| ^~~~~~~~
a.cc:35:14: error: a function-definition is not allowed here before '{' token
35 | void solve() {
| ^
a.cc:56:12: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
56 | signed main() {
| ^~
a.cc:56:12: note: remove parentheses to default-initialize a variable
56 | signed main() {
| ^~
| --
a.cc:56:12: note: or replace parentheses with braces to value-initialize a variable
a.cc:56:15: error: a function-definition is not allowed here before '{' token
56 | signed main() {
| ^
|
s682239469 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
int main() {
ll N,M;
cin>>N>>M;
vector<vector<ll>> A(2,vector<ll>(N));
for(ll i=0;i<N;i++) {
cin>>vec[0][i]>>vec[1][i];
}
vector<vector<ll>> B(2,vector<ll>(M));
for(ll i=0;i<M;i++) {
cin>>B[0][i]>>B[1][i];
}
for(ll i=0;i<N;i++) {
ll place;
ll L=10000000000;
for(ll j=0;j<M;j++) {
if(L>abs(A[0][i]-B[0][j])+abs(A[1][i]-B[1][j]) {
place=j+1;
L=abs(A[0][i]-B[0][j])+abs(A[1][i]-B[1][j];
}
}
cout<<place<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:11:6: error: 'vec' was not declared in this scope
11 | cin>>vec[0][i]>>vec[1][i];
| ^~~
a.cc:23:49: error: expected ')' before '{' token
23 | if(L>abs(A[0][i]-B[0][j])+abs(A[1][i]-B[1][j]) {
| ~ ^~
| )
a.cc:27:32: error: expected primary-expression before '}' token
27 | }
| ^
|
s756467603 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);} // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} // b進数の各位の和?
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和
//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
/*CODE START HERE*/
int main() {
int n,m;
cin >> n >> m;
vii s(n);
vii ch(m) ;
for ( int i=0 ; i<n ; i++){
int a,b;
cin >> a >> b;
s.at(i) = make_pair(a,b) ;
}
forn(i,m){
int a,b;
cin >> a >> b;
ch.at(i) = make_pair(a,b) ;
}
int ans ;
int64_t mindis = 1000000000000000 ;
forn(j,n){
int c,d;
tie(c,d) = s.at(j);
forn(i,m){
int dis=0;
int a,b;
tie (a,b) = ch.at(i);
dis = abs(a-c)+abs(b-d) ;
if ( mindis > dis){
ans = i+1 ;
mindis = dis ;
}
cout << ans << endl;
}
}
| a.cc: In function 'int main()':
a.cc:89:2: error: expected '}' at end of input
89 | }
| ^
a.cc:56:12: note: to match this '{'
56 | int main() {
| ^
|
s656366232 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
define inf 1072114514
define llinf 4154118101919364364
define mod 1000000007
define pi 3.1415926535897932384
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);} // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} // b進数の各位の和?
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和
//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
int forr(i,a,b) for(int i=(a); i<(b); i++)
define clean(arr,val) memset(arr,val,sizeof(arr))
int forn(i,n) forr(i,0,n)
define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
/*CODE START HERE*/
int main() {
int n,m;
cin >> n >> m;
vii s(n);
vii ch(m) ;
for ( int i=0 ; i<n ; i++){
cin >> s.at(i).at(0) >> s.at(i).at(1) ;
}
forn(i,m){
cin >> ch.at(i).at(0) >> ch.at(i).at(1) ;
}
int ans ;
int64_t mindis = 1000000000000000 ;
forn(i,m){
int dis=0;
forn(j,n){
dis += abs(ch.at(i).at(0)-s.at(j).at(0))+abs(ch.at(i).at(1)-s.at(j).at(1)) ;
}
if ( mindis > dis){
ans = i+1 ;
mindis = dis ;
}
}
cout << ans << endl;
} | a.cc:4:1: error: 'define' does not name a type
4 | define inf 1072114514
| ^~~~~~
a.cc:47:10: error: 'i' was not declared in this scope; did you mean 'ii'?
47 | int forr(i,a,b) for(int i=(a); i<(b); i++)
| ^
| ii
a.cc:47:12: error: 'a' was not declared in this scope
47 | int forr(i,a,b) for(int i=(a); i<(b); i++)
| ^
a.cc:47:14: error: 'b' was not declared in this scope
47 | int forr(i,a,b) for(int i=(a); i<(b); i++)
| ^
a.cc:47:15: error: expression list treated as compound expression in initializer [-fpermissive]
47 | int forr(i,a,b) for(int i=(a); i<(b); i++)
| ^
a.cc:47:32: error: 'i' does not name a type; did you mean 'ii'?
47 | int forr(i,a,b) for(int i=(a); i<(b); i++)
| ^
| ii
a.cc:47:39: error: 'i' does not name a type; did you mean 'ii'?
47 | int forr(i,a,b) for(int i=(a); i<(b); i++)
| ^
| ii
a.cc: In function 'int main()':
a.cc:62:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
62 | cin >> s.at(i).at(0) >> s.at(i).at(1) ;
| ^~
a.cc:62:37: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
62 | cin >> s.at(i).at(0) >> s.at(i).at(1) ;
| ^~
a.cc:64:8: error: 'i' was not declared in this scope
64 | forn(i,m){
| ^
a.cc:64:3: error: 'forn' was not declared in this scope; did you mean 'forr'?
64 | forn(i,m){
| ^~~~
| forr
|
s926826629 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
define inf 1072114514
define llinf 4154118101919364364
define mod 1000000007
define pi 3.1415926535897932384
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);} // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} // b進数の各位の和?
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和
//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
define forr(i,a,b) for(int i=(a); i<(b); i++)
define clean(arr,val) memset(arr,val,sizeof(arr))
define forn(i,n) forr(i,0,n)
define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
/*CODE START HERE*/
int main() {
int n,m;
cin >> n >> m;
vii s(n);
vii ch(m) ;
for ( int i=0 ; i<n ; i++){
cin >> s.at(i).at(0) >> s.at(i).at(1) ;
}
forn(i,m){
cin >> ch.at(i).at(0) >> ch.at(i).at(1) ;
}
int ans ;
int64_t mindis = 1000000000000000 ;
forn(i,m){
int dis=0;
forn(j,n){
dis += abs(ch.at(i).at(0)-s.at(j).at(0))+abs(ch.at(i).at(1)-s.at(j).at(1)) ;
}
if ( mindis > dis){
ans = i+1 ;
mindis = dis ;
}
}
cout << ans << endl;
} | a.cc:4:1: error: 'define' does not name a type
4 | define inf 1072114514
| ^~~~~~
a.cc:47:1: error: 'define' does not name a type
47 | define forr(i,a,b) for(int i=(a); i<(b); i++)
| ^~~~~~
a.cc:47:35: error: 'i' does not name a type; did you mean 'ii'?
47 | define forr(i,a,b) for(int i=(a); i<(b); i++)
| ^
| ii
a.cc:47:42: error: 'i' does not name a type; did you mean 'ii'?
47 | define forr(i,a,b) for(int i=(a); i<(b); i++)
| ^
| ii
a.cc: In function 'int main()':
a.cc:62:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
62 | cin >> s.at(i).at(0) >> s.at(i).at(1) ;
| ^~
a.cc:62:37: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
62 | cin >> s.at(i).at(0) >> s.at(i).at(1) ;
| ^~
a.cc:64:8: error: 'i' was not declared in this scope
64 | forn(i,m){
| ^
a.cc:64:3: error: 'forn' was not declared in this scope; did you mean 'fork'?
64 | forn(i,m){
| ^~~~
| fork
|
s549906471 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);} // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} // b進数の各位の和?
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和
//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
/*CODE START HERE*/
int main() {
int n,m;
cin >> n >> m;
vii s(n);
vii ch(m) ;
for ( int i=0 ; i<n ; i++){
cin >> s.at(i).at(0) >> s.at(i).at(1) ;
}
forn(i,m){
cin >> ch.at(i).at(0) >> ch.at(i).at(1) ;
}
int ans ;
int64_t mindis = 1000000000000000 ;
forn(i,m){
int dis=0;
forn(j,n){
dis += abs(ch.at(i).at(0)-s.at(j).at(0))+abs(ch.at(i).at(1)-s.at(j).at(1)) ;
}
if ( mindis > dis){
ans = i+1 ;
mindis = dis ;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:62:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
62 | cin >> s.at(i).at(0) >> s.at(i).at(1) ;
| ^~
a.cc:62:37: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
62 | cin >> s.at(i).at(0) >> s.at(i).at(1) ;
| ^~
a.cc:65:21: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
65 | cin >> ch.at(i).at(0) >> ch.at(i).at(1) ;
| ^~
a.cc:65:39: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
65 | cin >> ch.at(i).at(0) >> ch.at(i).at(1) ;
| ^~
a.cc:72:27: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
72 | dis += abs(ch.at(i).at(0)-s.at(j).at(0))+abs(ch.at(i).at(1)-s.at(j).at(1)) ;
| ^~
a.cc:72:41: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
72 | dis += abs(ch.at(i).at(0)-s.at(j).at(0))+abs(ch.at(i).at(1)-s.at(j).at(1)) ;
| ^~
a.cc:72:61: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
72 | dis += abs(ch.at(i).at(0)-s.at(j).at(0))+abs(ch.at(i).at(1)-s.at(j).at(1)) ;
| ^~
a.cc:72:75: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'at'
72 | dis += abs(ch.at(i).at(0)-s.at(j).at(0))+abs(ch.at(i).at(1)-s.at(j).at(1)) ;
| ^~
|
s595359125 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);} // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} // b進数の各位の和?
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和
//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
/*CODE START HERE*/
int main() {
int n,m;
cin >> n >> m;
vii s(n);
vii ch(m) ;
for ( int i=0 ; i<n ; i++){
cin >> s[i][0] >> s[i][1] ;
}
forn(i,m){
cin >> ch[i][0] >> ch[i][1] ;
}
int ans ;
int64_t mindis = 1000000000000000 ;
forn(i,m){
int dis=0;
forn(j,n){
dis += abs(ch[i][0]-s[j][0])+abs(ch[i][1]-s[j][1]) ;
}
if ( mindis > dis){
ans = i+1 ;
mindis = dis ;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:62:16: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
62 | cin >> s[i][0] >> s[i][1] ;
| ^
a.cc:62:27: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
62 | cin >> s[i][0] >> s[i][1] ;
| ^
a.cc:65:17: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
65 | cin >> ch[i][0] >> ch[i][1] ;
| ^
a.cc:65:29: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
65 | cin >> ch[i][0] >> ch[i][1] ;
| ^
a.cc:72:23: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
72 | dis += abs(ch[i][0]-s[j][0])+abs(ch[i][1]-s[j][1]) ;
| ^
a.cc:72:31: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
72 | dis += abs(ch[i][0]-s[j][0])+abs(ch[i][1]-s[j][1]) ;
| ^
a.cc:72:45: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
72 | dis += abs(ch[i][0]-s[j][0])+abs(ch[i][1]-s[j][1]) ;
| ^
a.cc:72:53: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
72 | dis += abs(ch[i][0]-s[j][0])+abs(ch[i][1]-s[j][1]) ;
| ^
|
s573412213 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N , M ;
cin >> N >> M ;
vector<int> A(N) ;
vector <int> B(N) ;
for ( int i=0 ; i<N ; i++){
cin >> A[i] >> B[i] ;
}
vector<int> C(N) ;
vector <int> D(N) ;
for ( int i=0 ; i<M ; i++){
cin >> C[i] >> D[i] ;
}
vector<int> p(N) ;
vector<int> md(N,2000000000) ;
for ( int i=0 ; i<N ; i++){
for ( int j=0 ; j<M ; j++){
if (md[i]>abs(C[j]-A[i])+abs(D[j]-B[i])){
p[i]=j ;
md[i]=abs(C[j]-A[i])+abs(D[j]-B[i]) ;
}
}
}
cout << p[i] << endl;
} | a.cc: In function 'int main()':
a.cc:28:12: error: 'i' was not declared in this scope
28 | cout << p[i] << endl;
| ^
|
s552422138 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N , M ;
cin >> N >> M ;
vector<int> A(N) ;
vector <int> B(N) ;
for ( int i=0 ; i<N ; i++){
cin >> A[i] >> B[i] ;
}
vector<int> C(N) ;
vector <int> D(N) ;
for ( int i=0 ; i<M ; i++){
cin >> C[i] >> D[i] ;
}
vector<int> p(N) ;
vector<int> md(N,2000000000) ;
for ( int i=0 ; i<N ; i++){
for ( int j=0 ; j<M ; j++){
if (md[i]>abs(C[j]-A[i])+abs(D[j]-B[i])){
p[i]=j ;
md[i]=abs(C[j]-A[i])+abs(D[j]-B[i] ;
}
}
}
cout << p[i] << endl;
} | a.cc: In function 'int main()':
a.cc:24:40: error: expected ')' before ';' token
24 | md[i]=abs(C[j]-A[i])+abs(D[j]-B[i] ;
| ~ ^ ~
| )
a.cc:28:12: error: 'i' was not declared in this scope
28 | cout << p[i] << endl;
| ^
|
s098314905 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N , M ;
cin >> N >> M ;
vector<int> A(N) ;
vector <int> B(N) ;
for ( int i=0 ; i<N ; i++){
cin >> A[i] >> B[i] ;
}
vector<int> C(N) ;
vector <int> D(N) ;
for ( int i=0 ; i<M ; i++){
cin >> C[i] >> D[i] ;
}
vector<int> p(N) ;
vector<int> md(N,2000000000) ;
for ( int i=0 ; i<N ; i++){
for ( int j=0 ; j<M ; j++){
if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
p(i)=j ;
md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
}
}
}
cout << p(i) << endl;
} | a.cc: In function 'int main()':
a.cc:22:10: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~~^~~
a.cc:22:19: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~^~~
a.cc:22:24: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~^~~
a.cc:22:34: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~^~~
a.cc:22:39: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~^~~
a.cc:23:7: error: no match for call to '(std::vector<int>) (int&)'
23 | p(i)=j ;
| ~^~~
a.cc:24:8: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~~^~~
a.cc:24:17: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~^~~
a.cc:24:22: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~^~~
a.cc:24:32: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~^~~
a.cc:24:37: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~^~~
a.cc:28:12: error: 'i' was not declared in this scope
28 | cout << p(i) << endl;
| ^
|
s235187440 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N , M ;
cin >> N >> M ;
vector<int> A(N) ;
vector <int> B(N) ;
for ( int i=0 ; i<N ; i++){
cin >> A[i] >> B[i] ;
}
vector<int> C(N) ;
vector <int> D(N) ;
for ( int i=0 ; i<M ; i++){
cin >> C[i] >> D[i] ;
}
vector<int> p(N) ;
vector<int> md(N,2000000000) ;
for ( int i=0 ; i<N ; i++){
for ( int j=0 ; j<M ; j++){
if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
p(i)=j ;
md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
}
}
}
} | a.cc: In function 'int main()':
a.cc:22:10: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~~^~~
a.cc:22:19: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~^~~
a.cc:22:24: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~^~~
a.cc:22:34: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~^~~
a.cc:22:39: error: no match for call to '(std::vector<int>) (int&)'
22 | if (md(i)>abs(C(j)-A(i))+abs(D(j)-B(i))){
| ~^~~
a.cc:23:7: error: no match for call to '(std::vector<int>) (int&)'
23 | p(i)=j ;
| ~^~~
a.cc:24:8: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~~^~~
a.cc:24:17: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~^~~
a.cc:24:22: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~^~~
a.cc:24:32: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~^~~
a.cc:24:37: error: no match for call to '(std::vector<int>) (int&)'
24 | md(i)=abs(C(j)-A(i))+abs(D(j)-B(i) ;
| ~^~~
|
s912354634 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
int a[n][2], c[m][2];
int i, j;
for(i=0; i<n; i++){
cin >> a[i][0] >> a[i][1];
}
for(i=0; i<m; i++){
cin >> c[i][0] >> c[i][1];
}
int dist[n][m];
int minDistIndex[n];
for(i=0; i<n; i++){
for(j=0; j<m; j++){
dist[i][j] = abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1])
}
}
for(i=0; i<n; i++){
int minDist = INT_MAX;
for(j=0; j<m; j++){
if(minDist > dist[i][j]){
minDist = dist[i][j];
minDistIndex[i] = j;
}
cout << minDistIndex[i]+1 << endl;
} | a.cc: In function 'int main()':
a.cc:20:63: error: expected ';' before '}' token
20 | dist[i][j] = abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1])
| ^
| ;
21 | }
| ~
a.cc:32:6: error: expected '}' at end of input
32 | }
| ^
a.cc:24:21: note: to match this '{'
24 | for(i=0; i<n; i++){
| ^
a.cc:32:6: error: expected '}' at end of input
32 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s559123765 | p03774 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<long long> a(n), b(n);
vector<long long> c(m), d(m);
for (int i=0; i<n; i++) {
cin >> a[i];
cin >> b[i];
}
for (int i=0; i<m; i++) {
cin >> c[i];
cin >> d[i];
}
for (int i=0; i<n; i++) {
long long min_dist = LONG_LONG_MAX;
int ans;
for (int j=0; j<m; j++) {
long long dist = abs(a[i]-c[j]) + abs(b[i]-d[j]);
if (dist < min_dist) {
min_dist = dist;
ans = j+1;
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:26: error: 'LONG_LONG_MAX' was not declared in this scope
24 | long long min_dist = LONG_LONG_MAX;
| ^~~~~~~~~~~~~
|
s232816913 | p03774 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<long long> a(n), b(n);
vector<long long> c(m), d(m);
for (int i=0; i<n; i++) {
cin >> a[i];
cin >> b[i];
}
for (int i=0; i<m; i++) {
cin >> c[i];
cin >> d[i];
}
for (int i=0; i<n; i++) {
long long min_dist = LONG_LONG_MAX;
int ans;
for (int j=0; j<m; j++) {
long long dist = abs(a[i]-c[j]) + abs(b[i]-d[j]);
if (dist < min_dist) {
min_dist = dist;
ans = j+1;
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:26: error: 'LONG_LONG_MAX' was not declared in this scope
23 | long long min_dist = LONG_LONG_MAX;
| ^~~~~~~~~~~~~
|
s845904512 | p03774 | C++ | #include<bits/stdc++.h>
#include<math.h>
using namespace std;
int N,M,i,j;
int x0[52],y0[52],x1[52],y1[52];
int main()
{
cin>>N>>M;
for(i=0;i<N;i++){
cin>>x0[i]>>y0[i];
}
for(j=0;j<M;j++){
cin>>x1[j]>>y1[j];
}
for(i=0;i<N;i++){
int min_dist=abs(x0[i]-x1[0])+abs(y0[i]-y1[0]),index=1;
for(j=0;j<M;j++){
const int dist=abs(x0[i]-x1[j])+abs(y0[i]-y1[j]);
if(min_dist>dist){
min_dist=dist;
index=j+1;
}
}
cout<<index<<endl;
}
return 0;
}
| a.cc:6:17: error: 'int y0 [52]' redeclared as different kind of entity
6 | int x0[52],y0[52],x1[52],y1[52];
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:256:1: note: previous declaration 'double y0(double)'
256 | __MATHCALL (y0,, (_Mdouble_));
| ^~~~~~~~~~
a.cc:6:31: error: 'int y1 [52]' redeclared as different kind of entity
6 | int x0[52],y0[52],x1[52],y1[52];
| ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:12:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
12 | cin>>x0[i]>>y0[i];
| ^
a.cc:12:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
12 | cin>>x0[i]>>y0[i];
| ~~~~~~~~~~^~~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
12 | cin>>x0[i]>>y0[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(short int)(y0 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(short unsigned int)(y0 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(int)(y0 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(unsigned int)(y0 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(long int)(y0 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(long unsigned int)(y0 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(long long int)(y0 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(long long unsigned int)(y0 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
12 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:12:25: error: cannot bind rvalue '(void*)(y0 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:12:25: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
12 | ci |
s986559752 | p03774 | C++ | #include<bits/stdc++.h>
#include<math.h>
#define Max 52
using namespace std;
int N,M,i,j;
int x0[Max],y0[Max],x1[Max],y1[Max];
int main()
{
cin>>N>>M;
for(i=0;i<N;i++){
cin>>x0[i]>>y0[i];
}
for(j=0;j<M;j++){
cin>>x1[j]>>y1[j];
}
for(i=0;i<N;i++){
int min_dist=abs(x0[i]-x1[0])+abs(y0[i]-y1[0]);
int index=1;
for(j=0;j<M;j++){
int dist=abs(x0[i]-x1[j])+abs(y0[i]-y1[j]);
if(min_dist>dist){
min_dist=dist;
index=j+1;
}
}
cout<<index<<endl;
}
return 0;
}
| a.cc:7:19: error: 'int y0 [52]' redeclared as different kind of entity
7 | int x0[Max],y0[Max],x1[Max],y1[Max];
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:256:1: note: previous declaration 'double y0(double)'
256 | __MATHCALL (y0,, (_Mdouble_));
| ^~~~~~~~~~
a.cc:7:35: error: 'int y1 [52]' redeclared as different kind of entity
7 | int x0[Max],y0[Max],x1[Max],y1[Max];
| ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:13:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | cin>>x0[i]>>y0[i];
| ^
a.cc:13:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
13 | cin>>x0[i]>>y0[i];
| ~~~~~~~~~~^~~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
13 | cin>>x0[i]>>y0[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(short int)(y0 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(short unsigned int)(y0 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(int)(y0 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(unsigned int)(y0 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(long int)(y0 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(long unsigned int)(y0 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(long long int)(y0 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(long long unsigned int)(y0 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
13 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:13:25: error: cannot bind rvalue '(void*)(y0 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:25: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
1 |
s224732031 | p03774 | C++ | #include<bits/stdc++.h>
#include<math.h>
#define Max 52
using namespace std;
int N,M,i,j;
int x0[Max],y0[Max],x1[Max],y1[Max],a[Max]={0};
int indexx(int a[],int M)
{ int temp=a[0],x;
for(int i=0; i<M; i++) {
if(temp>a[i]) {
temp=a[i];
x=i+1;
}
}
if(temp==a[0]) return 1;
else return x;
}
int main()
{
cin>>N>>M;
for(i=0;i<N;i++){
cin>>x0[i]>>y0[i];
}
for(j=0;j<M;j++){
cin>>x1[j]>>y1[j];
}
for(i=0;i<N;i++){
for(j=0;j<M;j++){
a[j]=abs(x0[i]-x1[j])+abs(y0[i]-y1[j]);
}
cout<<indexx(a,M)<<endl;
}
return 0;
}
| a.cc:7:19: error: 'int y0 [52]' redeclared as different kind of entity
7 | int x0[Max],y0[Max],x1[Max],y1[Max],a[Max]={0};
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:256:1: note: previous declaration 'double y0(double)'
256 | __MATHCALL (y0,, (_Mdouble_));
| ^~~~~~~~~~
a.cc:7:35: error: 'int y1 [52]' redeclared as different kind of entity
7 | int x0[Max],y0[Max],x1[Max],y1[Max],a[Max]={0};
| ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:24:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | cin>>x0[i]>>y0[i];
| ^
a.cc:24:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
24 | cin>>x0[i]>>y0[i];
| ~~~~~~~~~~^~~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
24 | cin>>x0[i]>>y0[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(short int)(y0 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(short unsigned int)(y0 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(int)(y0 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(unsigned int)(y0 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(long int)(y0 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(long unsigned int)(y0 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(long long int)(y0 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(long long unsigned int)(y0 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(void*)(y0 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&) |
s460072229 | p03774 | C++ | #include<bits/stdc++.h>
#include<math.h>
#define Max 52
using namespace std;
int N,M,i,j;
int x0[Max],y0[Max],x1[Max],y1[Max],a[Max]={0};
int indexx(int a[],int M)
{ int temp=a[0],x;
for(int i=0; i<M; i++) {
if(temp>a[i]) {
temp=a[i];
x=i+1;
}
}
if(temp==a[0]) return 1;
else return x;
}
int main()
{
cin>>N>>M;
for(i=0;i<N;i++){
cin>>x0[i]>>y0[i];
}
for(j=0;j<M;j++){
cin>>x1[j]>>y1[j];
}
for(i=0;i<N;i++){
for(j=0;j<M;j++){
a[j]=abs(x0[i]-x1[j])+abs(y0[i]-y1[j]);
}
cout<<indexx(a,M)<<endl;
}
return 0;
}
| a.cc:7:19: error: 'int y0 [52]' redeclared as different kind of entity
7 | int x0[Max],y0[Max],x1[Max],y1[Max],a[Max]={0};
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:256:1: note: previous declaration 'double y0(double)'
256 | __MATHCALL (y0,, (_Mdouble_));
| ^~~~~~~~~~
a.cc:7:35: error: 'int y1 [52]' redeclared as different kind of entity
7 | int x0[Max],y0[Max],x1[Max],y1[Max],a[Max]={0};
| ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:24:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | cin>>x0[i]>>y0[i];
| ^
a.cc:24:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
24 | cin>>x0[i]>>y0[i];
| ~~~~~~~~~~^~~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
24 | cin>>x0[i]>>y0[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(short int)(y0 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(short unsigned int)(y0 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(int)(y0 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(unsigned int)(y0 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(long int)(y0 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(long unsigned int)(y0 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(long long int)(y0 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(long long unsigned int)(y0 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
24 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:25: error: cannot bind rvalue '(void*)(y0 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:25: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&) |
s455227831 | p03774 | C++ | #include<bits/stdc++.h>
#include<math.h>
using namespace std;
int N,M,i,j;
long long int x0[52],y0[52],x1[52],y1[52],a[52]={0};
int indexx(long long int a[],int M)
{ int temp=a[0],x;
for(int i=0; i<M; i++) {
if(temp>a[i]) {
temp=a[i];
x=i+1;
}
}
if(temp==a[0]) return 1;
else return x;
}
int main()
{
cin>>N>>M;
for(i=0;i<N;i++){
cin>>x0[i]>>y0[i];
}
for(j=0;j<M;j++){
cin>>x1[j]>>y1[j];
}
for(i=0;i<N;i++){
for(j=0;j<M;j++){
a[j]=abs(x0[i]-x1[j])+abs(y0[i]-y1[j]);
}
cout<<indexx(a,M)<<endl;
}
return 0;
}
| a.cc:6:27: error: 'long long int y0 [52]' redeclared as different kind of entity
6 | long long int x0[52],y0[52],x1[52],y1[52],a[52]={0};
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:256:1: note: previous declaration 'double y0(double)'
256 | __MATHCALL (y0,, (_Mdouble_));
| ^~~~~~~~~~
a.cc:6:41: error: 'long long int y1 [52]' redeclared as different kind of entity
6 | long long int x0[52],y0[52],x1[52],y1[52],a[52]={0};
| ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:23:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | cin>>x0[i]>>y0[i];
| ^
a.cc:23:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
23 | cin>>x0[i]>>y0[i];
| ~~~~~~~~~~^~~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
23 | cin>>x0[i]>>y0[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(short int)(y0 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(short unsigned int)(y0 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(int)(y0 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(unsigned int)(y0 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(long int)(y0 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(long unsigned int)(y0 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(long long int)(y0 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(long long unsigned int)(y0 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(void*)(y0 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_i |
s168615176 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int N,M,i,j;
int x0[52],y0[52],x1[52],y1[52],a[52]={0};
int indexx(int a[],int M)
{ int temp=a[0],x;
for(int i=0; i<M; i++) {
if(temp>a[i]) {
temp=a[i];
x=i+1;
}
}
if(temp==a[0]) return 1;
else return x;
}
int main()
{
cin>>N>>M;
for(i=0;i<N;i++){
cin>>x0[i]>>y0[i];
}
for(j=0;j<M;j++){
cin>>x1[j]>>y1[j];
}
for(i=0;i<N;i++){
for(j=0;j<M;j++){
a[j]=abs(x0[i]-x1[j])+abs(y0[i]-y1[j]);
}
cout<<indexx(a,M)<<endl;
}
return 0;
}
| a.cc:6:17: error: 'int y0 [52]' redeclared as different kind of entity
6 | int x0[52],y0[52],x1[52],y1[52],a[52]={0};
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:256:1: note: previous declaration 'double y0(double)'
256 | __MATHCALL (y0,, (_Mdouble_));
| ^~~~~~~~~~
a.cc:6:31: error: 'int y1 [52]' redeclared as different kind of entity
6 | int x0[52],y0[52],x1[52],y1[52],a[52]={0};
| ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:23:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | cin>>x0[i]>>y0[i];
| ^
a.cc:23:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
23 | cin>>x0[i]>>y0[i];
| ~~~~~~~~~~^~~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
23 | cin>>x0[i]>>y0[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(short int)(y0 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(short unsigned int)(y0 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(int)(y0 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(unsigned int)(y0 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(long int)(y0 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(long unsigned int)(y0 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(long long int)(y0 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(long long unsigned int)(y0 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
23 | cin>>x0[i]>>y0[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:23:25: error: cannot bind rvalue '(void*)(y0 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:23:25: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive |
s955816376 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
vector<pair<int,int>> a(n);
vector<pair<int,int>> b(m);
for ( int i=0; i<n; i++ ) cin >> a[i].first >> a[i].second;
for ( int i=0; i<m; i++ ) cin >> b[i].first >> b[i].second;
for ( int i=0; i<n; i++ ) {
int ans=0,mi=1e9;
for ( int j=0; j<m; j++ ) {
int x=abs(a[i].first-b[i].first)+abs(a[i].second-b[i].second);
if ( mi>x ) {
mi=x;
ans=j;
}
cout << j+1 << '\n';
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
22 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s904825949 | p03774 | C++ | #include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
ll n,m;
cin >> n>>m;
vector<pair<ll,ll>> student(n);
vector<pair<ll,ll>> check(m);
rep(i,0,n){
cin >> student[i].first;
cin >> student[i].second;
}
rep(i,0,m){
cin>>check[i].first;
cin>>check[i].second;
}
vector<int> ans(n);
rep(i,0,n){
int k = 1000;
rep(j,0,m){
ll now = abs(student[i].first-check[j].first)+abs(student[i].second-check[j].second);
if(now<k){
k = min(now,k);
ans[i]=j;
}
}
}
rep(i,0,n){
cout<<ans[i]+1<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:24: error: no matching function for call to 'min(ll&, int&)'
28 | k = min(now,k);
| ~~~^~~~~~~
In file included 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/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:28:24: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
28 | k = min(now,k);
| ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:28:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
28 | k = min(now,k);
| ~~~^~~~~~~
|
s493490396 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
int n, m, x[55], y[55], x1[55], y1[55];
int main(){
IOS
cin >> n >> m;
for(int i=0;i<n;i++){
cin >> x[i] >> y[i];
}
for(int i=0;i<m;i++){
cin >> x1[i] >> y1[i];
}
for(int i=0;i<n;i++){
int temp;
int mins=inf;
for(int j=0;j<m;j++){
int manhattan=abs(x[i]-x1[j])+abs(y[i]-y1[j]);
if(manhattan<mins) temp=j+1;
mins=min(mins, manhattan);
}
cout << temp << '\n';
}
}
| a.cc:15:38: error: 'int y1 [55]' redeclared as different kind of entity
15 | int n, m, x[55], y[55], x1[55], y1[55];
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:24:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | cin >> x1[i] >> y1[i];
| ^
a.cc:24:30: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
24 | cin >> x1[i] >> y1[i];
| ~~~~~~~~~~~~ ^~ ~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
24 | cin >> x1[i] >> y1[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(short int)(y1 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(short unsigned int)(y1 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(int)(y1 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(unsigned int)(y1 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(long int)(y1 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(long unsigned int)(y1 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(long long int)(y1 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(long long unsigned int)(y1 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(void*)(y1 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37 |
s303630546 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
int n, m, x[55], y[55], x1[55], y1[55];
int main(){
IOS
cin >> n >> m;
for(int i=0;i<n;i++){
cin >> x[i] >> y[i];
}
for(int i=0;i<m;i++){
cin >> x1[i] >> y1[i];
}
for(int i=0;i<n;i++){
int temp;
int mins=inf;
for(int j=0;j<m;j++){
int manhattan=abs(x[i]-x1[j])+abs(y[i]-y1[j]);
if(manhattan<mins) temp=j+1;
mins=min(mins, manhattan);
}
cout << temp << '\n';
}
}
| a.cc:15:38: error: 'int y1 [55]' redeclared as different kind of entity
15 | int n, m, x[55], y[55], x1[55], y1[55];
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:24:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | cin >> x1[i] >> y1[i];
| ^
a.cc:24:30: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
24 | cin >> x1[i] >> y1[i];
| ~~~~~~~~~~~~ ^~ ~~~~~
| | |
| | double(double) noexcept
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
24 | cin >> x1[i] >> y1[i];
| ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(short int)(y1 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(short unsigned int)(y1 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(int)(y1 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(unsigned int)(y1 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(long int)(y1 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(long unsigned int)(y1 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(long long int)(y1 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(long long unsigned int)(y1 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
24 | cin >> x1[i] >> y1[i];
| ~~~~^
| |
| double (*)(double) noexcept
a.cc:24:37: error: cannot bind rvalue '(void*)(y1 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:24:37 |
s199134328 | p03774 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
if (n == 2 || n == 3 || n == 5)
return true;
else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
return false;
else {
for (int i = 5; i <= sqrt(n); i += 2){
if (n%i == 0)
return false;
}
return true;
}
}
int stud[57][2], pnt[57][2],frq[57];
int main(){
Lancer();
ll n, m, res = LLONG_MAX, dis,indx=0;
cin >> n >> m;
for (int i = 0; i < n; i++)
cin >> stud[i][0] >> stud[i][1];
for (int i = 0; i < m; i++)
cin >> pnt[i][0] >> pnt[i][1];
for (int i = 0; i < n; i++){
res = LLONG_MAX;
for (int j = 0; j < m; j++){
if (!frq[j]){
dis = abs(stud[i][0] - pnt[j][0]) + abs(stud[i][1] - pnt[j][1]);
if (dis < res){
indx = j + 1;
res = dis;
}
}
}
frq[indx - 1] = 1;
cout << indx << endl;
}
//cout << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:35:24: error: 'LLONG_MAX' was not declared in this scope
35 | ll n, m, res = LLONG_MAX, dis,indx=0;
| ^~~~~~~~~
a.cc:14:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
13 | #include <list>
+++ |+#include <climits>
14 | #define endl "\n"
a.cc:46:33: error: 'dis' was not declared in this scope; did you mean 'div'?
46 | dis = abs(stud[i][0] - pnt[j][0]) + abs(stud[i][1] - pnt[j][1]);
| ^~~
| div
a.cc:48:41: error: 'indx' was not declared in this scope
48 | indx = j + 1;
| ^~~~
a.cc:53:21: error: 'indx' was not declared in this scope
53 | frq[indx - 1] = 1;
| ^~~~
|
s574040711 | p03774 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
if (n == 2 || n == 3 || n == 5)
return true;
else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
return false;
else {
for (int i = 5; i <= sqrt(n); i += 2){
if (n%i == 0)
return false;
}
return true;
}
}
int stud[57][2], pnt[57][2],frq[57];
int main(){
Lancer();
ll n, m, res = LLONG_MAX, dis,indx=0;
cin >> n >> m;
for (int i = 0; i < n; i++)
cin >> stud[i][0] >> stud[i][1];
for (int i = 0; i < m; i++)
cin >> pnt[i][0] >> pnt[i][1];
for (int i = 0; i < n; i++){
res = LLONG_MAX;
for (int j = 0; j < m; j++){
if (!frq[j]){
dis = abs(stud[i][0] - pnt[j][0]) + abs(stud[i][1] - pnt[j][1]);
if (dis < res){
indx = j + 1;
res = dis;
}
}
}
frq[indx - 1] = 1;
cout << indx << endl;
}
//cout << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:35:24: error: 'LLONG_MAX' was not declared in this scope
35 | ll n, m, res = LLONG_MAX, dis,indx=0;
| ^~~~~~~~~
a.cc:14:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
13 | #include <list>
+++ |+#include <climits>
14 | #define endl "\n"
a.cc:46:33: error: 'dis' was not declared in this scope; did you mean 'div'?
46 | dis = abs(stud[i][0] - pnt[j][0]) + abs(stud[i][1] - pnt[j][1]);
| ^~~
| div
a.cc:48:41: error: 'indx' was not declared in this scope
48 | indx = j + 1;
| ^~~~
a.cc:53:21: error: 'indx' was not declared in this scope
53 | frq[indx - 1] = 1;
| ^~~~
|
s352374070 | p03774 | C++ | #inlude<bits/stdc++.h>
using namespace std;
int dis(int a, int b) {
return max(a - b, b - a);
}
int main () {
int N, M;
cin >> N >> M;
int sx[100];
int sy[100];
int cx[100];
int cy[100];
for (int i = 0; i < N; i ++) cin >> sx[i] >> sy[i];
for (int i = 0; i < M; i ++) cin >> cx[i] >> cy[i];
for (int i = 0; i < N; i ++) {
int ans = 0;
int mdi = 1e9 + 5;
for (int j = M - 1; j >= 0; j --) {
if (mdi >= (dis(sx[i], cx[j]) + dis(sy[i], cy[j]))) {
ans = j + 1;
mdi = dis(sx[i], cx[j]) + dis(sy[i], cy[j]);
}
}
cout << ans << endl;
}
} | a.cc:1:2: error: invalid preprocessing directive #inlude; did you mean #include?
1 | #inlude<bits/stdc++.h>
| ^~~~~~
| include
a.cc: In function 'int dis(int, int)':
a.cc:4:10: error: 'max' was not declared in this scope
4 | return max(a - b, b - a);
| ^~~
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
8 | cin >> N >> M;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #inlude<bits/stdc++.h>
a.cc:24:5: error: 'cout' was not declared in this scope
24 | cout << ans << endl;
| ^~~~
a.cc:24:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:20: error: 'endl' was not declared in this scope
24 | cout << ans << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #inlude<bits/stdc++.h>
|
s115488806 | p03774 | C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,m,gakusei[51][3],point[51][3],s,t=200000001,num,i,j;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
for(j=0;j<2;j++)
scanf("%d",&gakusei[i][j]);
for(i=0;i<m;i++)
for(j=0;j<2;j++)
scanf("%d",&point[i][j]);
for(i=0;i<n;i++){
for(j=0;j<m;j++){
s=abs(gakusei[i][0]-point[j][0])+abs(gakusei[i][1]-point[j][1]);
if(t>s){
t=s;
num=j;
}
}
printf("%d\n",u+1);
t=200000001;
}
return 0;
} | main.c: In function 'main':
main.c:23:31: error: 'u' undeclared (first use in this function)
23 | printf("%d\n",u+1);
| ^
main.c:23:31: note: each undeclared identifier is reported only once for each function it appears in
|
s683386150 | p03774 | C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,m,gakusei[51][3],point[51][3],s,t=200000001,num,i,j;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
for(j=0;j<2;j++)
scanf("%d",&gakusei[i][j]);
for(i=0;i<m;i++)
for(j=0;j<2;j++)
scanf("%d",&point[i][j]);
for(i=0;i<n;i++){
for(j=0;j<m;j++){
s=abs(gakusei[i][0]-point[j][0])+abs(gakusei[i][1]-point[j][1]);
if(t>s){
t=s;
u=j;
}
}
printf("%d\n",u+1);
t=200000001;
}
return 0;
} | main.c: In function 'main':
main.c:20:33: error: 'u' undeclared (first use in this function)
20 | u=j;
| ^
main.c:20:33: note: each undeclared identifier is reported only once for each function it appears in
|
s055632012 | p03774 | C++ | //#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>
using namespace std;
typedef long long ll ;
typedef double db;
typedef vector<ll> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;
#define pf printf
#define sf scanf
#define pb(a) push_back(a)
#define mp make_pair
#define fi first
#define se second
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forab(i,a,b) for(int i=a;i<=b;i++)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define sq(a) (a)*(a)
#define nw "\n"
#define abs(x) fabs(x)
#define pcase(z,x) cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
ll n,m;
cin>>n>>m;
vi a(n),b(n),c(n),d(n);
for0(i,n)cin>>a[i]>>b[i];
for0(i,m)cin>>c[i]>>d[i];
for0(i,n){
ll x,pos,mn =INT_MAX;
for0(j,m){
x = abs(a[i]-c[j]) + abs(b[i]-d[j]);
if(x<mn){
mn = x;
pos=j;
}
}
cout<<pos+1<<nw;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:48:30: error: 'INT_MAX' was not declared in this scope
48 | ll x,pos,mn =INT_MAX;
| ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
14 | #include <iomanip>
+++ |+#include <climits>
15 |
|
s533887616 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
vector<int>a(n);
vector<int>b(n);
vector<int>c(n);
vector<int>d(n);
for(int i=0;i<n;i++){
cin>>a[i]>>b[i];
}
for(int i=0;i<m;i++){
cin>>c[i]>>d[i];
}
for(int i=0;i<n;i++){
int mn=100000000;
int cou=0;
for(int j=0;j<m;j++){
if(mn>abs(a[i]-c[j])+abs(b[i]-d[j])){
mn=abs(a[i]-c[j])+abs(b[i]-d[j]);
cou=j;
}
cout<<cou<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:27:2: error: expected '}' at end of input
27 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s947977077 | p03774 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n=sc.nextInt(),m=sc.nextInt(),e=0;
long[] a=new long[n],b=new long[n],c=new long[m],d=new long[m];
long min=Infinity;
for(int i=0;i<n;i++){
a[i]=sc.nextLong();
b[i]=sc.nextLong();
}
for(int j=0;j<m;j++){
c[j]=sc.nextLong();
d[j]=sc.nextLong();
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
long f=Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j]);
if(min>f){
e=j+1;
min=f;
}
}
System.out.println(e);
}
}
}
| Main.java:9: error: cannot find symbol
long min=Infinity;
^
symbol: variable Infinity
location: class Main
1 error
|
s842823565 | p03774 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n=sc.nextInt(),m=sc.nextInt(),e=0;
long[] a=new long[n],b=new long[n],c=new long[m],d=new long[m];
long min=10000000000;
for(int i=0;i<n;i++){
a[i]=sc.nextLong();
b[i]=sc.nextLong();
}
for(int j=0;j<m;j++){
c[j]=sc.nextLong();
d[j]=sc.nextLong();
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
long f=Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j]);
if(min>f){
e=j+1;
min=f;
}
}
System.out.println(e);
}
}
}
| Main.java:9: error: integer number too large
long min=10000000000;
^
1 error
|
s039785579 | p03774 | C++ | #include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n , m;
cin >> n >> m;
ll a[n][n] , b[m][m];
for (int i = 0 ; i < n ; i++ ) cin >> a[i][0] >> a[i][1];
for (int i = 0 ; i < m ; i++ ) cin >> b[i][0] >> b[i][1];
for (int i = 0 ; i < n ; i++ ) {
ll x = abs( a[i][0] - b[0][0] ) + abs( a[i][1] - b[0][1] ) , y = 1;
for (int j = 0 ; j < m - 1 ; j++ ) {
if ( x > abs( a[i][0] - b[j + 1][0] ) + abs( a[i][1] - b[j + 1][1] ) ) {
y = j + 2;
x = abs( a[i][0] - b[j + 1][0] ) + abs( a[i][1] - b[j + 1][1] );
}
}
cout << y << endl;
} | a.cc: In function 'int main()':
a.cc:30:6: error: expected '}' at end of input
30 | }
| ^
a.cc:13:12: note: to match this '{'
13 | int main() {
| ^
|
s311767278 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,M;
cin >> N >> M;
vector<int> a(N);
vector<int> b(N);
vector<int> c(M);
vector<int> d(M);
for (int i = 0; i < N; i++){
cin >> a.at(i) >> b.at(i);
}
for (int i = 0; i < M; i++){
cin >> c.at(i) >> d.at(i) >> endl;
}
int A = 100000050,B = 100000050,C = 1000000050,D = 100000050;
for (int i = 0; i < N; i++){
for (int j = 0; j < M; j++){
D = abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j));
if (C > D){
C = D;
B = i;
}
if (A >= B){
A = B;
}
}
cout << A << endl;
}
} | a.cc: In function 'int main()':
a.cc:15:31: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and '<unresolved overloaded function type>')
15 | cin >> c.at(i) >> d.at(i) >> endl;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversio |
s592525137 | p03774 | C++ | #include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int absolute_value(int n){
if(n >= 0) return n;
if(n < 0) return -n;
}
int main(){
int N,M;
cin >> N >> M;
vector<vector<int>> student(N, vector<int>(2));
vector<vector<int>> check_point(N, vector<int>(2));
rep(i, N){
cin >> student[i][0] >> student[i][1];
}
rep(i, M){
cin >> check_point[i][0] >>check_point[i][1];
}
rep(i, N){
int min_d = 0;
int P;
rep(j, M){
int d;
d = absolute_value(student[i][0]-check_point[j][0]) + absolute_value(student[i][1]-check_point[j][1]);
if(d < min_d){
min_d = d;
P = i+1
}
}
cout << P << endl;
}
}
| a.cc: In function 'int main()':
a.cc:30:16: error: expected ';' before '}' token
30 | P = i+1
| ^
| ;
31 | }
| ~
a.cc: In function 'int absolute_value(int)':
a.cc:8:1: warning: control reaches end of non-void function [-Wreturn-type]
8 | }
| ^
|
s277645495 | p03774 | C++ | #include/bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int absolute_value(int n){
if(n >= 0) return n;
if(n < 0) return -n;
}
int main(){
int N,M;
cin >> N >> M;
vector<vector<int>> student(N, vector<int>(2));
vector<vector<int>> check_point(N, vector<int>(2));
rep(i, N){
cin >> student[i][0] >> student[i][1];
}
rep(i, M){
cin >> check_point[i][0] >>check_point[i][1];
}
rep(i, N){
int min_d = 0;
int P;
rep(j, M){
int d;
d = absolute_value(student[i][0]-check_point[j][0]) + absolute_value(student[i][1]-check_point[j][1]);
if(d < min_d){
min_d = d;
P = i+1
}
}
cout << P << endl;
}
}
| a.cc:1:9: error: #include expects "FILENAME" or <FILENAME>
1 | #include/bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope
12 | cin >> N >> M;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #include/bits/stdc++.h>
a.cc:13:3: error: 'vector' was not declared in this scope
13 | vector<vector<int>> student(N, vector<int>(2));
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | #include/bits/stdc++.h>
a.cc:13:17: error: expected primary-expression before 'int'
13 | vector<vector<int>> student(N, vector<int>(2));
| ^~~
a.cc:14:17: error: expected primary-expression before 'int'
14 | vector<vector<int>> check_point(N, vector<int>(2));
| ^~~
a.cc:16:12: error: 'student' was not declared in this scope
16 | cin >> student[i][0] >> student[i][1];
| ^~~~~~~
a.cc:19:12: error: 'check_point' was not declared in this scope
19 | cin >> check_point[i][0] >>check_point[i][1];
| ^~~~~~~~~~~
a.cc:27:26: error: 'student' was not declared in this scope
27 | d = absolute_value(student[i][0]-check_point[j][0]) + absolute_value(student[i][1]-check_point[j][1]);
| ^~~~~~~
a.cc:27:40: error: 'check_point' was not declared in this scope
27 | d = absolute_value(student[i][0]-check_point[j][0]) + absolute_value(student[i][1]-check_point[j][1]);
| ^~~~~~~~~~~
a.cc:30:16: error: expected ';' before '}' token
30 | P = i+1
| ^
| ;
31 | }
| ~
a.cc:33:5: error: 'cout' was not declared in this scope
33 | cout << P << endl;
| ^~~~
a.cc:33:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:33:18: error: 'endl' was not declared in this scope
33 | cout << P << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #include/bits/stdc++.h>
a.cc: In function 'int absolute_value(int)':
a.cc:8:1: warning: control reaches end of non-void function [-Wreturn-type]
8 | }
| ^
|
s632413553 | p03774 | C++ | #includ/bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int absolute_value(int n){
if(n >= 0) return n;
if(n < 0) return -n;
}
int main(){
int N,M;
cin >> N >> M;
vector<vector<int>> student(N, vector<int>(2));
vector<vector<int>> check_point(N, vector<int>(2));
rep(i, N){
cin >> student[i][0] >> student[i][1];
}
rep(i, M){
cin >> check_point[i][0] >>check_point[i][1];
}
rep(i, N){
int min_d = 0;
int P;
rep(j, M){
int d;
d = absolute_value(student[i][0]-check_point[j][0]) + absolute_value(student[i][1]-check_point[j][1]);
if(d < min_d){
min_d = d;
P = i+1
}
}
cout << P << endl;
}
}
| a.cc:1:2: error: invalid preprocessing directive #includ; did you mean #include?
1 | #includ/bits/stdc++.h>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope
12 | cin >> N >> M;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #includ/bits/stdc++.h>
a.cc:13:3: error: 'vector' was not declared in this scope
13 | vector<vector<int>> student(N, vector<int>(2));
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | #includ/bits/stdc++.h>
a.cc:13:17: error: expected primary-expression before 'int'
13 | vector<vector<int>> student(N, vector<int>(2));
| ^~~
a.cc:14:17: error: expected primary-expression before 'int'
14 | vector<vector<int>> check_point(N, vector<int>(2));
| ^~~
a.cc:16:12: error: 'student' was not declared in this scope
16 | cin >> student[i][0] >> student[i][1];
| ^~~~~~~
a.cc:19:12: error: 'check_point' was not declared in this scope
19 | cin >> check_point[i][0] >>check_point[i][1];
| ^~~~~~~~~~~
a.cc:27:26: error: 'student' was not declared in this scope
27 | d = absolute_value(student[i][0]-check_point[j][0]) + absolute_value(student[i][1]-check_point[j][1]);
| ^~~~~~~
a.cc:27:40: error: 'check_point' was not declared in this scope
27 | d = absolute_value(student[i][0]-check_point[j][0]) + absolute_value(student[i][1]-check_point[j][1]);
| ^~~~~~~~~~~
a.cc:30:16: error: expected ';' before '}' token
30 | P = i+1
| ^
| ;
31 | }
| ~
a.cc:33:5: error: 'cout' was not declared in this scope
33 | cout << P << endl;
| ^~~~
a.cc:33:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:33:18: error: 'endl' was not declared in this scope
33 | cout << P << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #includ/bits/stdc++.h>
a.cc: In function 'int absolute_value(int)':
a.cc:8:1: warning: control reaches end of non-void function [-Wreturn-type]
8 | }
| ^
|
s723371598 | p03774 | Java | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class B57 {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve() {
int n = ni();
int m = ni();
int[][] position = new int[n][2];
int[][] checkpoint = new int[m][2];
for (int i = 0; i < n; i++) {
position[i][0] = ni();
position[i][1] = ni();
}
for (int i = 0; i < m; i++) {
checkpoint[i][0] = ni();
checkpoint[i][1] = ni();
}
for (int i = 0; i < n; i++) {
int x = position[i][0];
int y = position[i][1];
int distance = Math.abs(checkpoint[0][0] - x) + Math.abs(checkpoint[0][1] - y);
int point = 1;
for (int j = 1; j < m; j++) {
int xc = checkpoint[j][0];
int yc = checkpoint[j][1];
int man = Math.abs(xc - x) + Math.abs(yc - y);
if (distance > man) {
distance = man;
point = j + 1;
}
}
out.println(point);
}
}
public static void main(String[] args) throws Exception {
long S = System.currentTimeMillis();
is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
out = new PrintWriter(System.out);
solve();
out.flush();
long G = System.currentTimeMillis();
tr(G-S+"ms");
}
private static boolean eof() {
if(lenbuf == -1)return true;
int lptr = ptrbuf;
while(lptr < lenbuf)if(!isSpaceChar(inbuf[lptr++]))return false;
try {
is.mark(1000);
while(true){
int b = is.read();
if(b == -1){
is.reset();
return true;
}else if(!isSpaceChar(b)){
is.reset();
return false;
}
}
} catch (IOException e) {
return true;
}
}
private static byte[] inbuf = new byte[1024];
static int lenbuf = 0, ptrbuf = 0;
private static int readByte() {
if(lenbuf == -1)throw new InputMismatchException();
if(ptrbuf >= lenbuf){
ptrbuf = 0;
try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
if(lenbuf <= 0)return -1;
}
return inbuf[ptrbuf++];
}
private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
private static double nd() { return Double.parseDouble(ns()); }
private static char nc() { return (char)skip(); }
private static String ns() {
int b = skip();
StringBuilder sb = new StringBuilder();
while(!(isSpaceChar(b))){
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
private static char[] ns(int n) {
char[] buf = new char[n];
int b = skip(), p = 0;
while(p < n && !(isSpaceChar(b))){
buf[p++] = (char)b;
b = readByte();
}
return n == p ? buf : Arrays.copyOf(buf, p);
}
private static char[][] nm(int n, int m) {
char[][] map = new char[n][];
for(int i = 0;i < n;i++)map[i] = ns(m);
return map;
}
private static int[] na(int n) {
int[] a = new int[n];
for(int i = 0;i < n;i++)a[i] = ni();
return a;
}
private static int ni() {
int num = 0, b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-'){
minus = true;
b = readByte();
}
while(true){
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
b = readByte();
}
}
private static long nl() {
long num = 0;
int b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-'){
minus = true;
b = readByte();
}
while(true){
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
b = readByte();
}
}
private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
// https://algs4.cs.princeton.edu/15uf/UF.java.html
public static class UnionFind {
private int count = 0;
private int[] parent, rank;
public UnionFind(int n) {
count = n;
parent = new int[n];
rank = new int[n];
for (int i = 0; i < n; i++) {
parent[i] = i;
}
}
public int find(int p) {
while (p != parent[p]) {
parent[p] = parent[parent[p]];
p = parent[p];
}
return p;
}
public void union(int p, int q) {
int rootP = find(p);
int rootQ = find(q);
if (rootP ==rootQ) return;
if (rank[rootQ] > rank[rootP]) {
parent[rootP] = rootQ;
} else {
parent[rootQ] = rootP;
if (rank[rootP] == rank[rootQ]) {
rank[rootP]++;
}
}
count--;
}
public int count() {
return count;
}
public void print() {
out.println("Parent:");
for (int i : parent) {
out.print(i);
out.print(" ");
}
out.println();
out.println("Rank:");
for (int i : rank) {
out.print(i);
out.print(" ");
}
out.println();
}
}
}
| Main.java:7: error: class B57 is public, should be declared in a file named B57.java
public class B57 {
^
1 error
|
s670259631 | p03774 | C++ | #define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
ll n,m;
cin >>n>>m;
vector<pair<ll,ll>> a(n);
vector<pair<ll,ll>> c(m);
vector<ll> ans(n);
rep(i,n) cin >>a[i].first>>a[i].second;
rep(i,m) cin >>b[i].first>>b[i].second;
rep(i,n) ans[i]=abs(a[i].first-b[0].first)+abs(a[i].second-b[0].second);
rep(i,n){
rep(j,m-1){
if(abs(a[i].first-b[i].first)+abs(a[i].second-b[i].second)<(abs(a[i].first-b[i+1].first)+abs(a[i].second-b[i+1].second)){
ans[i]=abs(a[i].first-b[i+1].first)+abs(a[i].second-b[i+1].second);
}
}
}
rep(i,n) cout <<amns[i]<<endl;
| a.cc: In function 'int main()':
a.cc:27:18: error: 'b' was not declared in this scope
27 | rep(i,m) cin >>b[i].first>>b[i].second;
| ^
a.cc:28:34: error: 'b' was not declared in this scope
28 | rep(i,n) ans[i]=abs(a[i].first-b[0].first)+abs(a[i].second-b[0].second);
| ^
a.cc:31:25: error: 'b' was not declared in this scope
31 | if(abs(a[i].first-b[i].first)+abs(a[i].second-b[i].second)<(abs(a[i].first-b[i+1].first)+abs(a[i].second-b[i+1].second)){
| ^
a.cc:31:127: error: expected ')' before '{' token
31 | if(abs(a[i].first-b[i].first)+abs(a[i].second-b[i].second)<(abs(a[i].first-b[i+1].first)+abs(a[i].second-b[i+1].second)){
| ~ ^
| )
a.cc:34:10: error: expected primary-expression before '}' token
34 | }
| ^
a.cc:36:26: error: 'amns' was not declared in this scope; did you mean 'ans'?
36 | rep(i,n) cout <<amns[i]<<endl;
| ^~~~
| ans
a.cc:36:40: error: expected '}' at end of input
36 | rep(i,n) cout <<amns[i]<<endl;
| ^
a.cc:20:11: note: to match this '{'
20 | int main(){
| ^
|
s912849543 | p03774 | C++ | #include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define DEC(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const ll LINF = (int)1e18;
const double EPS = 1e-9;
signed main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<pair<int, int>> student;
REP(i, n) {
int a, b;
cin >> a >> b;
student.push_back(a, b);
}
vector<pair<int, int>> point;
REP(i, m) {
int c, d;
cin >> c >> d;
point.push_back(c, d);
}
for (auto s: student) {
int ans = 0;
int distance = LINF;
int idx;
for (auto p: point) {
if (abs(s.first - p.first) + abs(s.second - p.second) < distance)
ans = idx;
++idx;
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:22: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(long long int&, long long int&)'
26 | student.push_back(a, b);
| ~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate expects 1 argument, 2 provided
a.cc:32:20: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(long long int&, long long int&)'
32 | point.push_back(c, d);
| ~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate expects 1 argument, 2 provided
|
s577516095 | p03774 | C++ | #include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define DEC(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const ll LINF = (int)1e18;
const double EPS = 1e-9;
signed main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
string n, m;
cin >> n >> m;
vector<pair<int, int>> student;
REP(i, n) {
int a, b;
cin >> a >> b;
student.push_back(a, b);
}
vector<pair<int, int>> point;
REP(i, m) {
int c, d;
cin >> c >> d;
point.push_back(c, d);
}
for (auto s: student) {
int ans = 0;
int distance = LINF;
int idx;
for (auto p: point) {
if (abs(s.first - p.first) + abs(s.second - p.second) < distance)
ans = idx;
++idx;
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:37: error: no match for 'operator<' (operand types are 'long long int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^ ~~~
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
In file included 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:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::pair<_T1, _T2>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:5:41: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int'
5 | #define REP(i, n) for (int i = 0; i < (n); ++i)
| ^
a.cc:23:3: note: in expansion of macro 'REP'
23 | REP(i, n) {
| ^~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument d |
s904043926 | p03774 | C++ | #include <iostream>
#include <vector>
#include <alogorithm>
using namespace std;
using ll = long long int;
using pll = pair<ll,ll>;
ll dist(pll a, pll b){
return max(abs(a.first-b.first),abs(a.second-b.second));
}
int main(){
int n,m; cin >> n >> m;
vector<pll> stu,chk;
for(int i=0;i<n;i++){
ll a,b; cin >> a >> b;
stu.emplace_back(a-b,a+b);
}
for(int i=0;i<m;i++){
ll a,b; cin >> a >> b;
chk.emplace_back(a-b,a+b);
}
vector<int> ans;
for(int i=0;i<n;i++){
vector<pll> dsc;
for(int j=0;j<m;j++){
dsc.emplace_back(dist(stu[i],chk[j]),j+1);
}
auto itr = min_element(dsc.begin(),dsc.end());
ans.push_back(itr->second);
}
for(auto a:ans) cout << a << "\n";
return 0;
} | a.cc:3:10: fatal error: alogorithm: No such file or directory
3 | #include <alogorithm>
| ^~~~~~~~~~~~
compilation terminated.
|
s949856923 | p03774 | C++ | n,m = gets.split.map(&:to_i)
l = []
o = []
n.times do
a,b = gets.split.map(&:to_i)
l << a
o << b
end
p = []
q = []
m.times do
c,d = gets.split.map(&:to_i)
p << c
q << d
end
(0..n - 1).each do |i|
k = 100000000000000
point = 0
(0..m - 1).each do |j|
dist = (p[j] - l[i]).abs + (q[j] - o[i]).abs
if dist < k
point = j + 1
k = dist
end
end
puts point
end | a.cc:20:2: error: too many decimal points in number
20 | (0..n - 1).each do |i|
| ^~~~
a.cc:23:6: error: too many decimal points in number
23 | (0..m - 1).each do |j|
| ^~~~
a.cc:1:1: error: 'n' does not name a type
1 | n,m = gets.split.map(&:to_i)
| ^
|
s057400646 | p03774 | C++ | #include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
int main() {
long int a,b,c=0;
cin>>a>>b;
vector<pair<long int,long int>>d(a);
vector<pair<long int,long int>>e(b);
rep(i,a)cin>>d[i].first>>d[i].second;
rep(i,b)cin>>e[i].first>>d[i].second;
rep(i,a){
long int f=LONG_MAX,g;
rep(o,b){
g=ads(d[i].first-e[o].first)+ads(d[i].second-e[o].second);
f=min(g,f);
}
c+=f;
}
cout<<c;
}
| a.cc: In function 'int main()':
a.cc:15:9: error: 'ads' was not declared in this scope; did you mean 'abs'?
15 | g=ads(d[i].first-e[o].first)+ads(d[i].second-e[o].second);
| ^~~
| abs
|
s369137322 | p03774 | C++ | #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int main(){
ll n,m;
cin>>n>>m;
vector<ll> a(n),b(n),c(m),d(m),ans(n,-1);
rep(i,n) cin>>a[i]>>b[i];
rep(i,m) cin>>c[i]>>d[i];
rep(i,n){
ll mn=1e9;
rep(j,m){
ll manh=abs(a[i]-c[j])+abs(b[i]-d[j]);
if(mn>manh){
mn=manh;
ans[i]=j+1;
}
}
}
rep(i,n) cout<<a<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:25:18: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<long long int>')
25 | rep(i,n) cout<<a<<endl;
| ~~~~^~~
| | |
| | std::vector<long long int>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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 'std::vector<long long int>' 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<<(nul |
s133459146 | p03774 | C++ | N, M = map(int,input().split())
ab = []
cd = []
for _ in range(N): ab.append(list(map(int,input().split())))
for _ in range(M): cd.append(list(map(int,input().split())))
def distance(x1, x2, y1, y2):
return abs(x1 - x2) + abs(y1 - y2)
ans_distance = [float('inf')] * N
ans = [float('inf')] * N
for i in range(N):
for j in range(M):
#print(distance(ab[i][0], cd[j][0], ab[i][1], cd[j][1]))
if ans_distance[i] > distance(ab[i][0], cd[j][0], ab[i][1], cd[j][1]):
ans_distance[i] = distance(ab[i][0], cd[j][0], ab[i][1], cd[j][1])
ans[i] = j+1
for i in range(N):
print(ans[i]) | a.cc:10:23: warning: multi-character character constant [-Wmultichar]
10 | ans_distance = [float('inf')] * N
| ^~~~~
a.cc:11:14: warning: multi-character character constant [-Wmultichar]
11 | ans = [float('inf')] * N
| ^~~~~
a.cc:14:10: error: invalid preprocessing directive #print
14 | #print(distance(ab[i][0], cd[j][0], ab[i][1], cd[j][1]))
| ^~~~~
a.cc:1:1: error: 'N' does not name a type
1 | N, M = map(int,input().split())
| ^
|
s414121823 | p03774 | C++ | #include<iostream>
using namespace std;
int main(void){
int N,M;
cin >> N >> M;
const int NMMAX=50;
int A[NMMAX],B[NMMAX],C[NMMAX],D[NMMAX];
1
8
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
for(int i=0;i<N;++i){
cin >> A[i] >> B[i];
}
for(int j=0;j<M;++j){
cin >> C[j] >> D[j];
}
for(int i=0;i<N;++i){
int min_dist=abs(A[i]-C[0])+abs(B[i]-D[0]),checkpoint=1;
for(int j=1;j<M;++j){
const int cur_dist=abs(A[i]-C[j])+abs(B[i]-D[j]); if(min_dist>cur_dist){
min_dist=cur_dist;
checkpoint=j+1;
}
}
cout << checkpoint << endl;
}
return 0; } | a.cc: In function 'int main()':
a.cc:8:2: error: expected ';' before numeric constant
8 | 1
| ^
| ;
9 | 8
| ~
a.cc:11:17: error: 'i' was not declared in this scope
11 | for(int i=0;i<N;++i){
| ^
|
s605063549 | p03774 | C++ | int main(void){
int N,M;
cin >> N >> M;
const int NMMAX=50;
int A[NMMAX],B[NMMAX],C[NMMAX],D[NMMAX];
1
8
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
for(int i=0;i<N;++i){
cin >> A[i] >> B[i];
}
for(int j=0;j<M;++j){
cin >> C[j] >> D[j];
}
for(int i=0;i<N;++i){
int min_dist=abs(A[i]-C[0])+abs(B[i]-D[0]),checkpoint=1;
for(int j=1;j<M;++j){
const int cur_dist=abs(A[i]-C[j])+abs(B[i]-D[j]); if(min_dist>cur_dist){
min_dist=cur_dist;
checkpoint=j+1;
}
}
cout << checkpoint << endl;
}
return 0; } | a.cc: In function 'int main()':
a.cc:3:1: error: 'cin' was not declared in this scope
3 | cin >> N >> M;
| ^~~
a.cc:6:2: error: expected ';' before numeric constant
6 | 1
| ^
| ;
7 | 8
| ~
a.cc:9:17: error: 'i' was not declared in this scope
9 | for(int i=0;i<N;++i){
| ^
a.cc:16:14: error: 'abs' was not declared in this scope
16 | int min_dist=abs(A[i]-C[0])+abs(B[i]-D[0]),checkpoint=1;
| ^~~
a.cc:20:17: error: 'checkpoint' was not declared in this scope
20 | checkpoint=j+1;
| ^~~~~~~~~~
a.cc:23:9: error: 'cout' was not declared in this scope
23 | cout << checkpoint << endl;
| ^~~~
a.cc:23:17: error: 'checkpoint' was not declared in this scope
23 | cout << checkpoint << endl;
| ^~~~~~~~~~
a.cc:23:31: error: 'endl' was not declared in this scope
23 | cout << checkpoint << endl;
| ^~~~
|
s776074316 | p03774 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt(),m=sc.nextInt(),ans=0;
int[] a=new int[n],b=new int[n],c=new int[m],d=new int[m];
for(int i=0;i<n;i++) {
a[i]=sc.nextInt();
b[i]=sc.nextInt();
}
for(int i=0;i<m;i++) {
c[i]=sc.nextInt();
d[i]=sc.nextInt();
}
for(int i=0;i<n;i++) {
int dis=2000000000;
for(int j=0;j<m;j++) {
int distance=Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j]);
if(distance<dis) {
dis=Math.min(dis,distance);
ans=j+1;
}
}
System.out.println(ans);
}
sc.close();
}
} | 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:2:1: error: expected unqualified-id before 'public'
2 | public class Main {
| ^~~~~~
|
s985398790 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1000000000;
int main() {
int n,m;cin>>n>>m;
ll an[n],bn[n], cn[m],dn[m];
rep(i,n) cin>>an[i]>>bn[i];
rep(j,m) cin>>cn[j]>>dn[j];
ll d, dmin, dx;
rep(i,n) {
dmin=INF;
rep(j,m) {
d = abs(c[j]-an[i]) + abs(d[j]-bn[i]);
if (d < dmin) {
dmin = d;
dx = j+1;
}
}
cout << dx << endl;
}
}
| a.cc: In function 'int main()':
a.cc:16:15: error: 'c' was not declared in this scope
16 | d = abs(c[j]-an[i]) + abs(d[j]-bn[i]);
| ^
a.cc:16:34: error: invalid types 'll {aka long long int}[int]' for array subscript
16 | d = abs(c[j]-an[i]) + abs(d[j]-bn[i]);
| ^
|
s350933090 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m; cin >> n >> m;
vettor<vector<int>> ab(2,n),cd(2,m);
for(int i=0; i<n; i++){
cin >> ab[0][i] >> ab[1][i];
}
for(int i=0; i<m; i++){
cin >> cd[0][i] >> cd[1][i];
}
vector<int> ans(n);
for(int i=0; i<n; i++){
int x,y;
x = ab[0][i] - cd[0][0]; if(x<0) x*=(-1);
y = ab[1][i] - cd[1][0]; if(y<0) y*=(-1);
ans[i] = x+y;
for(int j=1; j<m; j++){
x = ab[0][i] - cd[0][j]; if(x<0) x*=(-1);
y = ab[1][i] - cd[1][j]; if(y<0) y*=(-1);
if(x+y < ans[i]) ans[i] = x+y;
}
cout << ans[i] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:6:3: error: 'vettor' was not declared in this scope
6 | vettor<vector<int>> ab(2,n),cd(2,m);
| ^~~~~~
a.cc:6:20: error: expected primary-expression before '>' token
6 | vettor<vector<int>> ab(2,n),cd(2,m);
| ^~
a.cc:6:23: error: 'ab' was not declared in this scope; did you mean 'abs'?
6 | vettor<vector<int>> ab(2,n),cd(2,m);
| ^~
| abs
a.cc:6:31: error: 'cd' was not declared in this scope
6 | vettor<vector<int>> ab(2,n),cd(2,m);
| ^~
|
s948121640 | p03774 | C++ | #include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
int n,m;
cin >> n >> m;
vector<P> st(n);
vector<P> ch(m);
rep(i,n) cin >> st[i].first >> st[i].second;
rep(i,m) cin >> ch[i].first >> ch[i].second;
vector<int> ans(n);
rep(i,n) {
int dis = 1001001001;
int num;
rep(j,m) {
int ndis = abs(st[i].first-ch[j].first)+abs(st[i].second-ch[j].second);
if(ndis < dis) num = j;
dis = min(ndis,dis);
}
ans[i] = num+1;
}
rep(i,n) cin >> ans[i] >> endl;
} | a.cc: In function 'int main()':
a.cc:27:28: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and '<unresolved overloaded function type>')
27 | rep(i,n) cin >> ans[i] >> endl;
| ~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversion for |
s730941040 | p03774 | C++ | #include <iostream>
#include <vector>
using namespace std;
using P = pair<int,int>;
int absi(int x){
return int(abs(x));
}
int main(){
int D,n,m,p1,p2;
cin >> n >> m;
vector<P> DaN(n);
vector<P> sts(n);
for(int i=0;i<n;i++){
cin >> sts[i].first >> sts[i].second;
DaN.first = 1e9;
DaN.second = 0;
}
for(int i = 0;i<m;i++){
cin >> p1 >> p2;
for(int j=0;j<n;j++){
D = absi(p1-sts[j].first)+absi(p2-sts[j].second);
if(D<DaN[j].first){
DaN[j].first = D;
DaN[j].second = i;
}
}
}
for(int i=0;i<n;i++){
cout << DaN[i].second+1 << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
15 | DaN.first = 1e9;
| ^~~~~
a.cc:16:9: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
16 | DaN.second = 0;
| ^~~~~~
|
s461739564 | p03774 | C++ | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;
int main(){
int n,m;
cin>>n>>m;
vi a(n);
vi b(n);
vi c(m);
vi d(m);
vi ans(n);
for(int i=0;i<n;i++)cin>>a[i]>>b[i];
for(int i-0;i<m;i++)cin>>c[i]>>d[i];
for(int i=0;i<n;i++){
int MIN=INF;
for(int j=0;j<m;j++){
int d=ads(c[j]-a[i])+ads(b[i]-d[j]);
if(d<MIN){
MIN=d;
ans[i]=j+1;
}
}
}
for(int i=0;i<n;i++)cout<<ans[i]<<endl;
}
| a.cc: In function 'int main()':
a.cc:21:12: error: expected ';' before '-' token
21 | for(int i-0;i<m;i++)cin>>c[i]>>d[i];
| ^
| ;
a.cc:21:18: error: expected ')' before ';' token
21 | for(int i-0;i<m;i++)cin>>c[i]>>d[i];
| ~ ^
| )
a.cc:21:19: error: 'i' was not declared in this scope
21 | for(int i-0;i<m;i++)cin>>c[i]>>d[i];
| ^
a.cc:25:13: error: 'ads' was not declared in this scope; did you mean 'ans'?
25 | int d=ads(c[j]-a[i])+ads(b[i]-d[j]);
| ^~~
| ans
a.cc:25:38: error: invalid types 'int[int]' for array subscript
25 | int d=ads(c[j]-a[i])+ads(b[i]-d[j]);
| ^
|
s545112592 | p03774 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int [] x1 = new int [a];
int [] y1 = new int [a];
int [] x2 = new int [a];
int [] y2 = new int [a];
int [] ans = new int [a];
for(int i=0;i<a;i++){x1[i] = sc.nextInt();
y1[i] = sc.nextInt();
x2[i] = sc.nextInt();
y2[i] = sc.nextInt();
}
for(int i=0;i<a;i++){int b = 0; int c = Long.MAX_VALUE;
for(int j=0;j<a;j++){Long d = c-c;
d+=Math.abs(x1[i]-x2[j]);
d+=Math.abs(y1[i]-y2[j]);
if(d<c){b=j;c=d;}
if(j==a-1){ans[i]+=b+1;}
}
}
for(int i=0;i<a;i++){System.out.println(ans[i]);}
}
}
| Main.java:18: error: incompatible types: possible lossy conversion from long to int
for(int i=0;i<a;i++){int b = 0; int c = Long.MAX_VALUE;
^
Main.java:19: error: incompatible types: int cannot be converted to Long
for(int j=0;j<a;j++){Long d = c-c;
^
Main.java:22: error: incompatible types: Long cannot be converted to int
if(d<c){b=j;c=d;}
^
3 errors
|
s722278977 | p03774 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int [] x1 = new int [a];
int [] y1 = new int [a];
int [] x2 = new int [a];
int [] y2 = new int [a];
int [] ans = new int [a];
for(int i=0;i<a;i++){x1[i] = sc.nextInt();
y1[i] = sc.nextInt();
}
for(int i=0;i<a;i++){x2[i] = sc.nextInt();
y2[i] = sc.nextInt();
}
int b,c;
Long d;
for(int i=0;i<a;i++){b = 0; c = 1000000000;
for(int j=0;j<a;j++){d = 0;
d+=Math.abs(x1[i]-x2[j]);
d+=Math.abs(y1[i]-y2[j]);
if(d<c){b=j;c=d;}
if(j==a-1){ans[i]+=b+1;}
}
}
for(int i=0;i<a;i++){System.out.println(ans[i]);}
}
}
| Main.java:21: error: incompatible types: int cannot be converted to Long
for(int j=0;j<a;j++){d = 0;
^
Main.java:24: error: incompatible types: Long cannot be converted to int
if(d<c){b=j;c=d;}
^
2 errors
|
s200056285 | p03774 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
double [] x1 = new double [a];
double [] y1 = new double [a];
double [] x2 = new double [a];
double [] y2 = new double [a];
int [] ans = new int [a];
for(int i=0;i<a;i++){x1[i] = sc.nextDouble();
y1[i] = sc.nextDouble();
x2[i] = sc.nextDouble();
y2[i] = sc.nextDouble();
}
int b = 0;
for(int i=0;i<a;i++){double c = 1000000000;
for(int j=0;j<a;j++){double d = 0;
d+=Math.pow(x1[i]-x2[j]);
d+=Math.pow(y1[i]-y2[j]);
if(d<c){b=j;c=d;}
if(j==a-1){b=ans[i];}
}
}
for(int i=0;i<a;i++){System.out.println(ans[i]);}
}
}
| Main.java:20: error: method pow in class Math cannot be applied to given types;
d+=Math.pow(x1[i]-x2[j]);
^
required: double,double
found: double
reason: actual and formal argument lists differ in length
Main.java:21: error: method pow in class Math cannot be applied to given types;
d+=Math.pow(y1[i]-y2[j]);
^
required: double,double
found: double
reason: actual and formal argument lists differ in length
2 errors
|
s416032659 | p03774 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int [] x1 = new int [a];
int [] y1 = new int [a];
int [] x2 = new int [a];
int [] y2 = new int [a];
int [] ans = new int [a];
for(int i=0;i<a;i++){x1[i] = sc.nextInt();
y1[i] = sc.nextInt();
x2[i] = sc.nextInt();
y2[i] = sc.nextInt();
}
int b = 0;
for(int i=0;i<a;i++){int c = 1000000000;
for(int j=0;j<a;j++){int d = 0;
d+=Math.pow(x1[i]-x2[j]);
d+=Math.pow(y1[i]-y2[j]);
if(d<c){b=j;c=d;}
if(j==a-1){b=ans[i];}
}
}
for(int i=0;i<a;i++){System.out.println(ans[i]);}
}
}
| Main.java:20: error: method pow in class Math cannot be applied to given types;
d+=Math.pow(x1[i]-x2[j]);
^
required: double,double
found: int
reason: actual and formal argument lists differ in length
Main.java:21: error: method pow in class Math cannot be applied to given types;
d+=Math.pow(y1[i]-y2[j]);
^
required: double,double
found: int
reason: actual and formal argument lists differ in length
2 errors
|
s289109210 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
vector<int>a(n);
vector<int>b(n);
vector<int>c(m);
vector<int>d(m);
for(int i=0;i<n;i++){
cin >> a.at(i) >> b.at(i);
}
for(int i=0;i<m;i++){
cin >> c.at(i) >> d.at(i);
}
for(int i=0;i<n;i++){
int ans=0;
int com=1e9+7;
for(int j=0;j<m;j++){
if(abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j))<com){
ans=j;
com=abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j);
}
}
cout << ans+1 << endl;
}
} | a.cc: In function 'int main()':
a.cc:23:61: error: expected ')' before ';' token
23 | com=abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j);
| ~ ^
| )
|
s341327595 | p03774 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define ll int64_t
using namespace std;
bool compare_by_b(pair<string,int> a,pair<string,int> b){
if(a.second != b.second) return a.second<b.second;
else return a.first<b.first;
}
int main(){
ll n,m,mini=10000000,number = 0;
cin>>n>>m;
vector<pair<ll,ll>> s(n);
rep(i,n) cin>>s[i].first>>s[i].second;
vector<pair<ll,ll>> d(m);
rep(i,m) cin>>d[i].first>>d[i].second;
vector<int> p;
rep(i,n){
rep(j,m){
if(abs(s[i].first-d[j].first)+abs(s[i].second-d[j].second)<mini) {
mini = abs(s[i].first-d[j].first)+abs(s[i].second-d[j].second);
number = j+1;
}
}
cout<<number<<endl;
number = 0;
mini = 10000000;
} | a.cc: In function 'int main()':
a.cc:34:6: error: expected '}' at end of input
34 | }
| ^
a.cc:15:11: note: to match this '{'
15 | int main(){
| ^
|
s216098200 | p03774 | C++ | #include <bits/stdc++.h>
int main(){
std::cin >> N >> M;
std::vector<long long> a(N), b(N), c(M), d(M);
for(int i = 0; i < N; ++i){
std::cin >> a[i] >> b[i];
}
for(int j = 0; j < M; ++j){
std::cin >> c[j] >> d[j];
}
for(int i = 0; i < N; ++i){
int count = -1;
long long min_length= 1000000000000;
for(int j = 0; j < M; ++j){
length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
if(min_length > length){
min_length = length;
count = j+1;
}
}
std::cout << count << std::endl;
}
}
~
~
~
~ | a.cc: In function 'int main()':
a.cc:5:15: error: 'N' was not declared in this scope
5 | std::cin >> N >> M;
| ^
a.cc:5:20: error: 'M' was not declared in this scope
5 | std::cin >> N >> M;
| ^
a.cc:17:7: error: 'length' was not declared in this scope
17 | length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
| ^~~~~~
a.cc: At global scope:
a.cc:27:1: error: expected class-name before '~' token
27 | ~
| ^
|
s781902921 | p03774 | C++ | #include <bits/stdc++.h>
int main(){
std::cin >> N >> M;
std::vector<long long> a(N), b(N), c(M), d(M);
for(int i = 0; i < N; ++i){
std::cin >> a[i] >> b[i];
}
for(int j = 0; j < M; ++j){
std::cin >> c[j] >> d[j];
}
for(int i = 0; i < N; ++i){
int count = -1;
long long min_length= 1000000000000;
for(int j = 0; j < M; ++j){
length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
if(min_length > length){
min_length = langth;
count = j+1;
}
}
std::cout << count << std::endl;
}
}
~
~
~ | a.cc: In function 'int main()':
a.cc:5:15: error: 'N' was not declared in this scope
5 | std::cin >> N >> M;
| ^
a.cc:5:20: error: 'M' was not declared in this scope
5 | std::cin >> N >> M;
| ^
a.cc:17:7: error: 'length' was not declared in this scope
17 | length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
| ^~~~~~
a.cc:19:22: error: 'langth' was not declared in this scope
19 | min_length = langth;
| ^~~~~~
a.cc: At global scope:
a.cc:27:1: error: expected class-name before '~' token
27 | ~
| ^
|
s444315028 | p03774 | C++ | #include <bits/stdc++.h>
int main(){
std::cin >> N >> M;
std::vector<long long> a(N), b(N), c(M), d(M);
for(int i = 0; i < N; ++i){
std::cin >> a[i] >> b[i];
}
for(int j = 0; j < M; ++j){
std::cin >> c[j] >> d[j];
}
for(int i = 0; i < N; ++i){
int count = -1;
long long min_length= 1000000000000;
for(int j = 0; j < M; ++j){
length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
if(min_length > length)){
min_length = langth;
count = j+1;
}
}
std::cout << count << std::endl;
}
}
~
~
~ | a.cc: In function 'int main()':
a.cc:5:15: error: 'N' was not declared in this scope
5 | std::cin >> N >> M;
| ^
a.cc:5:20: error: 'M' was not declared in this scope
5 | std::cin >> N >> M;
| ^
a.cc:17:7: error: 'length' was not declared in this scope
17 | length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
| ^~~~~~
a.cc:18:30: error: expected primary-expression before ')' token
18 | if(min_length > length)){
| ^
a.cc: At global scope:
a.cc:27:1: error: expected class-name before '~' token
27 | ~
| ^
|
s181868447 | p03774 | C++ | #include <bits/stdc++.h>
int main(){
std::cin >> N >> M;
std::vector<long long> a(N), b(N), c(M), d(M);
for(int i = 0; i < N; ++i){
std::cin >> a[i] >> b[i];
}
for(int j = 0; j < M; ++j){
std::cin >> c[j] >> d[j];
}
for(int i = 0; i < N; ++i){
int count = -1;
long long min_length= 1000000000000;
for(int j = 0; j < M; ++j){
length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
if(min_length > length)){
min_length = langth;
count = j+1;
}
}
std::cout << count << std::endl;
}
~
~
~ | a.cc: In function 'int main()':
a.cc:5:15: error: 'N' was not declared in this scope
5 | std::cin >> N >> M;
| ^
a.cc:5:20: error: 'M' was not declared in this scope
5 | std::cin >> N >> M;
| ^
a.cc:17:7: error: 'length' was not declared in this scope
17 | length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
| ^~~~~~
a.cc:18:30: error: expected primary-expression before ')' token
18 | if(min_length > length)){
| ^
a.cc:27:2: error: expected primary-expression at end of input
27 | ~
| ^
a.cc:27:2: error: expected '}' at end of input
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s072810858 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int f(int a,int b,int c,int d){
return max(a,b)+max(c,d)-min(a,b)-min(c,d);
}
int main(){
int N,M,l,x,y;
cin>>N>>M;
vector<int>a(N),b(N),c(M),d(M);
for(int i=0;i<N;i++)cin>>a.at(i)>>b.at(i);
for(int i=0;i<M;i++)cin>>c.at(i)>>d.at(i);
for(int i=0;i<N;i++){
x=0;
for(int j=1;j<M;j++){
if(f(a.at(i),b.at(i),c.at(x),d.at(x))>f(a.at(i),b.at(i),c.at(j),d.at(j))x=i;
}
cout<<x<<endl;
}
} | a.cc: In function 'int main()':
a.cc:15:79: error: expected ';' before 'x'
15 | if(f(a.at(i),b.at(i),c.at(x),d.at(x))>f(a.at(i),b.at(i),c.at(j),d.at(j))x=i;
| ^
| ;
a.cc:16:5: error: expected primary-expression before '}' token
16 | }
| ^
a.cc:15:83: error: expected ')' before '}' token
15 | if(f(a.at(i),b.at(i),c.at(x),d.at(x))>f(a.at(i),b.at(i),c.at(j),d.at(j))x=i;
| ~ ^
| )
16 | }
| ~
a.cc:16:5: error: expected primary-expression before '}' token
16 | }
| ^
|
s648042740 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int f(int a,int b,int c,int d){
return max(a,b)+max(c,d)-min(a,b)-min(c,d);
}
int main(){
int N,M,l,x,y;
cin>>N>>M;
vector<int>a(N),b(N),c(M),d(M);
for(int i=0;i<N;i++)cin>>a.at(i)>>b.at(i);
for(int i=0;i<M;i++)cin>>c.at(i)>>d.at(i);
for(int i=0;i<N;i++){
x=0;
for(int j=1;j<M;j++){
if(f(a.at(i),b.at(i),c.at(x),d.at(x))>f(a.at(i),b.at(i),c.at(j),d.at(j))x=i;
}
cout<<x<<endl;
}
} | a.cc: In function 'int main()':
a.cc:15:79: error: expected ';' before 'x'
15 | if(f(a.at(i),b.at(i),c.at(x),d.at(x))>f(a.at(i),b.at(i),c.at(j),d.at(j))x=i;
| ^
| ;
a.cc:16:5: error: expected primary-expression before '}' token
16 | }
| ^
a.cc:15:83: error: expected ')' before '}' token
15 | if(f(a.at(i),b.at(i),c.at(x),d.at(x))>f(a.at(i),b.at(i),c.at(j),d.at(j))x=i;
| ~ ^
| )
16 | }
| ~
a.cc:16:5: error: expected primary-expression before '}' token
16 | }
| ^
|
s347700845 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int f(int a,int b,int c,int d){
return max(a,b)+max(c,d)-min(a,b)-min(c,d);
}
int main(){
int N,M,l,x,y;
cin>>N>>M;
vector<int>a(N),b(N),c(M),d(M);
for(int i=0;i<N;i++)cin>>a.at(i)>>b.at(i);
for(int i=0;i<M;i++)cin>>c.at(i)>>d.at(i);
for(int i=0;i<N;i++){
x=0,y=;
for(int j=0;j<M;j++){
if(y,f(a.at(i),b.at(i),c.at(j),d.at(j));
}
}
} | a.cc: In function 'int main()':
a.cc:13:11: error: expected primary-expression before ';' token
13 | x=0,y=;
| ^
a.cc:16:5: error: expected primary-expression before '}' token
16 | }
| ^
a.cc:15:47: error: expected ')' before '}' token
15 | if(y,f(a.at(i),b.at(i),c.at(j),d.at(j));
| ~ ^
| )
16 | }
| ~
a.cc:16:5: error: expected primary-expression before '}' token
16 | }
| ^
|
s595573444 | p03774 | C++ | #include<iostream>
#include<cmath>
using namespace std;
int main() {
int n, m, a[100], b[100], c[100], d[100], i, j, minm = 1e9, minn;
cin >> n >> m;
for (i = 1; i <= n; i++)
cin >> a[i] >> b[i];
for (i = 1; i <= m; i++)
cin >> c[i] >> d[i];
for (i = 1; i <= n; i++)
{
minm = 1e9;
for (j = 1; j <= m; j++)
if (abs(c[j] - a[i]) + abs(d[j] - b[i]) < minv)
{
minm = abs(c[j] - a[i]) + abs(d[j] - b[i]);
minn = j;
}
cout << minn << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:67: error: 'minv' was not declared in this scope; did you mean 'minn'?
15 | if (abs(c[j] - a[i]) + abs(d[j] - b[i]) < minv)
| ^~~~
| minn
|
s997948721 | p03774 | C++ | #include<iostream>
#include<cmath>
using namespace std;
int main() {
int n, m, a[100], b[100], c[100], d[100], i, j, minm = 1e9, minn;
cin >> n >> m;
for (i = 1; i <= n; i++)
cin >> a[i] >> b[i];
for (i = 1; i <= m; i++)
cin >> c[i] >> d[i];
for (i = 1; i <= n; i++)
{
minv = 1e9;
for (j = 1; j <= m; j++)
if (abs(c[j] - a[i]) + abs(d[j] - b[i]) < minv)
{
minm = abs(c[j] - a[i]) + abs(d[j] - b[i]);
minn = j;
}
cout << minn << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'minv' was not declared in this scope; did you mean 'minn'?
13 | minv = 1e9;
| ^~~~
| minn
|
s730889869 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int a[51],b[51],c[51],d[51];
int main()
{
int n,m,dis=0,num,far;
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>a[i]>>b[i];
for(int i=1;i<=m;i++)
cin>>c[i]>>d[i];
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
far=abs(a[i]-c[j])+abs(b[i]-d[j]);
if(far<dis){
ans=far;
num=j;
}
}
cout<<num<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
16 | ans=far;
| ^~~
| abs
|
s059260788 | p03774 | C++ | #intclude<bits/stdc++.h>
using namespace std;
int main (){
int n,m;
cin >> n >> m;
const int NMMAX=50;
int A[NMMAX],B[NMMAX],C[NMMAX],D[NMMAX];
for(int i=0;i<n;++i){
cin >> A[i] >> B[i];
}
for(int i=0;i<m;++i){
cin >> C[i] >> D[i];
}
for(int i=0;i<n;i++){
int checkpoint = 1;
int min_dist = abs(A[i]-C[0])+abs(B[i]-D[0]);
for(int j=0;j<m;j++){
const int cur_dist=abs(A[i]-C[j])+abs(B[i]-D[j]);
if(min_dist>cur_dist){
min_dist = cur_dist;
checkpoint = j+1;
}
}
cout << checkpoint << endl;
}
}
| a.cc:1:2: error: invalid preprocessing directive #intclude; did you mean #include?
1 | #intclude<bits/stdc++.h>
| ^~~~~~~~
| include
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
6 | cin >> n >> m;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #intclude<bits/stdc++.h>
a.cc:18:24: error: 'abs' was not declared in this scope
18 | int min_dist = abs(A[i]-C[0])+abs(B[i]-D[0]);
| ^~~
a.cc:27:9: error: 'cout' was not declared in this scope
27 | cout << checkpoint << endl;
| ^~~~
a.cc:27:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:31: error: 'endl' was not declared in this scope
27 | cout << checkpoint << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #intclude<bits/stdc++.h>
|
s281947256 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int dist(int x, int y){
return (int)(abs(x)+abs(y));
}
int main(){
int N,M;
cin>>N>>M;
vector<int> a(N),b(N);
vector<int> c(M),d(M);
for(int i=0;i<N;i++){
cin>>a.at(i)>>b.at(i);
}
for(int i=0;i<M;i++){
cin>>c.at(i)>>d.at(i);
}
for(int i=0;i<N;i++){
k=0;
for(int j=0;j<M;j++){
if(dist(a.at(i)-c.at(j),b.at(i)-d.at(j))<dist(a.at(i)-c.at(k),b.at(i)-d.at(k))){
k=j;
}
}
cout<<k+1<<endl;
}
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'k' was not declared in this scope
20 | k=0;
| ^
|
s645868459 | p03774 | C++ | include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 1001001001;
using namespace std;
int main()
{
int N, M;
int a[51], b[51], c[51], d[51];
int res[51];
cin >> N >> M;
rep(i,N) cin >> a[i] >> b[i];
rep(i,M) cin >> c[i] >> d[i];
rep(i,N){
int minmd = INF;
rep(j,M){
int md = abs(a[i]-c[j])+abs(b[i]-d[j]);
if(minmd > md) {
res[i]=j+1;
minmd = md;
}
}
}
rep(i,N){
cout << res[i] << endl;
}
}
| a.cc:1:1: error: 'include' does not name a type
1 | include <bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope
11 | cin >> N >> M;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | include <bits/stdc++.h>
a.cc:17:17: error: 'INF' was not declared in this scope
17 | int minmd = INF;
| ^~~
a.cc:19:16: error: 'abs' was not declared in this scope
19 | int md = abs(a[i]-c[j])+abs(b[i]-d[j]);
| ^~~
a.cc:28:5: error: 'cout' was not declared in this scope
28 | cout << res[i] << endl;
| ^~~~
a.cc:28:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:23: error: 'endl' was not declared in this scope
28 | cout << res[i] << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | include <bits/stdc++.h>
|
s000760960 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
long n,m;
cin >> n >> m;
long a[100],b[100],c[100],d[100];
for(int i=1; i<=n; i++) cin >>a[i]>>b[i];
for(int i=1; i<=m; i++) cin >>c[i]>>d[i];
vector<vector<long>> e(100,vector<long>(100);
vector<long> f(100,1000000000);
int g[100];
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
e[i][j] = abs(a[i]-c[j])+abs(b[i]-d[j]);
if(f[i] > e[i][j]) {
f[i] = e[i][j];
g[i] = j;
}
}
}
for(int i=1; i<=n; i++) cout << g[i] << endl;
} | a.cc: In function 'int main()':
a.cc:12:47: error: expected ')' before ';' token
12 | vector<vector<long>> e(100,vector<long>(100);
| ~ ^
| )
|
s722164083 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
long n,m;
cin >> n >> m;
long a[100],b[100],c[100],d[100];
for(int i=1; i<=n; i++) cin >>a[i]>>b[i];
for(int i=1; i<=m; i++) cin >>c[i]>>d[i];
vector<vector<long>> e(100,vector<long>(100,);
long f[100,1000000000];
int g[100];
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
e[i][j] = abs(a[i]-c[j])+abs(b[i]-d[j]);
if(f[i] > e[i][j]) {
f[i] = e[i][j];
g[i] = j;
}
}
}
for(int i=1; i<=n; i++) cout << g[i] << endl;
} | a.cc: In function 'int main()':
a.cc:12:42: error: expected primary-expression before '(' token
12 | vector<vector<long>> e(100,vector<long>(100,);
| ^
a.cc:12:47: error: expected primary-expression before ')' token
12 | vector<vector<long>> e(100,vector<long>(100,);
| ^
a.cc:13:13: error: expected ']' before ',' token
13 | long f[100,1000000000];
| ^
| ]
a.cc:13:14: error: expected unqualified-id before numeric constant
13 | long f[100,1000000000];
| ^~~~~~~~~~
a.cc:19:9: error: 'f' was not declared in this scope
19 | if(f[i] > e[i][j]) {
| ^
|
s242271038 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
long n,m;
cin >> n >> m;
long a[100],b[100],c[100],d[100];
for(int i=1; i<=n; i++) cin >>a[i]>>b[i];
for(int i=1; i<=m; i++) cin >>c[i]>>d[i];
vector<vector<long>> d(100,vector<long>(100,1000000000));
long e[100],f[100];
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
d[i][j] = abs(a[i]-c[i])+abs(b[i]-d[i]);
if(e[i] > d[i][j]) {e[i]=d[i][j]; f[i] = j;}
}
for(int i=1; i<=n; i++) cout << f[i] << endl;
}
} | a.cc: In function 'int main()':
a.cc:12:24: error: conflicting declaration 'std::vector<std::vector<long int> > d'
12 | vector<vector<long>> d(100,vector<long>(100,1000000000));
| ^
a.cc:8:29: note: previous declaration as 'long int d [100]'
8 | long a[100],b[100],c[100],d[100];
| ^
a.cc:17:9: error: invalid types 'long int[int]' for array subscript
17 | d[i][j] = abs(a[i]-c[i])+abs(b[i]-d[i]);
| ^
a.cc:18:20: error: invalid types 'long int[int]' for array subscript
18 | if(e[i] > d[i][j]) {e[i]=d[i][j]; f[i] = j;}
| ^
a.cc:18:35: error: invalid types 'long int[int]' for array subscript
18 | if(e[i] > d[i][j]) {e[i]=d[i][j]; f[i] = j;}
| ^
|
s110582169 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
long n, m;
cin >> n >> m;
long a[n], b[n];
for(int i=0; i<n; i++) cin >> a[i] >> b[i];
long c[n], d[n];
for(int i=0; i<n; i++) cin >> c[i] >> d[i];
long e[n][m];
long t[n, 1000000000];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
e[i][j] = abs(a[i]-c[i]) + abs(b[i]-d[i]);
t[i] = min(t[i],e[i][j]);
}
}
for(int i=0; i<n; i++) cout << t[i] << endl;
} | a.cc: In function 'int main()':
a.cc:14:11: error: expected ']' before ',' token
14 | long t[n, 1000000000];
| ^
| ]
a.cc:14:13: error: expected unqualified-id before numeric constant
14 | long t[n, 1000000000];
| ^~~~~~~~~~
a.cc:19:9: error: 't' was not declared in this scope
19 | t[i] = min(t[i],e[i][j]);
| ^
a.cc:22:34: error: 't' was not declared in this scope
22 | for(int i=0; i<n; i++) cout << t[i] << endl;
| ^
|
s944910215 | p03774 | C++ | #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<=(n);i++)
template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;
template<class T>
using P = pair<int,int>
int main(){
int N,M;
cin >> N >> M;
vector<P> student(N);
vector<P> check(M);
rep(i,N) cin >> student[i].first >> student[i].second;
rep(i,M) cin >> check[i].first >> check[i].second;
rep(i,N){
int min = abs(student[0].first-check[0].first)+abs(student[0].second-check[0].first);
rep(i,M){
if(min > abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first)){
min = abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first);
}
}
cout << min << endl;
}
return 0;
}
| a.cc:15:11: error: two or more data types in declaration of 'type name'
15 | using P = pair<int,int>
| ^~~~~~~~~~~~~
|
s838624998 | p03774 | C++ | #include<bits/stdc++.h>
typedef long long ll;
typedef pair<int,int> P;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<=(n);i++)
template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;
int main(){
int N,M;
cin >> N >> M;
vector<P> student(N);
vector<P> check(M);
rep(i,N) cin >> student[i].first >> student[i].second;
rep(i,M) cin >> check[i].first >> check[i].second;
rep(i,N){
int min = abs(student[0].first-check[0].first)+abs(student[0].second-check[0].first);
rep(i,M){
if(min > abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first)){
min = abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first);
}
}
cout << min << endl;
}
return 0;
}
| a.cc:4:9: error: 'pair' does not name a type
4 | typedef pair<int,int> P;
| ^~~~
a.cc: In function 'int main()':
a.cc:19:12: error: 'P' was not declared in this scope
19 | vector<P> student(N);
| ^
a.cc:19:13: error: template argument 1 is invalid
19 | vector<P> student(N);
| ^
a.cc:19:13: error: template argument 2 is invalid
a.cc:20:13: error: template argument 2 is invalid
20 | vector<P> check(M);
| ^
a.cc:21:28: error: invalid types 'int[int]' for array subscript
21 | rep(i,N) cin >> student[i].first >> student[i].second;
| ^
a.cc:21:48: error: invalid types 'int[int]' for array subscript
21 | rep(i,N) cin >> student[i].first >> student[i].second;
| ^
a.cc:22:26: error: invalid types 'int[int]' for array subscript
22 | rep(i,M) cin >> check[i].first >> check[i].second;
| ^
a.cc:22:44: error: invalid types 'int[int]' for array subscript
22 | rep(i,M) cin >> check[i].first >> check[i].second;
| ^
a.cc:24:30: error: invalid types 'int[int]' for array subscript
24 | int min = abs(student[0].first-check[0].first)+abs(student[0].second-check[0].first);
| ^
a.cc:24:45: error: invalid types 'int[int]' for array subscript
24 | int min = abs(student[0].first-check[0].first)+abs(student[0].second-check[0].first);
| ^
a.cc:24:67: error: invalid types 'int[int]' for array subscript
24 | int min = abs(student[0].first-check[0].first)+abs(student[0].second-check[0].first);
| ^
a.cc:24:83: error: invalid types 'int[int]' for array subscript
24 | int min = abs(student[0].first-check[0].first)+abs(student[0].second-check[0].first);
| ^
a.cc:26:33: error: invalid types 'int[int]' for array subscript
26 | if(min > abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first)){
| ^
a.cc:26:48: error: invalid types 'int[int]' for array subscript
26 | if(min > abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first)){
| ^
a.cc:26:70: error: invalid types 'int[int]' for array subscript
26 | if(min > abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first)){
| ^
a.cc:26:86: error: invalid types 'int[int]' for array subscript
26 | if(min > abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first)){
| ^
a.cc:27:34: error: invalid types 'int[int]' for array subscript
27 | min = abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first);
| ^
a.cc:27:49: error: invalid types 'int[int]' for array subscript
27 | min = abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first);
| ^
a.cc:27:71: error: invalid types 'int[int]' for array subscript
27 | min = abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first);
| ^
a.cc:27:87: error: invalid types 'int[int]' for array subscript
27 | min = abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first);
| ^
|
s735144161 | p03774 | C++ | //#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>
#include<cmath>
using namespace std;
#define FAST ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
typedef long long int ll;
pair<int,int> first[51];
pair<int,int> second[51];
int dis(int i , int j)
{
return abs(first[i].first-second[j].first) + abs(first[i].second-second[j].second);
}
int main()
{
FAST;
int n,m;
cin >> n >> m;
for(int i=0 ; i<n ; i++)
cin >> first[i].first >> first[i].second;
for(int j=0 ; j<m ; j++)
cin >> second[j].first >> second[j].second;
for(int i=0 ; i<n ; i++)
{
int minIndex = -1;
for(int j=0 ; j<m ; j++)
{
if(minIndex < 0 || dis(i ,j) < dis(i , minIndex))
minIndex = j;
}
cout << minIndex+1 << "\n";
}
return 0; | a.cc: In function 'int main()':
a.cc:49:18: error: expected '}' at end of input
49 | return 0;
| ^
a.cc:24:1: note: to match this '{'
24 | {
| ^
|
s736101003 | p03774 | C++ | #include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
typedef long long ll;
void Main()
{
ll N, M;
cin >> N >> M;
vector<ll> a(N), b(N);
rep(i,N){
cin >> a[i] >> b[i];
}
vector<ll> c(M), d(M);
rep(i,M){
cin >> c[i] >> d[i];
}
auto distance = [&](ll x1, ll y1, ll x2, ll y2){
ll ans = abs(x1-x2)+abs(y1-y2);
return ans;
}
ll tempmax;
rep(i,N){
tempmax = 0;
rep(j,M){
tempmax = max(tempmax, distance(a[i],b[i],c[j],d[j]));
}
cout << tempmax << endl;
}
return;
}
int main()
{
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
| a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
2 | #include<boost/multi_array.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s737444025 | p03774 | C++ | #include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
typedef long long ll;
void Main()
{
ll N, M;
cin >> N >> M;
vector<ll> a(N), b(N);
rep(i,N){
cin >> a[i] >> b[i];
}
vector<ll> c(M), d(M);
rep(i,M){
cin >> c[i] >> d[i];
}
auto distance = [&](ll x1, ll y1, ll x2, ll y2){
ll ans = abs(x1-x2)+abs(y1-y2);
return ans;
}
ll tempmax = 0;
rep(i,N){
rep(j,M){
tempmax = max(tempmax, distance(a[i],b[i],c[j],d[j]));
}
cout << tempmax << endl;
}
return;
}
int main()
{
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
} | a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
2 | #include<boost/multi_array.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s974743527 | p03774 | C | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main() {
int n, m, x1[55], y1[55], x2[55], y2[55], res[55], menor = 100000, k;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d%d", &x1[i], &y1[i]);
}
for (int i = 0; i < m; i++) {
scanf("%d%d", &x2[i], &y2[i]);
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
res[j] = abs(x1[i]-x2[j]) + abs(y1[i]-y2[j]);
}
for (int j = 0; j < m; j++) {
if(res[j] < menor){
menor = res[j];
k = j+1;
}
}
printf("%d\n", k);
menor = 100000;
} | main.c: In function 'main':
main.c:30:3: error: expected declaration or statement at end of input
30 | }
| ^
|
s109038117 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int dn(int a,int b,int c,int d){
return abs(c-a)+abs(d-b);
}
int main(){
int n,m,i,j;
cin>>n>>m;
int a[n],b[n],c[m],d[m];
for(i=0;i<n;i++){
cin>>a[i]>>b[i];
}
for(i=0;i<m;i++){
cin>>c[i]>>d[i];
}
int m[n];
for(i=0;i<n;i++){
m[i]=0;
for(j=0;j<m;j++){
if(dn(a[i],b[i],c[j],d[j])<dn(a[i],b[i],c[m[i]],d[m[i]]))m[i]=j;
else if(dn(a[i],b[i],c[j],d[j])==dn(a[i],b[i],c[m[i]],d[m[i]])){
if(j<m[i])m[i]=j;
}
}
}
for(i=0;i<m;i++){
cout<<m[i]<<endl;
}
} | a.cc: In function 'int main()':
a.cc:18:7: error: conflicting declaration 'int m [n]'
18 | int m[n];
| ^
a.cc:9:9: note: previous declaration as 'int m'
9 | int n,m,i,j;
| ^
a.cc:20:6: error: invalid types 'int[int]' for array subscript
20 | m[i]=0;
| ^
a.cc:22:50: error: invalid types 'int[int]' for array subscript
22 | if(dn(a[i],b[i],c[j],d[j])<dn(a[i],b[i],c[m[i]],d[m[i]]))m[i]=j;
| ^
a.cc:22:58: error: invalid types 'int[int]' for array subscript
22 | if(dn(a[i],b[i],c[j],d[j])<dn(a[i],b[i],c[m[i]],d[m[i]]))m[i]=j;
| ^
a.cc:22:65: error: invalid types 'int[int]' for array subscript
22 | if(dn(a[i],b[i],c[j],d[j])<dn(a[i],b[i],c[m[i]],d[m[i]]))m[i]=j;
| ^
a.cc:23:56: error: invalid types 'int[int]' for array subscript
23 | else if(dn(a[i],b[i],c[j],d[j])==dn(a[i],b[i],c[m[i]],d[m[i]])){
| ^
a.cc:23:64: error: invalid types 'int[int]' for array subscript
23 | else if(dn(a[i],b[i],c[j],d[j])==dn(a[i],b[i],c[m[i]],d[m[i]])){
| ^
a.cc:24:15: error: invalid types 'int[int]' for array subscript
24 | if(j<m[i])m[i]=j;
| ^
a.cc:24:20: error: invalid types 'int[int]' for array subscript
24 | if(j<m[i])m[i]=j;
| ^
a.cc:29:12: error: invalid types 'int[int]' for array subscript
29 | cout<<m[i]<<endl;
| ^
|
s846002913 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<int> a(n),b(n),c(n),d(n),l(n);
int kyo;
for(int i=0;i<n;i++){
cin >> a[i] >> b[i];
}
for(int i=0;i<m;i++){
cin >> c[i] >> d[i];
}
for(int i=0;i<n;i++){
int kyo=400000001;
for(int j=0;j<m;j++){
if(kyo>abs(a[i]-c[j])+abs(b[i]-d[j])){
kyo=abs(a[i]-c[j])+abs(b[i]-d[j]);
l[i]=j+1;
}
}
cout << l[i] << endl;
}
}
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<int> a(n),b(n),c(n),d(n),l(n);
int kyo;
for(int i=0;i<n;i++){
cin >> a[i] >> b[i];
}
for(int i=0;i<m;i++){
cin >> c[i] >> d[i];
}
for(int i=0;i<n;i++){
int kyo=400000001;
for(int j=0;j<m;j++){
if(kyo>abs(a[i]-c[j])+abs(b[i]-d[j])){
kyo=abs(a[i]-c[j])+abs(b[i]-d[j]);
l[i]=j+1;
}
}
cout << l[i] << endl;
}
} | a.cc:29:5: error: redefinition of 'int main()'
29 | int main(){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main(){
| ^~~~
|
s062577479 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;cin>>n>>m;
vector<pair<int,int>>a(n),c(m);
for(int i=0;i<n;i++)cin>>a.at(i).first>>a.at(i).second;
for(int i=0;i<m;i++)cin>>c.at(i).first>>c.at(i).second;
for(int i=0;i<n;i++){
long int l=bebc201;int p=0
for(int j=0;j<m;j++){
long int x=abs(a.at(i).first-c.at(j).first)+abs(a.at(i).second-c.at(j).second);
if(x<l){p=j;l=x;}
}
cout<<p+1<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:9:16: error: 'bebc201' was not declared in this scope
9 | long int l=bebc201;int p=0
| ^~~~~~~
a.cc:10:5: error: expected ',' or ';' before 'for'
10 | for(int j=0;j<m;j++){
| ^~~
a.cc:10:17: error: 'j' was not declared in this scope
10 | for(int j=0;j<m;j++){
| ^
|
s985054520 | p03774 | C++ | #include<iostream>
#include<cmath>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
int a[105], b[105], c[105], d[105];
for (int i = 0; i < N; i++) {
cin >> a[i] >> b[i];
}
for (int i = 0; i < M; i++) {
cin >> c[i] >> d[i];
}
for (int i = 0; i < N; i++) {
int kyori == INT_MAX;
int index = 0;
for (int i = 0; i < M; i++) {
int z;
z = abs((a[i] - c[i]) + (b[i] - d[i]));
if (z < kyori) {
kyori = z;
index = i;
}
cout << i + 1 << endl;
}
return 0;
}
} | a.cc: In function 'int main()':
a.cc:15:27: error: expected initializer before '==' token
15 | int kyori == INT_MAX;
| ^~
a.cc:20:33: error: 'kyori' was not declared in this scope
20 | if (z < kyori) {
| ^~~~~
|
s454693292 | p03774 | C++ | #include<iostream>
#include<cmath>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
int a[105], b[105], c[105], d[105];
for (int i = 0; i < N; i++) {
cin >> a[i] >> b[i];
}
for (int i = 0; i < M; i++) {
cin >> c[i] >> d[i];
}
for (int i = 0; i < N; i++) {
int kyori = INT_MAX;
int index = 0;
for (int i = 0; i < M; i++) {
int z;
z = abs((a[i] - c[i]) + (b[i] - d[i]));
if (z < kyori) {
kyori = z;
index = i;
}
cout << i + 1 << endl;
}
return 0;
}
} | a.cc: In function 'int main()':
a.cc:15:29: error: 'INT_MAX' was not declared in this scope
15 | int kyori = INT_MAX;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include<cmath>
+++ |+#include <climits>
3 | using namespace std;
|
s576212710 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,a[55],b[55],c[55],d[55],i,j,minn,ans;
cin>>n>>m;
for(i=1;i<=n;i++)
cin>>a[i]>>b[i];
for(i=1;i<=m;i++)
cin>>c[i]>>d[i];
for(i=1;i<=n;i++){
minv=1<<30;
for(j=1;j<=m;j++)
if(abs(c[j]-a[i])+abs(d[j]-b[i])<minn){
minn=abs(c[j]-a[i])+abs(d[j]-b[i]);
ans=j;
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'minv' was not declared in this scope; did you mean 'minn'?
11 | minv=1<<30;
| ^~~~
| minn
|
s152935016 | p03774 | C++ | V#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define ll long long
ll a[60], b[60], c[60], d[60];
int main()
{
int N, M;
cin >> N >> M;
for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
for (int i = 0; i < M; i++) cin >> c[i] >> d[i];
ll min = 0;
int p = 0;
for (int i = 0; i < N; i++) {
min = mod;
for (int j = 0; j < M; j++) {
if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min) {
min = abs(a[i] - c[j]) + abs(b[i] - d[j]);
p = j;
}
}
cout << p + 1 << endl;
}
}
| a.cc:1:2: error: stray '#' in program
1 | V#include <bits/stdc++.h>
| ^
a.cc:1:1: error: 'V' does not name a type
1 | V#include <bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
9 | cin >> N >> M;
| ^~~
a.cc:17:29: error: 'abs' was not declared in this scope
17 | if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min) {
| ^~~
a.cc:22:17: error: 'cout' was not declared in this scope
22 | cout << p + 1 << endl;
| ^~~~
a.cc:22:34: error: 'endl' was not declared in this scope
22 | cout << p + 1 << endl;
| ^~~~
|
s721769138 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int fac(int n){
int m=1;
while(n>=1) m*=n,n--;
return m;
}
int vec_sum(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
int N, M;
cin >> N >> M;
for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
for (int i = 0; i < M; i++) cin >> c[i] >> d[i];
long long min = 0;
int p = 0;
for (int i = 0; i < N; i++) {
min = 100000000;
for (int j = 0; j < M; j++) {
if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min) {
min = abs(a[i] - c[j]) + abs(b[i] - d[j]);
p = j;
}
}
cout << p + 1 << endl;
}
}
///////////////////////////
| a.cc: In function 'int main()':
a.cc:33:44: error: 'a' was not declared in this scope
33 | for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
| ^
a.cc:33:52: error: 'b' was not declared in this scope
33 | for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
| ^
a.cc:34:44: error: 'c' was not declared in this scope
34 | for (int i = 0; i < M; i++) cin >> c[i] >> d[i];
| ^
a.cc:34:52: error: 'd' was not declared in this scope
34 | for (int i = 0; i < M; i++) cin >> c[i] >> d[i];
| ^
a.cc:40:33: error: 'a' was not declared in this scope
40 | if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min) {
| ^
a.cc:40:40: error: 'c' was not declared in this scope
40 | if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min) {
| ^
a.cc:40:52: error: 'b' was not declared in this scope
40 | if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min) {
| ^
a.cc:40:59: error: 'd' was not declared in this scope
40 | if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min) {
| ^
|
s883437088 | p03774 | C++ | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int64_t minn(int64_t a,int64_t b){
if(a >= b) return b;
else return a;
}
int main(){
int N,M;
cin >> N>>M;
vector<int64_t> A(N);
vector<int64_t> B(N);
vector<int64_t> C(M);
vector<int64_t> D(M);
for(int i = 0;i < N;i++){
cin >> A[i] >> B[i];
}
for(int i = 0;i < M ;i++){
cin >> C[i] >> D[i];
}
for(int i = 0;i < N;i++){
int ans = 12345678; int num = 0;
for(int j = 0;j < M;j++){
if(ans > abs(A[i] - C[j]) + abs(B[i] - D[j])){
ans = abs(A[i] - C[j]) + abs(B[i] - D[j]);
num = j + 1;
}
}
cout << num << endl;
}
}
} | a.cc:33:1: error: expected declaration before '}' token
33 | }
| ^
|
s032274619 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(n), c(m), d(m);
for (int i=0; i<n; i++){
cin >> a.at(i) >> b.at(i);
}
for (int i=0; i<m; i++){
cin >> c.at(i) >> d.at(i);
}
for (int i=0; i<n; i++){
int md = MAX_INT;
int num;
for (int j=0; j<m; j++){
if(md > abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j))){
num = j;
md =abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j));
}
}
cout << num << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:14: error: 'MAX_INT' was not declared in this scope; did you mean 'MAX_INPUT'?
17 | int md = MAX_INT;
| ^~~~~~~
| MAX_INPUT
|
s370804353 | p03774 | C++ | #include<bits/stdc++.h>
#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n, m; cin >> n >> m;
int a[n], b[n], minimum[n], ans[n], x[m], y[m];
REPI(i, n){
cin >> a[i] >> b[i];
ans[i] = 0;
minimum[i] = 2 * 100000000;
}
REPI(i, m){
cin >> x[i] >> y[i];
}
REPI(i, n){
REPJ(j, m){
int man_dis = abs(a[i] - x[j]) + abs(b[i] - y[j]);
| a.cc: In function 'int main()':
a.cc:25:63: error: expected '}' at end of input
25 | int man_dis = abs(a[i] - x[j]) + abs(b[i] - y[j]);
| ^
a.cc:24:19: note: to match this '{'
24 | REPJ(j, m){
| ^
a.cc:25:63: error: expected '}' at end of input
25 | int man_dis = abs(a[i] - x[j]) + abs(b[i] - y[j]);
| ^
a.cc:23:15: note: to match this '{'
23 | REPI(i, n){
| ^
a.cc:25:63: error: expected '}' at end of input
25 | int man_dis = abs(a[i] - x[j]) + abs(b[i] - y[j]);
| ^
a.cc:8:11: note: to match this '{'
8 | int main(){
| ^
|
s221298982 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a[60], b[60], c[60], d[60];
int main()
{
int N, M;
cin >> N >> M;
for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
for (int i = 0; i < M; i++) cin >> c[i] >> d[i];
ll min = 0;
int p = 0;
for (int i = 0; i < N; i++) {
min = mod;
for (int j = 0; j < M; j++) {
if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min) {
min = abs(a[i] - c[j]) + abs(b[i] - d[j]);
p = j;
}
}
cout << p + 1 << endl;
}
}
| a.cc: In function 'int main()':
a.cc:14:23: error: 'mod' was not declared in this scope; did you mean 'modf'?
14 | min = mod;
| ^~~
| modf
|
s907947734 | p03774 | C++ | #include <bits/stdc++.h>
#include <type_traits>
using namespace std;
using ll = int64_t;
#define int ll
#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()
using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(n);
vector<int> c(m), d(m);
REP(i, n) {
cin >> a[i] >> b[i];
}
REP(i, m) {
cin >> c[i] >> d[i];
}
REP(i, n) {
int min = 4e8 + 1;
int ans = 0;
REP(j, m) {
int dis = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if (dis < min) {
min = dis;
ans = j + 1;
}
}
cout << ans << endl;
}
return 0;
} | a.cc:5:13: error: '::main' must return 'int'
5 | #define int ll
| ^~
a.cc:16:1: note: in expansion of macro 'int'
16 | int main() {
| ^~~
|
s036417676 | p03774 | C++ | #include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<pair<long long int, long long int>> Students(N);
vector<pair<long long int, long long int>> Points(N);
for(int i = 0;i < N; i++){
long long int a, b;
cin >> a >> b;
Students[i] = make_pair(a, b);
}
for(int i = 0;i < M; i++){
long long int a, b;
cin >> a >> b;
Points[i] = make_pair(a, b);
}
vector<int> ans;
for(int i = 0; i < N; i++){
long long int tdist = 1000000000, tptnr = 100;
for(int j = 0; i < M; j++){
int td, tp;
td = abs(Students[i].first - Points[j].first);
tp = j+1;
if(td < tdist) td = tdist, tptnr = tp;
else if(td == tdist) tptnr = tp;
else continue;
}
ans.push_back(tp);
}
for(int i = 0; i < N; i++) cout << ans[i] << endl;
} | a.cc: In function 'int main()':
a.cc:38:19: error: 'tp' was not declared in this scope; did you mean 'tm'?
38 | ans.push_back(tp);
| ^~
| tm
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.