submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s015303156 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int64_t a[n], b[n], c[m], 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];
}
int64_t min_j = 0;
for (int i = 0; i < n; i++) {
int min = 4e8q2 + 1;
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]);
min_j = j + 1;
}
}
cout << min_j << endl;
}
} | a.cc: In function 'int main()':
a.cc:18:19: error: unable to find numeric literal operator 'operator""q2'
18 | int min = 4e8q2 + 1;
| ^~~~~
|
s288020623 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,N;
cin >> N >> M;
vector<vector<int>> v1(N,vector<int>(2));
vector<vector<int>> v2(M,vector<int>(2));
for (int i=0;i<N;i++){
cin >> v1.at(i).at(0) >> v1.at(i).at(1);
}
for (int j=0;j<N;j++){
cin >> v2.at(j).at(0) >> v2.at(j).at(1);
}
for (int i=0;i<N;i++){
int ans,count=1000000000;
for (int j=0;j<M;j++){
int count2;
int x=v1.at(i).at(0)-v2.at(j).at(0),y=v1.at(i).at(1)-v2.at(j).at(1);
if (x<0){
x*=-1;
}
if (y<0){
y*=-1;
}
count2=x+y;
if (count2<count){
count=count2;
ans=j+1;
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:5:9: error: redeclaration of 'int N'
5 | int N,N;
| ^
a.cc:5:7: note: 'int N' previously declared here
5 | int N,N;
| ^
a.cc:6:15: error: 'M' was not declared in this scope
6 | cin >> N >> M;
| ^
|
s129828586 | p03774 | C++ | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
return f.second > s.second;
}
ll gcd(ll a, ll b){
if (b == 0)return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b){
return a / gcd(a, b) * b;
}
ll nCr(ll n, ll r){
if(r == 0 || r == n){
return 1;
} else if(r == 1){
return n;
}
return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
ll nPr(ll n, ll r){
r = n - r;
ll ret = 1;
for (ll i = n; i >= r + 1; i--) ret *= i;
return ret;
}
//-----------------------ここから-----------
int main(void){
int n, m;
cin >> n >> m;
vector<pair<int,int>> s(n), c(m);
for(int i = 0; i < n; i++){
cin >> s[i].first >> s[i].second;
}
for(int i = 0; i < m; i++){
cin >> c[i].first >> c[i].second;
}
for(int i = 0; i < n; i++){
ll shortest = INF;
int ans = 0;
for(int j = 0; j < m; j++){
ll tmp = abs(s[i].first - c[j].first) + abs(s[i].second - c[j].second);
if(shortest > tmp){
shortest = tmp;
ans = j;
}
}
cout << ans + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:84:2: error: expected '}' at end of input
84 | }
| ^
a.cc:62:15: note: to match this '{'
62 | int main(void){
| ^
|
s188441932 | p03774 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}
const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;
// ||
int main() {
ll n, m; cin >> n >> m;
vll a(n), b(n);
REP(i, n) cin >> a[i] >> b[i];
vll c(m), d(m);
REP(i, m) cin >> c[i] >> d[i];
REP(i, n) {
ll maxj=0, mind=abs(a[i]-c[0])+abs(b[i]-d[0]);
rep(j, 1, m) {
ll tmpd = abs(a[i]-c[j])+abs(b[i]-d[j]);
if (tmpd < mind) {
maxj = j; mind=tmpd;
}
}
cout << j+1 << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:47:13: error: 'j' was not declared in this scope
47 | cout << j+1 << endl;
| ^
|
s097743357 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector<int> a(n), b(m);
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i];
}
for(int j = 0; j < m; j++){
cin >> c[i] >> d[i];
}
for(int i = 0; i < n; i++){
int min = abs(a[i]-c[0]) + abs(b[i]-d[0]);
int min_ind = 0;
for(int j = 1; j < m; j++){
int l = abs(a[i]-c[j]) + abs(b[i]-d[j]);
if(l < min){
min = l;
min_ind = j;
}
}
cout << min_ind << endl;
}
}
| a.cc: In function 'int main()':
a.cc:12:12: error: 'c' was not declared in this scope
12 | cin >> c[i] >> d[i];
| ^
a.cc:12:14: error: 'i' was not declared in this scope
12 | cin >> c[i] >> d[i];
| ^
a.cc:12:20: error: 'd' was not declared in this scope
12 | cin >> c[i] >> d[i];
| ^
a.cc:16:24: error: 'c' was not declared in this scope
16 | int min = abs(a[i]-c[0]) + abs(b[i]-d[0]);
| ^
a.cc:16:41: error: 'd' was not declared in this scope
16 | int min = abs(a[i]-c[0]) + abs(b[i]-d[0]);
| ^
|
s912711444 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int n,m;
int a[60],b[60],c[60],d[60];
int func(int x){
int best=INF;
int ans;
rep(i,m){
if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
best=abs(a[x]-c[i])+abs(b[x]-d[i]);
ans=i;
}
}
return i+1;
}
int main(){
cin>>n>>m;
rep(i,n)cin>>a[i]>>b[i];
rep(i,m)cin>>c[i]>>d[i];
rep(i,n)
cout<<func(i)<<endl;
} | a.cc: In function 'int func(int)':
a.cc:23:12: error: 'i' was not declared in this scope
23 | return i+1;
| ^
|
s680649168 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int n,m;
int a[60],b[60],c[60],d[60];
int func(int x){
int best=INF;
int ans;
rep(i,m){
if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
best=abs(a[x]-c[i])+abs(b[x]-d[i]);
ans=i;
}
return i+1;
}
int main(){
cin>>n>>m;
rep(i,n)cin>>a[i]>>b[i];
rep(i,m)cin>>c[i]>>d[i];
rep(i,n)
cout<<func(i)<<endl;
} | a.cc: In function 'int func(int)':
a.cc:24:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
24 | int main(){
| ^~
a.cc:24:9: note: remove parentheses to default-initialize a variable
24 | int main(){
| ^~
| --
a.cc:24:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:24:11: error: a function-definition is not allowed here before '{' token
24 | int main(){
| ^
a.cc:32:2: error: expected '}' at end of input
32 | }
| ^
a.cc:14:16: note: to match this '{'
14 | int func(int x){
| ^
a.cc:32:2: warning: control reaches end of non-void function [-Wreturn-type]
32 | }
| ^
|
s005475468 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int n,m;
int func(int x){
int best=INF;
int ans;
rep(i,m){
if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
best=abs(a[x]-c[i])+abs(b[x]-d[i]);
ans=i;
}
return i+1;
}
int main(){
cin>>n>>m;
int a[60],b[60],c[60],d[60];
rep(i,n)cin>>a[i]>>b[i];
rep(i,m)cin>>c[i]>>d[i];
rep(i,n)
cout<<func(i)<<endl;
} | a.cc: In function 'int func(int)':
a.cc:17:12: error: 'a' was not declared in this scope
17 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:17:17: error: 'c' was not declared in this scope
17 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:17:27: error: 'b' was not declared in this scope
17 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:17:32: error: 'd' was not declared in this scope
17 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:23:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
23 | int main(){
| ^~
a.cc:23:9: note: remove parentheses to default-initialize a variable
23 | int main(){
| ^~
| --
a.cc:23:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:23:11: error: a function-definition is not allowed here before '{' token
23 | int main(){
| ^
a.cc:31:2: error: expected '}' at end of input
31 | }
| ^
a.cc:13:16: note: to match this '{'
13 | int func(int x){
| ^
a.cc:31:2: warning: control reaches end of non-void function [-Wreturn-type]
31 | }
| ^
|
s132450463 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int n,m;
int func(int x){
int best=INF;
int ans;
rep(i,m){
if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
best=abs(a[x]-c[i])+abs(b[x]-d[i]);
ans=i;
}
return i+1;
}
int main(){
cin>>n>>m;
vector<int>a(60),b(60),c(60),d(60);
rep(i,n)cin>>a[i]>>b[i];
rep(i,m)cin>>c[i]>>d[i];
rep(i,n)
cout<<func(i)<<endl;
} | a.cc: In function 'int func(int)':
a.cc:17:12: error: 'a' was not declared in this scope
17 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:17:17: error: 'c' was not declared in this scope
17 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:17:27: error: 'b' was not declared in this scope
17 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:17:32: error: 'd' was not declared in this scope
17 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:23:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
23 | int main(){
| ^~
a.cc:23:9: note: remove parentheses to default-initialize a variable
23 | int main(){
| ^~
| --
a.cc:23:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:23:11: error: a function-definition is not allowed here before '{' token
23 | int main(){
| ^
a.cc:31:2: error: expected '}' at end of input
31 | }
| ^
a.cc:13:16: note: to match this '{'
13 | int func(int x){
| ^
a.cc:31:2: warning: control reaches end of non-void function [-Wreturn-type]
31 | }
| ^
|
s507978318 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int func(int x){
int best=INF;
int ans;
rep(i,m){
if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
best=abs(a[x]-c[i])+abs(b[x]-d[i]);
ans=i;
}
return i+1;
}
int main(){
int n,m;
cin>>n>>m;
vector<int>a(60),b(60),c(60),d(60);
rep(i,n)cin>>a[i]>>b[i];
rep(i,m)cin>>c[i]>>d[i];
rep(i,n)
cout<<func(i)<<endl;
} | a.cc: In function 'int func(int)':
a.cc:15:9: error: 'm' was not declared in this scope
15 | rep(i,m){
| ^
a.cc:4:38: note: in definition of macro 'rep'
4 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
| ^
a.cc:16:12: error: 'a' was not declared in this scope
16 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:16:17: error: 'c' was not declared in this scope
16 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:16:27: error: 'b' was not declared in this scope
16 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:16:32: error: 'd' was not declared in this scope
16 | if(abs(a[x]-c[i])+abs(b[x]-d[i])<best){
| ^
a.cc:22:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
22 | int main(){
| ^~
a.cc:22:9: note: remove parentheses to default-initialize a variable
22 | int main(){
| ^~
| --
a.cc:22:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:22:11: error: a function-definition is not allowed here before '{' token
22 | int main(){
| ^
a.cc:30:2: error: expected '}' at end of input
30 | }
| ^
a.cc:12:16: note: to match this '{'
12 | int func(int x){
| ^
a.cc:30:2: warning: control reaches end of non-void function [-Wreturn-type]
30 | }
| ^
|
s553155450 | p03774 | C++ | #include<iostream>
using namespace std;
int n,m;
set<int>q;
int dis(int x1,int y1,int x2,int y2)
{
return abs(x1-x2)+abs(y1-y2);
}
int a1[10000],b1[100000],a2[10000],b2[100000];
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>a1[i]>>b1[i];
}
for(int i=1;i<=m;i++)
{
cin>>a2[i]>>b2[i];
}
for(int i=1;i<=n;i++)
{
int pos;
int Max=(1<<31)-1;
for(int j=1;j<=m;j++)
{
int ans=dis(a1[i],b1[i],a2[j],b2[j]);
if(ans<Max)
{
pos=j;
Max=ans;
}
}
cout<<pos<<endl;
}
return 0;
}
| a.cc:4:1: error: 'set' does not name a type
4 | set<int>q;
| ^~~
a.cc: In function 'int main()':
a.cc:24:24: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
24 | int Max=(1<<31)-1;
| ~~~~~~~^~
|
s294566196 | p03774 | C++ | #include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
struct D{
int x, y;
};
int main(){
int n, m, i, j, C[51] = {0}, t;
D b[51], e[51];
cin >> n >> m;
for(i = 0; i < n; i++){
cin >> b[i].x >> b[i].y;
}
for(i = 0; i < m; i++){
cin >> e[i].x >> e[i].y;
}
for(i = 0; i < n; i++){
int min = 400000000;
for(j = 0; j < m; j++){
if(min>abs(b[i].x-e[j].x)+abs(b[i].y-e[j].y)){
min = abs(b[i].x-e[j].x)+abs(b[i].y-e[j].y);
t = j+1;
}
}
C[i] = t;
}
for(i = 0; i < n; i++){
cout << C[i] << endl;
}
return 0;
} #include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
struct D{
int x, y;
};
int main(){
int n, m, i, j, C[51] = {0}, t;
D b[51], e[51];
cin >> n >> m;
for(i = 0; i < n; i++){
cin >> b[i].x >> b[i].y;
}
for(i = 0; i < m; i++){
cin >> e[i].x >> e[i].y;
}
for(i = 0; i < n; i++){
int min = 400000000;
for(j = 0; j < m; j++){
if(min>abs(b[i].x-e[j].x)+abs(b[i].y-e[j].y)){
min = abs(b[i].x-e[j].x)+abs(b[i].y-e[j].y);
t = j+1;
}
}
C[i] = t;
}
for(i = 0; i < n; i++){
cout << C[i] << endl;
}
return 0;
} | a.cc:32:3: error: stray '#' in program
32 | } #include<iostream>
| ^
a.cc:32:4: error: 'include' does not name a type
32 | } #include<iostream>
| ^~~~~~~
a.cc:36:8: error: redefinition of 'struct D'
36 | struct D{
| ^
a.cc:5:8: note: previous definition of 'struct D'
5 | struct D{
| ^
a.cc:39:5: error: redefinition of 'int main()'
39 | int main(){
| ^~~~
a.cc:8:5: note: 'int main()' previously defined here
8 | int main(){
| ^~~~
|
s802158021 | 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);
}
pair<int,int> ans;
for(int i = 0; i < n; i++){
ans.first = abs(a.at(i) - c.at(0)) + abs(b.at(i) - d.at(0));
ans.second = 1;
for(int j = 1; j < m; j++){
if(abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j)) > ans.first){
ans.first = abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j));
ans.second = j + 1;
}
}
cout << ans << endl;
}
}
| a.cc: In function 'int main()':
a.cc:27:10: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::pair<int, int>')
27 | cout << ans << endl;
| ~~~~ ^~ ~~~
| | |
| | std::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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::pair<int, 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<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::nullptr_t'
|
s051014260 | p03774 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int n = 0, m = 0;
cin >> n >> m;
vector<pair<long long, long long>> 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++) {
long long min = 10000000000, num = 0;
for (int j=0; j<m; j++) {
long long buf = abs(a.at(i).first - b.at(j).first) + abs(a.at(i).second - b.at(j).second);
if (buf < min) {
min = buf;
num = j+1;
}
}
cout << num << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
9 | vector<pair<long long, long long>> a(n), b(m);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <cmath>
+++ |+#include <vector>
3 |
a.cc:9:35: error: expected primary-expression before '>' token
9 | vector<pair<long long, long long>> a(n), b(m);
| ^~
a.cc:9:38: error: 'a' was not declared in this scope
9 | vector<pair<long long, long long>> a(n), b(m);
| ^
a.cc:9:44: error: 'b' was not declared in this scope
9 | vector<pair<long long, long long>> a(n), b(m);
| ^
|
s648488030 | p03774 | C++ | // --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char* argv[]) {
long double N, M;
long double min, cnt;
cin >> N >> M;
vector<long double>a(N), b(N);
vector<long double>c(N), 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++) {
min = 10e8;
cnt = 0;
for (int j = 0; j < M; j++) {
if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
min = abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j]);
cnt = j + 1;
}
}
cout << cnt << endl;
}
return 0;
}
| a.cc: In function 'int main(int, char**)':
a.cc:14:9: error: 'vector' was not declared in this scope
14 | vector<long double>a(N), b(N);
| ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
3 | #include <cmath>
+++ |+#include <vector>
4 |
a.cc:14:16: error: expected primary-expression before 'long'
14 | vector<long double>a(N), b(N);
| ^~~~
a.cc:15:16: error: expected primary-expression before 'long'
15 | vector<long double>c(N), d(M);
| ^~~~
a.cc:18:24: error: 'a' was not declared in this scope
18 | cin >> a[i] >> b[i];
| ^
a.cc:18:32: error: 'b' was not declared in this scope
18 | cin >> a[i] >> b[i];
| ^
a.cc:22:24: error: 'c' was not declared in this scope
22 | cin >> c[i] >> d[i];
| ^
a.cc:22:32: error: 'd' was not declared in this scope
22 | cin >> c[i] >> d[i];
| ^
a.cc:29:52: error: 'a' was not declared in this scope
29 | if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
| ^
a.cc:29:59: error: 'c' was not declared in this scope
29 | if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
| ^
a.cc:29:84: error: 'b' was not declared in this scope
29 | if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
| ^
a.cc:29:91: error: 'd' was not declared in this scope
29 | if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
| ^
|
s890323138 | p03774 | C++ | // --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
long double N, M;
long double min, cnt;
cin >> N >> M;
vector<long double>a(N), b(N);
vector<long double>c(N), 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++) {
min = 10e8;
cnt = 0;
for (int j = 0; j < M; j++) {
if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
min = abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j]);
cnt = j + 1;
}
}
cout << cnt << endl;
}
return 0;
}
| a.cc: In function 'int main(int, char**)':
a.cc:12:9: error: 'vector' was not declared in this scope
12 | vector<long double>a(N), b(N);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <iostream>
+++ |+#include <vector>
3 | using namespace std;
a.cc:12:16: error: expected primary-expression before 'long'
12 | vector<long double>a(N), b(N);
| ^~~~
a.cc:13:16: error: expected primary-expression before 'long'
13 | vector<long double>c(N), d(M);
| ^~~~
a.cc:16:24: error: 'a' was not declared in this scope
16 | cin >> a[i] >> b[i];
| ^
a.cc:16:32: error: 'b' was not declared in this scope
16 | cin >> a[i] >> b[i];
| ^
a.cc:20:24: error: 'c' was not declared in this scope
20 | cin >> c[i] >> d[i];
| ^
a.cc:20:32: error: 'd' was not declared in this scope
20 | cin >> c[i] >> d[i];
| ^
a.cc:27:52: error: 'a' was not declared in this scope
27 | if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
| ^
a.cc:27:59: error: 'c' was not declared in this scope
27 | if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
| ^
a.cc:27:84: error: 'b' was not declared in this scope
27 | if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
| ^
a.cc:27:91: error: 'd' was not declared in this scope
27 | if (min > abs((long double)a[i] - c[j]) + abs((long double)b[i] - d[j])) {
| ^
|
s215398578 | p03774 | C++ | #include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i <(n); i++)
using namespace std;
using ll = long long;
int main()
{
int n, m;
cin << n << m;
int students[n][2];
int points[m][2];
rep(i, n)
cin >> students[i][0] >> students[i][1];
rep(j, m)
cin >> points[j][0] >> points[j][1];
rep(i, n)
{
int p;
int best_d = 1000000000;
rep(j,m)
{
int d = abs(students[i][0] - points[j][0]) + abs(students[i][1] - points[j][1]);
if (d < best_d)
{
p = j;
best_d = d;
}
}
p++;
cout << p << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
9 | cin << n << m;
| ~~~ ^~ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:9:9: note: candidate: 'operator<<(int, int)' (built-in)
9 | cin << n << m;
| ~~~~^~~~
a.cc:9:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
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:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)'
1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:9:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
9 | cin << n << m;
| ^~~
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:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)'
1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
In file included from /usr/include/c++/14/memory:80,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)'
70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
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:
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:9:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
9 | cin << n << m;
| ^
/usr/include/c++/14/ostream |
s325011897 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int inf=1e9;
int main(){
int n,m;
vector<int>a(n),b(n),c(m),d(m),ans(n);
for(int i=0;i<n;i++){
int dst=inf,ans=-1;
for(int j=0;j<m;j++){
if(dst>abs(a[i]-c[j])+abs(b[i]-d[j])ans=j+1;
}
}
for(auto&& u:ans)cout<<u<<endl;
} | a.cc: In function 'int main()':
a.cc:11:61: error: expected ';' before 'ans'
11 | if(dst>abs(a[i]-c[j])+abs(b[i]-d[j])ans=j+1;
| ^~~
| ;
a.cc:12:9: error: expected primary-expression before '}' token
12 | }
| ^
a.cc:11:69: error: expected ')' before '}' token
11 | if(dst>abs(a[i]-c[j])+abs(b[i]-d[j])ans=j+1;
| ~ ^
| )
12 | }
| ~
a.cc:12:9: error: expected primary-expression before '}' token
12 | }
| ^
|
s337658411 | p03774 | C | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>
#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
int compare_sz_asc(const void* a, const void* b) {
return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}
int compare_sz_desc(const void* a, const void* b) {
return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}
int compare_i64_asc(const void* a, const void* b) {
return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}
int compare_i64_desc(const void* a, const void* b) {
return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}
int compare_c_asc(const void* a, const void* b) {
return *((char*)a) < *((char*)b) ? -1 : 1;
}
int compare_c_desc(const void* a, const void* b) {
return *((char*)a) > * ((char*)b) ? -1 : 1;
}
static size_t powSz(const size_t base, const size_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powSz(base * base, exp / 2);
}
else {
return base * powSz(base, exp - 1);
}
}
static size_t comb(const size_t n, const size_t r) {
size_t result = 1;
for (size_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64(const uint64_t n, const uint64_t r) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static size_t gcdZu(size_t m, size_t n) {
size_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static uint64_t gcdU64(uint64_t m, uint64_t n)
{
uint64_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
int main(void) {
size_t N,M;
int32_t a[50], b[50], c[50], d[50];
scanf("%zu\n", &N);
for (size_t i = 0; i < N; i++) {
scanf("%"PRId32" %"PRId32"\n", &(a[i]), &(b[i]));
}
for (size_t i = 0; i < M; i++) {
scanf("%"PRId32" %"PRId32, &(c[i]), &(d[i]));
if (i < M - 1) {
scanf("\n");
}
}
for (size_t i = 0; i < N; i++) {
size_t nearestCP = 0;
size_t distanceToNearestCP = (size_t)ABS(a[i] - c[0]) + (size_t)ABS(b[i], d[0]);
for (size_t cp = 1; cp < M; cp++) {
const size_t distanceToCP = (size_t)ABS(a[i] - c[cp]) + (size_t)ABS(b[i], d[cp]);
if (distanceToCP < distanceToNearestCP) {
nearestCP = cp;
distanceToNearestCP = distanceToCP;
}
}
printf("%zu\n", nearestCP + 1);
}
return 0;
}
| main.c: In function 'main':
main.c:125:87: error: macro "ABS" passed 2 arguments, but takes just 1
125 | size_t distanceToNearestCP = (size_t)ABS(a[i] - c[0]) + (size_t)ABS(b[i], d[0]);
| ^
main.c:17:9: note: macro "ABS" defined here
17 | #define ABS(a) ((a) < 0 ? -(a) : (a))
| ^~~
main.c:125:73: error: 'ABS' undeclared (first use in this function)
125 | size_t distanceToNearestCP = (size_t)ABS(a[i] - c[0]) + (size_t)ABS(b[i], d[0]);
| ^~~
main.c:125:73: note: each undeclared identifier is reported only once for each function it appears in
main.c:127:92: error: macro "ABS" passed 2 arguments, but takes just 1
127 | const size_t distanceToCP = (size_t)ABS(a[i] - c[cp]) + (size_t)ABS(b[i], d[cp]);
| ^
main.c:17:9: note: macro "ABS" defined here
17 | #define ABS(a) ((a) < 0 ? -(a) : (a))
| ^~~
|
s590786899 | p03774 | C | #include<bits/stdc++.h>
using namespace std;
int main(){
int N , M , ans1 , ans2=1000000000 , ans;
cin>>N>>M;
vector<int> A(N) , B(N) , C(M) , 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++){
ans2=1000000000;
for(int j=0;j<M;j++){
ans1=abs(A[i]-C[j])+abs(B[i]-D[j]);
if(ans2>ans1){
ans2=ans1;
ans=j;
}
}
cout<<ans+1<<endl;
}
} | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s351905706 | p03774 | C++ | #include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int a[55][2], b[55][2];
int main(){
// freopen("input.txt", "r", stdin);
int N, M;
cin >> N >> 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)
{
int mm = INT_MAX;
int id;
for (int j = 0; j < M; ++j)
{
int dis = abs(a[i][0]- b[j][0]) + abs(a[i][1]- b[j][1]);
if(mm > dis){
id = j + 1;
mm = dis;
}
}
cout << id << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:26: error: 'INT_MAX' was not declared in this scope
24 | int mm = INT_MAX;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <cstdio>
+++ |+#include <climits>
4 |
|
s049707908 | p03774 | Java | import java.util.*;
public class Main {
static Scanner scanner = new Scanner(System.in);
public static void main(String[]$) {
int n = scanner.nextInt();
int m = scanner.nextInt();
int[] a = new int[n];
int[] b = new int[n];
for (int i = 0; i < n; i++) {
a[i] = scanner.nextInt();
b[i] = scanner.nextInt();
}
int[] c = new int[m];
int[] d = new int[m];
for (int i = 0; i < m; i++) {
c[i] = scanner.nextInt();
d[i] = scanner.nextInt();
}
for (int i = 0; i < n; i++) {
int min = Integer.MAX_VALUE;
int index;
for (int j = m - 1; j >= 0; j++) {
int dist = Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]);
if (min >= dist) {
min = dist;
index = j + 1;
}
}
System.out.println(index);
}
}
} | Main.java:31: error: variable index might not have been initialized
System.out.println(index);
^
1 error
|
s217446444 | p03774 | Java | import util.java.*;
public class Main {
static Scanner scanner = new Scanner(System.in);
public static void main(String[]$) {
int n = scanner.nextInt();
int m = scanner.nextInt();
int[] a = new int[n];
int[] b = new int[n];
for (int i = 0; i < n; i++) {
a[i] = scanner.nextInt();
b[i] = scanner.nextInt();
}
int[] c = new int[m];
int[] d = new int[m];
for (int i = 0; i < m; i++) {
c[i] = scanner.nextInt();
d[i] = scanner.nextInt();
}
for (int i = 0; i < n; i++) {
int min = Integer.MAX_VALUE;
int index;
for (int j = m - 1; j >= 0; j++) {
int dist = Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]);
if (min >= dist) {
min = dist;
index = j + 1;
}
}
System.out.println(index);
}
}
} | Main.java:4: error: cannot find symbol
static Scanner scanner = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:1: error: package util.java does not exist
import util.java.*;
^
Main.java:4: error: cannot find symbol
static Scanner scanner = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
3 errors
|
s572828562 | p03774 | C++ | #include<bits/stc++.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 max=0;
int sum=0;
for(int j=0;j<M;j++){
int X=abs(a.at(i)-c.at(j));
int Y=abs(b.at(i)-d.at(j));
sum=X+Y;
if(max<sum){
max=sum;
}
}
cout<<max<<endl;
}
}
| a.cc:1:9: fatal error: bits/stc++.h: No such file or directory
1 | #include<bits/stc++.h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s158033440 | 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.at(i) >> b.at(i);
}
vector<int> c(m);
vector<int> d(m);
for (int i = 0; i < m; i++)
{
cin >> c.at(i) >> d.at(i);
}
int miti;
int hozon;
int xxx;
for(int i=0;i<n;i++){
hozon=abs(a.at(0)-c.at(0))+abs(b.at(0)-d.at(0));;
xxx=0;
for(int j=0;j<m;j++){
miti=abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j));
if(hozon<=miti){
continue;
}
else{
hozon=miti;
xxx=j;
}
}
cout<<xxx+1<<endl;
}
| a.cc: In function 'int main()':
a.cc:38:2: error: expected '}' at end of input
38 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s740691398 | 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 = ; i < n; i++)
{
cin >> a.at(i) >> b.at(i);
}
vector<int> c(m);
vector<int> d(m);
for (int i = 0; i < m; i++)
{
cin >> c.at(i) >> d.at(i);
}
int miti;
int hozon;
int xxx;
for(int i=0;i<n;i++){
hozon=0;
for(int j=0;j<m;j++){
miti=abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j));
if(hozon==miti){
}
hozon=min(hozon,miti);
if(hozon==miti){
xxx=j;
}
}
cout<<xxx<<endl;
}
} | a.cc: In function 'int main()':
a.cc:10:18: error: expected primary-expression before ';' token
10 | for (int i = ; i < n; i++)
| ^
|
s903882853 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define INF 2e9
#define ll long long
int main(){
int n, m;
cin>>n>>m;
int a[n], b[n], c[m], d[m];
int i;
REP(i, n){
cin>>a[i]>>b[i];
}
for(i=0; i<m; i++){
cin>>c[i]>>d[i];
}
int min = INF;
bango = 0;
for(i=0; i<n; i++){
for(int j=m-1; j>=0; j--){
if(min>abs(a[i]-c[j])+abs(b[i]-d[j])){
min = abs(a[i]-c[j])+abs(b[i]-d[j]);
bango = i+1;
}
}
cout<<min<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:5: error: 'bango' was not declared in this scope
23 | bango = 0;
| ^~~~~
|
s772518416 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define INF 2e9
#define ll long long
int main(){
int n, m;
cin>>n>>m;
int a[n], b[n], c[m], d[m];
int i;
REP(i, n){
cin>>a[i]>>b[i];
}
for(i=0; i<m; i++){
cin>>c[i]>>d[i];
}
int min = INF;
for(i=0; i<n; i++){
for(i=0; i<m; i++){
if(min>abs(a[i]-c[i])+abs(b[i]-d[i])){
min = abs(a[i]-c[i])+abs(b[i]-d[i])
}
}
cout<<min<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:52: error: expected ';' before '}' token
26 | min = abs(a[i]-c[i])+abs(b[i]-d[i])
| ^
| ;
27 | }
| ~
|
s616830006 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define INF 2e9
#define ll long long
int main(){
int n, m;
cin>>n>>m;
int a[n], b[n], c[m], d[m];
REP(i, n){
cin>>a[i]>>b[i];
}
for(i=0; i<m; i++){
cin>>c[i]>>d[i];
}
int min = INF;
for(i=0; i<n; i++){
for(i=0; i<m; i++){
if(min>abs(a[i]-c[i])+abs(b[i]-d[i])){
min = abs(a[i]-c[i])+abs(b[i]-d[i])
}
}
cout<<min<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:9: error: 'i' was not declared in this scope
18 | for(i=0; i<m; i++){
| ^
a.cc:22:9: error: 'i' was not declared in this scope
22 | for(i=0; i<n; i++){
| ^
|
s770989851 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define INF 2e9
#define ll long long
int main(){
int n, m;
cin>>n>>m;
int a[n], b[n], c[m], d[m];
REP(i, n){
cin>>a[i]>>b[i];
}
for(i=0; i<m; i++){
cin>>c[i]>>d[i];
}
min = INF;
for(i=0; i<n; i++){
for(i=0; i<m; i++){
if(min>abs(a[i]-c[i])+abs(b[i]-d[i])){
min = abs(a[i]-c[i])+abs(b[i]-d[i])
}
}
cout<<min<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:9: error: 'i' was not declared in this scope
18 | for(i=0; i<m; i++){
| ^
a.cc:8:13: error: overloaded function with no contextual type information
8 | #define INF 2e9
| ^~~
a.cc:21:11: note: in expansion of macro 'INF'
21 | min = INF;
| ^~~
a.cc:22:9: error: 'i' was not declared in this scope
22 | for(i=0; i<n; i++){
| ^
a.cc:28:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
28 | cout<<min<<endl;
| ~~~~^~~~~
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 '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overl |
s371915700 | p03774 | C++ | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
int main(void){
int N,M;
cin >> N >> M;
vector<vector<int>>person(N,vector<int>(2,0));
for(int i=0;i<N;i++){
cin >> person[i][0];
cin >> person[i][1];
}
vector<vector<int>>point(M,vector<int>(2,0));
for(int i=0;i<M;i++){
cin >> point[i][0];
cin >> point[i][1];
}
for(int i=0;i<N;i++){
int distance_to_point = 1000000000;
int ans;
for(int i=0;i<M;i++){
int distance = abs(person[i][0] - point[j][0]) + abs(person[i][1] - point[j][1]);
if(distance_to_point > distance){
distance_to_point = distance;
ans = j + 1;
}
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >> N >> M;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
9 | vector<vector<int>>person(N,vector<int>(2,0));
| ^~~~~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:9:17: error: expected primary-expression before 'int'
9 | vector<vector<int>>person(N,vector<int>(2,0));
| ^~~
a.cc:11:12: error: 'person' was not declared in this scope; did you mean 'perror'?
11 | cin >> person[i][0];
| ^~~~~~
| perror
a.cc:15:17: error: expected primary-expression before 'int'
15 | vector<vector<int>>point(M,vector<int>(2,0));
| ^~~
a.cc:17:12: error: 'point' was not declared in this scope
17 | cin >> point[i][0];
| ^~~~~
a.cc:25:26: error: 'person' was not declared in this scope; did you mean 'perror'?
25 | int distance = abs(person[i][0] - point[j][0]) + abs(person[i][1] - point[j][1]);
| ^~~~~~
| perror
a.cc:25:41: error: 'point' was not declared in this scope
25 | int distance = abs(person[i][0] - point[j][0]) + abs(person[i][1] - point[j][1]);
| ^~~~~
a.cc:25:47: error: 'j' was not declared in this scope
25 | int distance = abs(person[i][0] - point[j][0]) + abs(person[i][1] - point[j][1]);
| ^
a.cc:31:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
31 | cout << ans << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:31:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
31 | cout << ans << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s350808818 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
vector<int> ans(n);
vector<int> a(n);
vector<int> b(n);
vector<int> c(m);
vector<int> d(m);
vector<>
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 manhattan=400000002;
for(int j=0;j<m;j++){
if(abs(a[i]-c[j])+abs(b[i]-d[j])<manhattan){manhattan=abs(a[i]-c[j])+abs(b[i]-d[j]);ans[i]=j+1;}
}
}
for(int i=0;i<n;i++){
cout<<ans[i]<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:11:10: error: wrong number of template arguments (0, should be at least 1)
11 | vector<>
| ^
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:428:11: note: provided for 'template<class _Tp, class _Alloc> class std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
a.cc:12:3: error: expected unqualified-id before 'for'
12 | for(int i=0;i<n;i++){
| ^~~
a.cc:12:15: error: 'i' was not declared in this scope
12 | for(int i=0;i<n;i++){
| ^
|
s771347305 | p03774 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define MAXP 0x0FFFFFFF
typedef struct{
TLong x;
TLong y;
} point;
int main(int argc, char const *argv[])
{
int n,m;
int pNum;
TLong min;
point std[53],cp[53];
scanf("%d%d",&n,&m);
for (int i = 0; i < n; ++i) scanf("%lld%lld", &std[i].x, &std[i].y);
for (int i = 0; i < m; ++i) scanf("%lld%lld", &cp[i].x, &cp[i].y);
for (int i = 0; i < n; ++i)
{
min = MAXP;
pNum = 0;
for (int j = 0; j < m; ++j)
{
if(MHD(std[i],cp[j]) < min){
min = MHD(std[i],cp[j]);
pNum = j;
}
}
printf("%d\n",pNum + 1);
}
return 0;
}
| main.c: In function 'main':
main.c:31:28: error: implicit declaration of function 'MHD' [-Wimplicit-function-declaration]
31 | if(MHD(std[i],cp[j]) < min){
| ^~~
|
s334320375 | p03774 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <limit.h>
int main()
{
int point[50][2];
int check[50][2];
int N,M;
int i, j;
int minditance;
int distance;
int minnum = 0;
scanf("%d%d",&N,&M);
for (i = 0; i < N; i++) {
scanf("%d%d", &point[i][0], &point[i][1]);
}
for (i = 0; i < M; i++) {
scanf("%d%d", &check[i][0], &check[i][1]);
}
for (i = 0; i < N; i++) {
minditance = INT_MAX;
for (j = 0; j < M; j++) {
distance = abs(point[i][0] - check[j][0]) + abs(point[i][1] - check[j][1]);
if (minditance > distance) {
minditance = distance;
minnum = j;
}
}
printf("%d\n", minnum + 1);
}
return 0;
}
| a.cc:3:10: fatal error: limit.h: No such file or directory
3 | #include <limit.h>
| ^~~~~~~~~
compilation terminated.
|
s514054060 | p03774 | C++ | #include <stdlib.h>
int main()
{
int point[50][2];
int check[50][2];
int N,M;
int i, j;
int minditance;
int distance;
int minnum = 0;
scanf("%d%d",&N,&M);
for (i = 0; i < N; i++) {
scanf("%d%d", &point[i][0], &point[i][1]);
}
for (i = 0; i < M; i++) {
scanf("%d%d", &check[i][0], &check[i][1]);
}
for (i = 0; i < N; i++) {
minditance = INT_MAX;
for (j = 0; j < M; j++) {
distance = abs(point[i][0] - check[j][0]) + abs(point[i][1] - check[j][1]);
if (minditance > distance) {
minditance = distance;
minnum = j;
}
}
printf("%d\n", minnum + 1);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'scanf' was not declared in this scope
14 | scanf("%d%d",&N,&M);
| ^~~~~
a.cc:23:30: error: 'INT_MAX' was not declared in this scope
23 | minditance = INT_MAX;
| ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <stdlib.h>
+++ |+#include <climits>
2 |
a.cc:31:17: error: 'printf' was not declared in this scope
31 | printf("%d\n", minnum + 1);
| ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
1 | #include <stdlib.h>
+++ |+#include <cstdio>
2 |
|
s700041237 | p03774 | C++ |
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int getdis(int a, int b, int c, int d) {
return abs(a - c) + abs(b - d);
}
int main() {
int a[50];
int b[50];
int c[50];
int d[50];
int n, m;
int dis;
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];
}
for (int i = 0; i < n; i++) {
int wk_dis = INT_MAX;
int ansindex;
for (int j = 0; j < m; j++) {
dis = getdis(a[i], b[i], c[j], d[j]);
if (dis < wk_dis) {
ansindex = j;
wk_dis = dis;
}
}
cout << ansindex+1 << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:30: error: 'INT_MAX' was not declared in this scope
34 | int wk_dis = INT_MAX;
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <stdlib.h>
+++ |+#include <climits>
5 |
|
s767759368 | p03774 | C++ | #include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int getdis(int a, int b, int c, int d) {
return abs(a - c) + abs(b - d);
}
int main() {
int a[50];
int b[50];
int c[50];
int d[50];
int n, m;
int dis;
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];
}
for (int i = 0; i < n; i++) {
int wk_dis = INT_MAX;
int ansindex;
for (int j = 0; j < m; j++) {
dis = getdis(a[i], b[i], c[j], d[j]);
if (dis < wk_dis) {
ansindex = j;
wk_dis = dis;
}
}
cout << ansindex+1 << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:33:30: error: 'INT_MAX' was not declared in this scope
33 | int wk_dis = INT_MAX;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <stdlib.h>
+++ |+#include <climits>
4 |
|
s286663449 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, M, num, mi;
cin >> N >> M;
int a[N];
int b[N];
int c[M];
int 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 j = 0;j < N;j++){
mi = 200000001;
for(int i = 0;i < M;i++){
if(mi > abs(a[j] - c[i]) + abs(b[j] - d[i])){
num = i + 1;
mi = abs(a[j] - c[i]) + abs(b[j] - d[i]);
}
}
cout << num << endl;
}
| a.cc: In function 'int main()':
a.cc:31:4: error: expected '}' at end of input
31 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s621276347 | p03774 | Java | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int m = Integer.parseInt(sc.next());
int[] ax = new int[n];
int[] ay = new int[n];
int[] bx = new int[m];
int[] by = new int[m];
for(int i = 0; i<n; i++) {
ax[i] = Integer.parseInt(sc.next());
ay[i] = Integer.parseInt(sc.next());
}
for(int i = 0; i<m; i++) {
bx[i] = Integer.parseInt(sc.next());
by[i] = Integer.parseInt(sc.next());
}
int min = Integer.MAX_VALUE;
int minI = 0;
for(int i = 0; i<n; i++) {
min= Integer.MAX_VALUE;
for(int j = 0; j<m; j++) {
long manhattan = (long)Math.abs(ax[i]-bx[j]) + (long)Math.abs(ay[i]-by[j]);
if(manhattan < min ) {
min = manhattan;
minI = j+1;
}
}
System.out.println(minI);
}
}
} | Main.java:30: error: incompatible types: possible lossy conversion from long to int
min = manhattan;
^
1 error
|
s169618442 | p03774 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
int main() {
std::cin.tie(nullptr); std::ios::sync_with_stdio(false);
int N, M; std::cin >> N >> M;
std::vector<int> a(N), b(N), c(M), d(M);
for (int i = 0; i < N; i++) {
std::cin >> a.at(i) >> b.at(i);
}
for (int i = 0; i < M; i++) {
std::cin >> c.at(i) >> d.at(i);
}
int nearest = 400000001, check_point = 0;
for (int i = 0; i < N; i++) {
nearest = 400000001;
for (int j = 0; j < M; j++)
{
const int cur = abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j));
if (cur < nearest) {
nearest = cur;
check_point = j + 1;
}
}
}
std::cout << check_point;
return 0;
}
std::cout << check_point;
return 0;
} | a.cc:40:14: error: 'cout' in namespace 'std' does not name a type
40 | std::cout << check_point;
| ^~~~
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:43:9: error: expected unqualified-id before 'return'
43 | return 0;
| ^~~~~~
a.cc:44:1: error: expected declaration before '}' token
44 | }
| ^
|
s113001490 | p03774 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main(){
int n,m;
cin>>n>>m;
long long a[n],b[n],c[m],d[m];
REP(i,n){
cin>>a[i]>>b[i];
}
REP(i,m){
cin>>c[i]>>d[i];
}
int ans[n];
int check=-1;
long long dist=inf;
REP(i,n){
for(int j=m-1;j>=0;j--){
if(abs(a[i]-c[j])+abs(b[i]-d[j])<=dist){
dist = abs(a[i]-c[j])+abs(b[i]-d[j]);
check=j;
}
}
ans[i]=j;
check=-1;
dist=inf;
}
REP(i,n){
ans[i]++;
cout<<ans[i]<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:91:12: error: 'j' was not declared in this scope
91 | ans[i]=j;
| ^
|
s162834986 | p03774 | Java | import java.util.*;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[][] stu = new int[n][2];
for(int i = 0; i < n; i++){
stu[i][0] = sc.nextInt();
stu[i][1] = sc.nextInt();
}
int[][] cp = new[m][2];
for(int i = 0; i < n; i++){
cp[i][0] = sc.nextInt();
cp[i][1] = sc.nextInt();
}
for(int i = 0; i < stu.length; i++){
int min = -1;
int d = 1_000_000;
for (int j = 0; j < cp.length; j++) {
int temp = Math.abs(stu[i][0] - cp[j][0]) + Math.abs(stu[i][1] - cp[j][1]);
if(d > temp){
min = j;
d = temp;
}
}
System.out.println(min + 1);
}
}
} | Main.java:13: error: <identifier> expected
int[][] cp = new[m][2];
^
1 error
|
s651434881 | p03774 | C++ | #include <cstdio>
#include <cmath>
usin namespace std;
int main() {
int s_x[51], s_y[51], m_x[51], m_y[51], cur_dis;
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) scanf("%d%d", &s_x[i], &s_y[i]);
for (int i = 0; i < m; i++) scanf("%d%d", &m_x[i], &m_y[i]);
for (int i = 0; i < n; i++) {
int update_dis = abs(s_x[i] - m_x[0]) + abs(s_y[i] - m_y[0]), checkpoint;
if (update_dis > cur_dis) {
for (int j = 1; j < m; j++) {
cur_dis = abs(s_x[i] - m_x[j]) + abs(s_y[i] - m_y[j]);
if (update_dis > cur_dis) {
update_dis = cur_dis;
checkpoint = j + 1;
}
}
printf("%d\n", checkpoint);
}
return 0;
}
} | a.cc:3:1: error: 'usin' does not name a type
3 | usin namespace std;
| ^~~~
|
s690390964 | p03774 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
int a[n],b[n],c[m],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=1;
int k=abs(c[0]-a[i])+abs(d[0]-b[i]);
for(int j=1;j<m;j++){
if(k>abs(c[j]-k[i])+abs(d[j]-k[i])){
ans=j+1;
k=abs(c[j]-k[i])+abs(d[j]-k[i]);
}
}
cout << ans << endl;
}
}
| a.cc: In function 'int main()':
a.cc:20:22: error: invalid types 'int[int]' for array subscript
20 | if(k>abs(c[j]-k[i])+abs(d[j]-k[i])){
| ^
a.cc:20:37: error: invalid types 'int[int]' for array subscript
20 | if(k>abs(c[j]-k[i])+abs(d[j]-k[i])){
| ^
a.cc:22:21: error: invalid types 'int[int]' for array subscript
22 | k=abs(c[j]-k[i])+abs(d[j]-k[i]);
| ^
a.cc:22:36: error: invalid types 'int[int]' for array subscript
22 | k=abs(c[j]-k[i])+abs(d[j]-k[i]);
| ^
|
s417704316 | p03774 | C++ | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long unsigned int ll;
int main() {
int N, M;
cin >> N >> M;
vector< pair<int, int> > students(N);
for (int i = 0; i < N; ++i) {
int a, b;
cin >> a >> b;
students[i] = make_pair(a, b);
}
vector< pair<int, int> > ans(N, pair<int, int>(0, INT_MAX));
for (int i = 0; i < M; ++i) {
int c, d;
cin >> c >> d;
for (int j = 0; j < N; ++j) {
int distance = abs(students[j].first - c) + abs(students[j].second - d);
if (ans[j].second > distance) {
ans[j].first = i;
ans[j].second = distance;
}
}
}
for (int i = 0; i < N; ++i) {
cout << ans[i].first + 1 << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:40:53: error: 'INT_MAX' was not declared in this scope
40 | vector< pair<int, int> > ans(N, pair<int, int>(0, INT_MAX));
| ^~~~~~~
a.cc:18:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
17 | #include <fstream>
+++ |+#include <climits>
18 |
|
s883469576 | p03774 | C++ | #include <bits/stdc++.h>
#define INF 1000000007
using namespace std;
int nearest_checkpoint(int , int y, int m, int c[], int d[]) {
int ret = 0, ds = INF;
for (int i = 0; i < m; i++) {
int nds = abs(x - c[i]) + abs(y - d[i]);
if (nds < ds) {
ds = nds;
ret = i + 1;
}
}
return ret;
}
int main() {
int n, m;
cin >> n >> m;
int a[n], b[n];
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
}
int c[m], d[m];
for (int i = 0; i < m; i++) {
cin >> c[i] >> d[i];
}
for (int i = 0; i < n; i++) {
cout << nearest_checkpoint(a[i], b[i], m, c, d) << endl;
}
return 0;
} | a.cc: In function 'int nearest_checkpoint(int, int, int, int*, int*)':
a.cc:8:19: error: 'x' was not declared in this scope
8 | int nds = abs(x - c[i]) + abs(y - d[i]);
| ^
|
s136500354 | p03774 | C++ | #include <bits/stdc++.h>
#define INF 1000000007
using namespace std;
int nearest_checkpoint(int , int y, int m, int c[], int d[]) {
int ret = 0, ds = INF;
for (int i = 0; i < m; i++) {
nds = abs(x - c[i]) + abs(y - d[i]);
if (nds < ds) {
ds = nds;
ret = i + 1;
}
}
return ret;
}
int main() {
int n, m;
cin >> n >> m;
int a[n], b[n];
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
}
int c[m], d[m];
for (int i = 0; i < m; i++) {
cin >> c[i] >> d[i];
}
for (int i = 0; i < n; i++) {
cout << nearest_checkpoint(a[i], b[i], m, c, d) << endl;
}
return 0;
} | a.cc: In function 'int nearest_checkpoint(int, int, int, int*, int*)':
a.cc:8:5: error: 'nds' was not declared in this scope; did you mean 'ds'?
8 | nds = abs(x - c[i]) + abs(y - d[i]);
| ^~~
| ds
a.cc:8:15: error: 'x' was not declared in this scope
8 | nds = abs(x - c[i]) + abs(y - d[i]);
| ^
|
s154826507 | p03774 | C++ | #include <bits/stdc++.h>
#define INF 1000000007
using namespace std;
int nearest_checkpoint(int , int y, int m, int c[], int d[]) {
int ret = 0, ds = INF;
for (int i = 0; i < m; i++) {
nds = abs(x - c[i]) + abs(y - d[i]);
if (nds < ds) {
ds = nds;
ret = i;
}
}
return ret;
}
int main() {
int n, m;
cin >> n >> m;
int a[n], b[n];
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
}
int c[m], d[m];
for (int i = 0; i < m; i++) {
cin >> c[i] >> d[i];
}
for (int i = 0; i < n; i++) {
cout << nearest_checkpoint(a[i], b[i], m, c, d) << endl;
}
return 0;
} | a.cc: In function 'int nearest_checkpoint(int, int, int, int*, int*)':
a.cc:8:5: error: 'nds' was not declared in this scope; did you mean 'ds'?
8 | nds = abs(x - c[i]) + abs(y - d[i]);
| ^~~
| ds
a.cc:8:15: error: 'x' was not declared in this scope
8 | nds = abs(x - c[i]) + abs(y - d[i]);
| ^
|
s647820605 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m, i, j, r, t;
cin >> n >> m;
int a[n][2], b[m][2];
for(i=0; i<n; i++){
cin >> a[i][0] >> a[i][1];
}
for(i=0; i<m; i++){
cin >> b[i][0] >> b[i][1];
}
for(i=0; i<n; i++){
r = 1000000000;
t = 0
for(j=0; j<m; j++){
if(r > abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])){
r = abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1]);
t = j+1;
}
}
cout << t << '\n';
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:14: error: expected ';' before 'for'
16 | t = 0
| ^
| ;
17 | for(j=0; j<m; j++){
| ~~~
a.cc:17:26: error: expected ';' before ')' token
17 | for(j=0; j<m; j++){
| ^
| ;
|
s745541921 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main () {
int N, M;
cin >> N >> M;
vector<pair<int,int>> human(N), check(M);
for(int i = 0; i < N; i++) {
cin >> human.at(i).first >> human.at(i).second;
}
for(int i = 0; i < M; i++) {
cin >> check.at(i).first >> check.at(i).second;
}
long ans, num, sub;
for(int i = 0; i < N; i++) {
ans = 10000000000, num = -1;
for(int j = 0; j < M; j++) {
sub = abs(human.at(i).first - check.at(j).first) + abs(human.at(i).second - check.at(j).second);
if(ans > sub) {
ans = sub;
num = j + 1;
}
}
cout << nm << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:13: error: 'nm' was not declared in this scope; did you mean 'num'?
23 | cout << nm << endl;
| ^~
| num
|
s950440975 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std ;
int main () {
int N , M ;
cin >> N >> M ;
int A[100][2] , B[100][2] ;
for(int i = 0 ; i < N ; i ++ ){
int a , b ;
cin >> a >> b ;
A[i][0] = a ;
A[i][1] = b ;
}
for(int i = 0 ; i < M ; i ++ ){
int a , b ;
cin >> a >> b ;
B[i][0] = a ;
B[i][1] = b ;
}
for(int i = 0 ; i < N ; i++ ) {
long long d[M] ;
long longt pre = 100000000 ;
long long ans = 0 ;
for(int j = M - 1 ; j >= 0 ; j-- ){
d[i] = abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1]) ;
if(pre>d[i]) ans = j ;
}
cout << ans + 1 << endl ;
}
} | a.cc: In function 'int main()':
a.cc:22:16: error: expected initializer before 'pre'
22 | long longt pre = 100000000 ;
| ^~~
a.cc:26:10: error: 'pre' was not declared in this scope; did you mean 'pread'?
26 | if(pre>d[i]) ans = j ;
| ^~~
| pread
|
s095534900 | p03774 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 30;
const double EPS = 1e-10;
const double pi = 3.14159265359;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------
int n, m;
int a[55], b[55], c[55], d[55];
int main()
{
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];
}
for (int i = 0;i < n;i++) {
int d = INF;
int CP = 0;
for (int j = 0;j < m;j++) {
if (d > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
CP = j;
}
}
cout << CP << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:45:64: error: invalid types 'int[int]' for array subscript
45 | if (d > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
| ^
|
s945892660 | p03774 | C++ | #ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;
typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;
/*
__attribute__((constructor))
void initial()
{
cin.tie(NULL);
ios::sync_with_stdio(false);
}
*/
int main()
{
cin.tie(NULL);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
ll a[N], b[N], c[M], d[M];
rep(i, N)
{
cin >> a[i] >> b[i];
}
ll e[N][M];
rep(i, M)
{
cin >> c[i] >> d[i];
for(int j = 0; j < N; j++)
{
e[j][i] = abs(a[j] - c[i]) + abs(b[j] - d[i]);
}
}
rep(i, N)
{
ll min = MOD;
int idx = -1;
rep(j, M)
{
if (e[i][j] < min)
{
min = e[i][j];
idx = j;
}
}
cout << j + 1 << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:67:25: error: 'j' was not declared in this scope
67 | cout << j + 1 << endl;
| ^
|
s366036553 | p03774 | C++ | include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
vector<vector<long long int>> a(n, vector <long long int>(2));
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 2; j++)
{
cin >> a.at(i).at(j);
}
}
vector<long long int> ap(n);
for (int i = 0; i < n; i++)
{
long long int m =10000000 ;
for (int k = 0; k < m; k++)
{
long long int c, d;
cin >> c >> d;
long long int x = abs(a.at(i).at(0) - c) + abs(a.at(i).at(1) - d);
if (m>x)
{
m = x;
}
}
ap.at(i) = { m };
}
for (int i = 0; i < n; i++)
{
cout << ap.at(i) << endl;
}
}
| a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| |
s310191259 | p03774 | C | #include<stdio.h>
int dif(int a, int b);
int N, M, A, B, C, D, min, i, j;
int MAX = 1073741824;
int main(){
scanf("%d%d", &N, &M);
for(i=0; i<N; i++){
scanf("%d%d", A+i, B+i);
}
for(j=0; j<M; j++){
scanf("%d%d", C+j, D+j);
}
for(i=0; i<N; i++){
min = max;
for(j=0; j<M; j++){
if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
min=j;
}
}
printf("%d\n", min);
}
}
int dif(int a, int b){
return a<b?b-a:a-b;
}
| main.c: In function 'main':
main.c:14:11: error: 'max' undeclared (first use in this function)
14 | min = max;
| ^~~
main.c:14:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:15: error: subscripted value is neither array nor pointer nor vector
16 | if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
| ^
main.c:16:21: error: subscripted value is neither array nor pointer nor vector
16 | if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
| ^
main.c:16:31: error: subscripted value is neither array nor pointer nor vector
16 | if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
| ^
main.c:16:37: error: subscripted value is neither array nor pointer nor vector
16 | if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
| ^
main.c:16:49: error: subscripted value is neither array nor pointer nor vector
16 | if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
| ^
main.c:16:55: error: subscripted value is neither array nor pointer nor vector
16 | if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
| ^
main.c:16:67: error: subscripted value is neither array nor pointer nor vector
16 | if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
| ^
main.c:16:73: error: subscripted value is neither array nor pointer nor vector
16 | if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
| ^
|
s216221887 | p03774 | C++ | #include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
int main(){
int N,M;
cin >> N >> M;
int a[50],b[50],c[50],d[50];
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 = 0;
int m = INT_MAX;
for(int j=0; j<M; j++){
if(abs(a[i]-c[j])+abs(b[i]-d[j]) < m){
ans = j;
m = abs(a[i]-c[j])+abs(b[i]-d[j]);
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:28:25: error: 'INT_MAX' was not declared in this scope
28 | int m = INT_MAX;
| ^~~~~~~
a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
16 | #include <cassert>
+++ |+#include <climits>
17 | using namespace std;
|
s796869554 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int 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);
int minmht = -1, minp=0;
for (int i=0; i<N; i++) {
for (int j=0; j<M; j++) {
if (minmht==-1 || minmht>abs(a.at(i)-c.at(j))+abc(b.at(i)-d.at(j))) {
minp = j+1;
minmht = abs(a.at(i)-c.at(j))+abc(b.at(i)-d.at(j));
}
}
cout << minp << endl;
minmht = -1;
minp = 0;
}
} | a.cc: In function 'int main()':
a.cc:14:53: error: 'abc' was not declared in this scope; did you mean 'abs'?
14 | if (minmht==-1 || minmht>abs(a.at(i)-c.at(j))+abc(b.at(i)-d.at(j))) {
| ^~~
| abs
|
s073059150 | p03774 | C++ | #include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
int n, m;
cin >> n >> m;
vector<int> a(n);
vector<int> b(n);
vector<int> c(m);
vector<int> d(m);
vector<int> ans(n);
int INF = 1 << 29;
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 t = (abs(a[i]-c[j]) + abs(b[i]-d[j]));
if (t < min) {
min = dis;
ans[i] = j+1;
}
}
}
for (int i = 0; i < n; ++i) cout << ans[i] << std::endl;
return 0;
} | a.cc: In function 'int main(int, const char**)':
a.cc:30:23: error: 'dis' was not declared in this scope; did you mean 'div'?
30 | min = dis;
| ^~~
| div
|
s894272779 | p03774 | C++ | #include<cmath>
#include<iostream>
using namespace std;
const int MAXN = 51;
int a[MAXN], b[MAXN], c[MAXN], d[MAXN];
inline int dist(int x1, int y1, int x2, int y2) {
return abs(x1-x2) + abs(y1-y2);
}
int main() {
int N, M;
cin >> N >> M;
for (int i = 1; i <= N; i++) {
cin >> a[i] >> b[i];
}
for (int j = 1; j <= M; j++) {
cin >> c[j] >> d[j];
}
for (int i = 1; i <= N; i++) {
int min_dist = dist(a[i], b[i], c[1], d[1]);
int id = 1;
for (int j = 2; j <= M; j++) {
int cur_dist = dist(a[i], b[i], c[j], d[j]);
if (cur_dist < min_dist) {
min_dist = cur_dist;
id=j;
}
}
cout<<j<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:23: error: 'j' was not declared in this scope
28 | cout<<j<<endl;
| ^
|
s770085065 | p03774 | C++ | #include "bits/stdc++.h"
using namespace std;
#define print(s) cout << (s) << endl;
#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, m; cin>>n>>m;
vector<long long> a(n),b(n),c(m),d(m),dist(m);
vector<int> ans(n),tem(j);
REP(i,n) cin>>a[i]>>b[i];
REP(j,m) cin>>c[j]>>d[j];
REP(i,n){
int temp = inf;
REP(j,m){
dist[j] = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if(dist[j]<temp){
temp = dist[j];
ans[i] = j;
} else if (dist[j]==temp){
ans[i] = min(tem[j], j);
}
}
}
REP(i,n) cout<<ans[i]+1<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:28: error: 'j' was not declared in this scope
17 | vector<int> ans(n),tem(j);
| ^
|
s340477497 | p03774 | C++ | #include<iostream>
using namespace std;
int n, m;
int main(){
cin >> n >> m;
const int nm = 50;
int a[nm], b[nm], c[nm], d[nm];
for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
for(int j = 0; j < m; j++) cin >> c[i] >> d[i];
for(int i = 0; i < n; i++){
int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
int checkpoint = 1;
for(int j = 1; j < m; j++){
const int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if(mintwo < minone) {
minone = mintwo;
checkpoint = j + 1;
}
}
cout << checkpoint << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:39: error: 'i' was not declared in this scope
9 | for(int j = 0; j < m; j++) cin >> c[i] >> d[i];
| ^
|
s524022088 | p03774 | C++ | #include<iostream>
using namespace std;
int n, m;
int main(){
cin >> n >> m;
const int nm = 50;
int a[nm], b[nm], c[nm], d[nm];
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 minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
int checkpoint = 1;
for(int j = i; j < n; j++){
int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if(mintwo < minone) {
minone = mintwo;
checkpoint = j +1
}
}
cout << checkpoint << endl;
}
} | a.cc: In function 'int main()':
a.cc:18:26: error: expected ';' before '}' token
18 | checkpoint = j +1
| ^
| ;
19 | }
| ~
|
s082386422 | p03774 | C++ | #include<iostream>
using namespace std;
int n, m;
int main(){
cin >> n >> m;
const int nm = 50;
int a[nm], b[nm], c[nm], d[nm];
for(int i = 0; i < n; i++) cin >> a >> b;
for(int i = 0; i < m; i++) cin >> c >> d;
for(int i = 0; i < n; i++){
int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
int checkpoint = 1;
for(int j = i; j < n; j++){
int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if(mintwo < minone) {
minone = mintwo;
checkpoint = j +1
}
}
cout << checkpoint << endl;
}
} | a.cc: In function 'int main()':
a.cc:8:34: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [50]')
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ~~~ ^~ ~
| | |
| | int [50]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
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>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:37: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
/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:8:37: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(short int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(short unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long long int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long long unsigned int)((int*)(& a))' 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:8:37: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
/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 'int [50]' 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 'int [50]' 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 'int [50]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/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 'int [50]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__ist |
s169500294 | p03774 | C++ | #include<iostream>
using namespace std;
int n, m;
int main(){
cin >> n >> m;
const int nm = 50;
int a[nm], b[nm], c[nm], d[nm];
for(int i = 0; i < n; i++) cin >> a >> b;
for(int i = 0; i < m; i++) cin >> c >> d;
for(int i = 0; i < n; i++){
int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
for(int j = i; j < n; j++){
int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if(mintwo < minone) minone = mintwo;
}
cout << minone << endl;
}
} | a.cc: In function 'int main()':
a.cc:8:34: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [50]')
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ~~~ ^~ ~
| | |
| | int [50]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
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>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:37: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
/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:8:37: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(short int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(short unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long long int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long long unsigned int)((int*)(& a))' 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:8:37: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
/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 'int [50]' 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 'int [50]' 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 'int [50]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/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 'int [50]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__ist |
s780666948 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int n, m;
int main(){
cin >> n >> m;
const int nm = 50;
int a[nm], b[nm], c[nm], d[nm];
for(int i = 0; i < n; i++) cin >> a >> b;
for(int i = 0; i < m; i++) cin >> c >> d;
for(int i = 0; i < n; i++){
int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
for(int j = i; j < n; j++){
int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if(mintwo < minone) minone = mintwo;
}
cout << minone << endl;
}
} | a.cc: In function 'int main()':
a.cc:8:34: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [50]')
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ~~~ ^~ ~
| | |
| | int [50]
| std::istream {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,
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>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:37: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
/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:8:37: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(short int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(short unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long unsigned int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long long int)((int*)(& a))' 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:8:37: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
| |
| int*
a.cc:8:37: error: cannot bind rvalue '(long long unsigned int)((int*)(& a))' 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:8:37: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
8 | for(int i = 0; i < n; i++) cin >> a >> b;
| ^
/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 'int [50]' 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 'int [50]' 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 'int [50]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/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 'int [50]' to |
s531432722 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
int n, m;
int main(){
cin >> n >> m;
const int nm = 50;
int a[], b, c, d;
for(int i = 0; i < n; i++) cin >> a >> b;
for(int i = 0; i < m; i++) cin >> c >> d;
for(int i = 0; i < n; i++){
int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
for(int j = i; j < n; j++){
int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if(mintwo < minone) minone = mintwo;
}
cout << minone << endl;
}
} | a.cc: In function 'int main()':
a.cc:7:7: error: storage size of 'a' isn't known
7 | int a[], b, c, d;
| ^
a.cc:12:30: error: invalid types 'int[int]' for array subscript
12 | int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
| ^
a.cc:12:42: error: invalid types 'int[int]' for array subscript
12 | int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
| ^
a.cc:12:49: error: invalid types 'int[int]' for array subscript
12 | int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
| ^
a.cc:14:32: error: invalid types 'int[int]' for array subscript
14 | int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
| ^
a.cc:14:44: error: invalid types 'int[int]' for array subscript
14 | int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
| ^
a.cc:14:51: error: invalid types 'int[int]' for array subscript
14 | int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
| ^
|
s163792348 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int a[n],b[n],c[m],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 mi=1000000000,e;
for(int j=0;j<m;j++){
if(mi>abs(a[i]-c[j])+abs(b[i]-d[i]){
mi=abs(a[i]-c[j])+abs(b[i]-d[i]);
e=j+1;
}
}
cout<<e<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:16:42: error: expected ')' before '{' token
16 | if(mi>abs(a[i]-c[j])+abs(b[i]-d[i]){
| ~ ^
| )
a.cc:20:10: error: expected primary-expression before '}' token
20 | }
| ^
|
s516952572 | p03774 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
const int INF = 1000000; // 十分大きな値
int n,m,a[60],b[60],c[60],d[60];
int func(int id){
int best = INT_MAX;
int ans = -1;
REP(j,m){
int dist = abs(a[id] -c[j]) + abs(b[id] -d[j]);
if(dist < best){
best = dist;
ans = j;
}
}
return ans + 1;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n >> m;
REP(i,n)cin >> a[i] >> b[i];
REP(j,m)cin >> c[j] >> d[j];
REP(i,n)cout << func(i) << endl;
return 0;
}
| a.cc: In function 'int func(int)':
a.cc:10:20: error: 'INT_MAX' was not declared in this scope
10 | int best = INT_MAX;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <vector>
+++ |+#include <climits>
4 | #include <string>
|
s714285689 | p03774 | C | int n,m,i,j,min,tmp,jj;
scanf("%d%d",&n,&m);
int a[n],b[n],c[m],d[m];
for(i=0;i<n;i++)
scanf("%d%d",&a[i],&b[i]);
for(i=0;i<m;i++)
scanf("%d%d",&c[i],&d[i]);
for(i=0;i<n;i++){
tmp = 10000000;
for(j=0;j<m;j++){
if(c[j]>a[i])
min = c[j] - a[i];
else
min = a[i] -c[j];
if(d[j]>b[i])
min +=d[j] - b[i];
else
min +=b[i] - d[j];
if(tmp>min){
tmp = min;
jj = j+1;
}
}
printf("%d\n",jj);
}
return 0;
}
| main.c:3:15: error: expected declaration specifiers or '...' before string constant
3 | scanf("%d%d",&n,&m);
| ^~~~~~
main.c:3:22: error: expected declaration specifiers or '...' before '&' token
3 | scanf("%d%d",&n,&m);
| ^
main.c:3:25: error: expected declaration specifiers or '...' before '&' token
3 | scanf("%d%d",&n,&m);
| ^
main.c:5:13: error: variably modified 'a' at file scope
5 | int a[n],b[n],c[m],d[m];
| ^
main.c:5:18: error: variably modified 'b' at file scope
5 | int a[n],b[n],c[m],d[m];
| ^
main.c:5:23: error: variably modified 'c' at file scope
5 | int a[n],b[n],c[m],d[m];
| ^
main.c:5:28: error: variably modified 'd' at file scope
5 | int a[n],b[n],c[m],d[m];
| ^
main.c:7:9: error: expected identifier or '(' before 'for'
7 | for(i=0;i<n;i++)
| ^~~
main.c:7:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
7 | for(i=0;i<n;i++)
| ^
main.c:7:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
7 | for(i=0;i<n;i++)
| ^~
main.c:9:9: error: expected identifier or '(' before 'for'
9 | for(i=0;i<m;i++)
| ^~~
main.c:9:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
9 | for(i=0;i<m;i++)
| ^
main.c:9:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
9 | for(i=0;i<m;i++)
| ^~
main.c:12:9: error: expected identifier or '(' before 'for'
12 | for(i=0;i<n;i++){
| ^~~
main.c:12:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
12 | for(i=0;i<n;i++){
| ^
main.c:12:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
12 | for(i=0;i<n;i++){
| ^~
main.c:31:9: error: expected identifier or '(' before 'return'
31 | return 0;
| ^~~~~~
main.c:32:1: error: expected identifier or '(' before '}' token
32 | }
| ^
|
s584662716 | p03774 | C++ | #include <iostream>
#include <vector>
int main() {
int N, M;
std::cin >> N >> M;
std::vector<int> a(N), b(N);
for (int i = 0; i < N; ++i) {
std::cin >> a[i] >> b[i];
}
std::vector<int> c(M), d(M);
for (int i = 0; i < M; ++i) {
std::cin >> c[i] >> d[i];
}
for (int i = 0; i < N; ++i) {
int min = 0x1ffffff;
int check = 0;
for (int j = 0; j < M; ++j) {
int d = abs(a[i] - c[j]) + abs(b[i] - d[j]);
if ( d < min ) {
min = d;
check = j + 1;
}
}
std::cout << check << std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:46: error: invalid types 'int[int]' for array subscript
20 | int d = abs(a[i] - c[j]) + abs(b[i] - d[j]);
| ^
|
s975104515 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<pii> AB(N), CD(M);
for(int i = 0; i < N; i++) {
int a, b;
cin >> a >> b;
AB[i] = {a, b};
}
for(int j = 0; j < M; j++) {
int c, d;
cin >> c >> d;
CD[j] = {c, d};
}
for(int i = 0; i < N; i++) {
int ans = -1, dist = 1 << 30;
for(int j = 0; j < M; j++) {
int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
if (dist > d) {
dist = d;
ans = j;
}
}
cout << ans + 1 << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:10: error: 'pii' was not declared in this scope
8 | vector<pii> AB(N), CD(M);
| ^~~
a.cc:8:13: error: template argument 1 is invalid
8 | vector<pii> AB(N), CD(M);
| ^
a.cc:8:13: error: template argument 2 is invalid
a.cc:12:7: error: invalid types 'int[int]' for array subscript
12 | AB[i] = {a, b};
| ^
a.cc:17:7: error: invalid types 'int[int]' for array subscript
17 | CD[j] = {c, d};
| ^
a.cc:22:21: error: invalid types 'int[int]' for array subscript
22 | int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
| ^
a.cc:22:35: error: invalid types 'int[int]' for array subscript
22 | int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
| ^
a.cc:22:54: error: invalid types 'int[int]' for array subscript
22 | int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
| ^
a.cc:22:69: error: invalid types 'int[int]' for array subscript
22 | int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
| ^
|
s428009863 | p03774 | C++ | #include <iostream>
using namespace std;
int main()
{
long long i, j, k, N, M, a[50], b[50], c[50], d[50], dis, ans[50];
cin >> N; cin >> M;
for (i = 0; i < N; i++) {
cin >> a[i];
cin >> b[i];
}
for (i = 0; i < M; i++) {
cin >> c[i];
cin >> d[i];
}
for (i = 0; i < N; i++) {
long long min = LLONG_MAX;
for (j = 0; j < M; j++) {
dis = llabs(a[i] - c[j]) + llabs(b[i] - d[j]);
if (min > dis) {
min = dis;
ans[i] = j+1;
}
}
}
for (i = 0; i < N; i++) {
cout << ans[i] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:33: error: 'LLONG_MAX' was not declared in this scope
20 | long long min = LLONG_MAX;
| ^~~~~~~~~
a.cc:2:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 |
|
s663230497 | p03774 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int Digits(int num){
int cnt = 0;
while(num > 0){
num / 10;
cnt++;
}
return cnt;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
int A,B;
int max_num;
for(A = 1;A < sqrt(N);A++){
for(B = 1;B<sqrt(N);B++){
if(A * B == N){
max_num = max(Digits(A),Digits(B));
}
}
}
cout << min_num << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:43:13: error: 'min_num' was not declared in this scope; did you mean 'max_num'?
43 | cout << min_num << endl;
| ^~~~~~~
| max_num
|
s448706445 | p03774 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
using namespace std;
using ll = long long;
int main(int argc, const char * argv[]) {
int n, m;
cin >> n >> m;
ll sx[n], sy[n], cx[m], cy[m];
for (int i = 0; i < n; i++) {
cin >> sx[i] >> sy[i];
}
for (int i = 0; i < m; i++) {
cin >> cx[i] >> cy[i];
}
ll d, min, min_num;
for (int i = 0; i < n; i++) {
min = LLONG_MAX;
for (int j = 0; j < m; j++) {
d = abs(sx[i] - cx[j]) + abs(sy[i] - cy[j]);
if (min > d) {
min = d;
min_num = j;
}
}
cout << min_num + 1 << endl;
}
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:28:15: error: 'LLONG_MAX' was not declared in this scope
28 | min = LLONG_MAX;
| ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
6 | #include <cmath>
+++ |+#include <climits>
7 |
|
s509564142 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,M,i,ans=0,d,a[51],b[51],c[51],d[51];
cin>>N>>M;
for(i=0;i<N;i++){
cin>>a[i]>>b[i];
}
for(i=0;i<M;i++){
cin>>c[i]>>d[i];
}
for(int j=0;j<N;j++){
d=100000001;
ans=0;
for(i=0;i<N;i++){
if(d<abs(a[i]-c[i])+abs(b[i]-d[i])){
ans=i+1;
d=abs(a[i]-c[i])+abs(b[i]-d[i]);
}
}
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:5:39: error: conflicting declaration 'int d [51]'
5 | int N,M,i,ans=0,d,a[51],b[51],c[51],d[51];
| ^
a.cc:5:19: note: previous declaration as 'int d'
5 | int N,M,i,ans=0,d,a[51],b[51],c[51],d[51];
| ^
a.cc:11:17: error: invalid types 'int[int]' for array subscript
11 | cin>>c[i]>>d[i];
| ^
a.cc:17:34: error: invalid types 'int[int]' for array subscript
17 | if(d<abs(a[i]-c[i])+abs(b[i]-d[i])){
| ^
a.cc:19:33: error: invalid types 'int[int]' for array subscript
19 | d=abs(a[i]-c[i])+abs(b[i]-d[i]);
| ^
|
s256996328 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,M,i,ans=0,c,a[51],b[51],c[51],d[51];
cin>>N>>M;
for(i=0;i<N;i++){
cin>>a[i]>>b[i];
}
for(i=0;i<M;i++){
cin>>c[i]>>d[i];
}
for(int j=0;j<N;j++){
c=100000001;
ans=0;
for(i=0;i<N;i++){
if(c<abs(a[i]-c[i])+abs(b[i]-d[i])){
ans=i+1;
c=abs(a[i]-c[i])+abs(b[i]-d[i]);
}
}
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:5:33: error: conflicting declaration 'int c [51]'
5 | int N,M,i,ans=0,c,a[51],b[51],c[51],d[51];
| ^
a.cc:5:19: note: previous declaration as 'int c'
5 | int N,M,i,ans=0,c,a[51],b[51],c[51],d[51];
| ^
a.cc:11:11: error: invalid types 'int[int]' for array subscript
11 | cin>>c[i]>>d[i];
| ^
a.cc:17:19: error: invalid types 'int[int]' for array subscript
17 | if(c<abs(a[i]-c[i])+abs(b[i]-d[i])){
| ^
a.cc:19:18: error: invalid types 'int[int]' for array subscript
19 | c=abs(a[i]-c[i])+abs(b[i]-d[i]);
| ^
|
s077581243 | p03774 | C++ | #include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define mod 1000000007
using namespace std;
int main() {
int n, m;
int a[50], b[50], c[50], d[50];
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];
for (int i = 0; i < n; i++) {
int min = INT_MAX;
int mem;
for (int j = 0; j < m; j++) {
if (min > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
min = abs(a[i] - c[j]) + abs(b[i] - d[j]);
mem = j + 1;
}
}
cout << mem << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:27: error: 'INT_MAX' was not declared in this scope
18 | int min = INT_MAX;
| ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include "cmath"
+++ |+#include <climits>
6 | #define mod 1000000007
|
s614005335 | p03774 | C++ | #include<bits/stdc++.h>
using namespace std;
using int64 = long long;
const int64 INF = 1LL << 60;
int main() {
int64 N, M, A[50], B[50], C[50], D[50];
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];
for(int i = 0; i < N; i++) {
int near = INF;
for(int j = 0; j < M; j++) {
near = min(near, abs(A[i] - C[j]) + abs(B[i] - D[j]));
}
for(int j = 0; j < M; j++) {
if(near == abs(A[i] - C[j]) + abs(B[i] - D[j])) {
cout << j + 1 << endl;
break;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:14:16: warning: overflow in conversion from 'long long int' to 'int' changes value from '1152921504606846976' to '0' [-Woverflow]
14 | int near = INF;
| ^~~
a.cc:16:17: error: no matching function for call to 'min(int&, long long int)'
16 | near = min(near, abs(A[i] - C[j]) + abs(B[i] - D[j]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:16:17: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
16 | near = min(near, abs(A[i] - C[j]) + abs(B[i] - D[j]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:16:17: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
16 | near = min(near, abs(A[i] - C[j]) + abs(B[i] - D[j]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s641538153 | p03774 | C++ | #include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define kd int
#define fors(i,a,b) for(int i=(a);i<=(b);++i)
inline kd read(){
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
while(c>='0'&&c<='9') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
return x*=f;
}
inline void write(kd x){
if(x<0) {putchar('-');x=-x;}
if(x>9) write(x/10);
putchar(x%10+'0');
}
inline min(int x,int y){
return x>y ? y:x;
}
const int maxn=1<<25;
int main(){
register int n,m,a[100001],b[100001],x[100001],y[100001];
n=read(),m=read();
fors(i,1,n)
a[i]=read(),b[i]=read();
fors(i,1,m)
x[i]=read(),y[i]=read();
fors(i,1,n){
int ans=maxn;
fors(j,1,m){
int tmp=abs(b[m]-y[m])+abs(a[m]-x[m]);
ans=min(ans,tmp);
}
cout<<ans<<endl;
}
return 0;
} | a.cc:23:8: error: ISO C++ forbids declaration of 'min' with no type [-fpermissive]
23 | inline min(int x,int y){
| ^~~
a.cc: In function 'int main()':
a.cc:28:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | register int n,m,a[100001],b[100001],x[100001],y[100001];
| ^
a.cc:28:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | register int n,m,a[100001],b[100001],x[100001],y[100001];
| ^
a.cc:28:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | register int n,m,a[100001],b[100001],x[100001],y[100001];
| ^
a.cc:28:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | register int n,m,a[100001],b[100001],x[100001],y[100001];
| ^
a.cc:28:46: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | register int n,m,a[100001],b[100001],x[100001],y[100001];
| ^
a.cc:28:56: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | register int n,m,a[100001],b[100001],x[100001],y[100001];
| ^
|
s011604750 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,x; cin>>n>>m;
int a[n][2],b[n],c[n][2];
for(int i=0;i<n;i++){
for(int j=0;j<2;j++){
cin>>a[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<2;j++){
cin>>c[i][j];
}
}
for(int k=0;k<n;k++){
b[k]=0
for(int l=0;l<n;l++){
x=abs(a[k][0]-c[l][0])+abs(a[k][1]-c[l][1]);
if(b[k]>x||l==0) b[k]=x
}
}
for(int y=0;y<n;y++){
cout<<b[y]<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:23: error: expected ';' before 'for'
18 | b[k]=0
| ^
| ;
19 | for(int l=0;l<n;l++){
| ~~~
a.cc:19:29: error: 'l' was not declared in this scope
19 | for(int l=0;l<n;l++){
| ^
a.cc:27:2: error: expected '}' at end of input
27 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s484487975 | p03774 | C++ | #include<iostream>
using namespace std;
int M,N;
int a[60],b[60],c[60],d[60];
int main(){
cin>>N>>M;
int i;
for(i=0;i<N;i++)cin>>a[i]>>b[i];
for(i=0;i<M;i++)cin>>c[i]>>d[i];
for(i=0;i<N;i++)cout<<func[i]<<endl;
return 0;
}
int func(int id){
int best=(1<<29);
int ans=-1;
for (int i=0;i<M;i++){
int dist=abs(a[id]-c[id])+abs(b[id]-d[id]);
if(dist<best){
best=dist;
ans=i;
}
}
return ans+1;
}
| a.cc: In function 'int main()':
a.cc:11:27: error: 'func' was not declared in this scope
11 | for(i=0;i<N;i++)cout<<func[i]<<endl;
| ^~~~
|
s258773069 | p03774 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
int main (void) {
int N,M;
ll ans=0;
ll dis=1000000000;
cin >> N >>M;
ll a[50], b[50],c[50] d[50];
for (ll i=0; i<N; i++) {
cin >> a[i] >> b[i];
}
for (ll i=0; i<M; i++) {
cin >> c[i] >> d[i];
}
for (ll i=0; i<N; i++) {
dis=1000000000
for (ll j=0; j<M; j++) {
if (abs(a[i]-c[j])+abs(b[i]-d[j]))<dis){
ans=j;
dis=abs(a[i]-c[j])+abs(b[i]-d[j]));
}
cout << ans;
}
} | a.cc: In function 'int main()':
a.cc:16:25: error: expected initializer before 'd'
16 | ll a[50], b[50],c[50] d[50];
| ^
a.cc:22:12: error: 'c' was not declared in this scope
22 | cin >> c[i] >> d[i];
| ^
a.cc:22:20: error: 'd' was not declared in this scope
22 | cin >> c[i] >> d[i];
| ^
a.cc:25:19: error: expected ';' before 'for'
25 | dis=1000000000
| ^
| ;
26 | for (ll j=0; j<M; j++) {
| ~~~
a.cc:26:20: error: 'j' was not declared in this scope
26 | for (ll j=0; j<M; j++) {
| ^
a.cc:33:2: error: expected '}' at end of input
33 | }
| ^
a.cc:11:17: note: to match this '{'
11 | int main (void) {
| ^
|
s172538679 | p03774 | C++ | import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int N = sc.nextInt(), M = sc.nextInt();
int[] a = new int[N];
int[] b = new int[N];
int[] c = new int[M];
int[] d = new int[M];
for(int i = 0; i < N; i++) {
a[i] = sc.nextInt();
b[i] = sc.nextInt();
}
for(int j = 0; j < M; j++) {
c[j] = sc.nextInt();
d[j] = sc.nextInt();
}
for(int i = 0; i < N; i++) {
int min = 0, man = 0,minn=0;
for(int j = 0; j < M; j++) {
man = Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]);
if(man < min || j == 0) {
min = man;
minn = j;
//System.out.println(man);
}
man = 0;
}
System.out.println(minn + 1);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
2 | public class Main {
| ^~~~~~
|
s279781315 | p03774 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] s = new int[2*N];
int[] c = new int[2*M];
for(int i = 0;i < 2*N;i++)s[i] = sc.nextInt();
for(int i = 0;i < 2*M;i++)c[i] = sc.nextInt();
for(int i = 0;i < 2*N;i += 2){
long min = 99999999999;
int ans = 0;
for(int j = 0;j < 2*M;j +=2){
if(Math.abs(s[i]-c[j])+Math.abs(s[i+1]-c[j+1]) < min){
min = Math.abs(s[i]-c[j])+Math.abs(s[i+1]-c[j+1]);
ans = j+1;
}
}
System.out.println(ans);
}
}}
| Main.java:12: error: integer number too large
long min = 99999999999;
^
1 error
|
s000571718 | p03774 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] s = new int[2*N];
int[] c = new int[2*M];
for(int i = 0;i < 2*N;i++)s[i] = sc.nextInt();
for(int i = 0;i < 2*M;i++)c[i] = sc.nextInt();
for(int i = 0;i < 2*N;i += 2){
double min = 99999999999;
int ans = 0;
for(int j = 0;j < 2*M;j +=2){
if(Math.abs(s[i]-c[j])+Math.abs(s[i+1]-c[j+1]) < min){
min = Math.abs(s[i]-c[j])+Math.abs(s[i+1]-c[j+1]);
ans = j+1;
}
}
System.out.println(ans);
}
}}
| Main.java:12: error: integer number too large
double min = 99999999999;
^
1 error
|
s124569057 | p03774 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] s = new int[2*N];
int[] c = new int[2*M];
for(int i = 0;i < 2*N;i++)s[i] = sc.nextInt();
for(int i = 0;i < 2*M;i++)c[i] = sc.nextInt();
for(int i = 0;i < 2*N;i += 2){
int min = 99999999999;
int ans = 0;
for(int j = 0;j < 2*M;j +=2){
if(Math.abs(s[i]-c[j])+Math.abs(s[i+1]-c[j+1]) < min){
min = Math.abs(s[i]-c[j])+Math.abs(s[i+1]-c[j+1]);
ans = j+1;
}
}
System.out.println(ans);
}
}}
| Main.java:12: error: integer number too large
int min = 99999999999;
^
1 error
|
s928900799 | p03774 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] s = new int[2*N];
int[] c = new int[2*M];
for(int i = 0;i < 2*N;i++)s[i] = sc.nextInt();
for(int i = 0;i < 2*M;i++)c[i] = sc.nextInt();
for(int i = 0;i < 2*N;i += 2){
int min = Math.pow(2.50);
int ans = 0;
for(int j = 0;j < 2*M;j +=2){
if(Math.abs(s[i]-c[j])+Math.abs(s[i+1]-c[j+1]) < min){
min = Math.abs(s[i]-c[j])+Math.abs(s[i+1]-c[j+1]);
ans = j+1;
}
}
System.out.println(ans);
}
}} | Main.java:12: error: method pow in class Math cannot be applied to given types;
int min = Math.pow(2.50);
^
required: double,double
found: double
reason: actual and formal argument lists differ in length
1 error
|
s698371843 | p03774 | C++ | #include <iostream>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
int a[N], b[N], c[M], 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 min_dist=abs(a[i]-c[0])+abs(b[i]-d[0]);
for(int j=1; j<M; j++){
int cur_dist=abs(a[i]-c[j])+abs(b[i]-d[j]);
if(min_dist>cur_dist){
min_dist = cur_dist;
ans=j;
}
}
cout << ans+1 << endl;
}
}
| a.cc: In function 'int main()':
a.cc:20:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
20 | ans=j;
| ^~~
| abs
a.cc:23:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | cout << ans+1 << endl;
| ^~~
| abs
|
s648732754 | p03774 | C++ | #include <algorithm>
#include <iostream>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
int a[N], b[N], c[M], 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 x=0, a;
for(int j=0; j<M; j++){
int l=abs(a[i]-c[j])+abs(b[i]-d[j]);
if(x>l){
x=l;
a=j;
}
}
cout << a << endl;
}
}
| a.cc: In function 'int main()':
a.cc:18:36: error: invalid types 'int[int]' for array subscript
18 | int l=abs(a[i]-c[j])+abs(b[i]-d[j]);
| ^
|
s236716487 | p03774 | C++ | #include <iostream>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
int a[N], b[N], c[M], 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 x=0, a;
for(int j=0; j<M; j++){
int l;
l=abs(a[i]-c[j])+abs(b[i]-d[j]);
if(x>l){
x=l;
a=j;
}
}
cout << a << endl;
}
}
| a.cc: In function 'int main()':
a.cc:18:32: error: invalid types 'int[int]' for array subscript
18 | l=abs(a[i]-c[j])+abs(b[i]-d[j]);
| ^
|
s226614095 | p03774 | C++ | #include <iostream>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
int a[N], b[N], c[M], 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 x=0, a;
for(int j=0; j<M; j++){
int l = abs(a[i]-c[j])+abs(b[i]-d[j]);
if(x>l){
x=l;
a=j;
}
}
cout << a << endl;
}
}
| a.cc: In function 'int main()':
a.cc:17:38: error: invalid types 'int[int]' for array subscript
17 | int l = abs(a[i]-c[j])+abs(b[i]-d[j]);
| ^
|
s587537730 | p03774 | C++ | #include <iostream>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
int a[N], b[N], c[M], 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 x=0, a;
for(int j=0; j<M; j++){
int l = abs(a[i]-c[j])+abs(b[i]-d[j]);
if(x>l){
x=l;
a=j;
}
}
cout << j << endl;
}
}
| a.cc: In function 'int main()':
a.cc:17:38: error: invalid types 'int[int]' for array subscript
17 | int l = abs(a[i]-c[j])+abs(b[i]-d[j]);
| ^
a.cc:23:25: error: 'j' was not declared in this scope
23 | cout << j << endl;
| ^
|
s520405930 | p03774 | C++ | #include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;
#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define INF 1000000000
#define MAX 50
typedef long long ll;
typedef pair<ll, ll> P;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z
int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
void solve(void){
int n, m;
cin >> n >> m;
P students[MAX];
P checkpoints[MAX];
rep(n, i) scanf("%lld%lld\n", &students[i].first, &students[i].second);
rep(m, i) scanf("%lld%lld\n", &checkpoints[i].first, &checkpoints[i].second);
rep(n, i){
ll man_len = INF;
int index = 0;
rep(m, j) {
if (man_len > abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second)) {
man_len = abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second);
index = j;
}
}
cout << index+1;
}
cout << '\n';
}
int main(void){
solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:39:63: error: request for member 'first' in 'students', which is of non-class type 'P [50]' {aka 'std::pair<long long int, long long int> [50]'}
39 | if (man_len > abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second)) {
| ^~~~~
a.cc:39:109: error: request for member 'second' in 'students', which is of non-class type 'P [50]' {aka 'std::pair<long long int, long long int> [50]'}
39 | if (man_len > abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second)) {
| ^~~~~~
a.cc:40:63: error: request for member 'first' in 'students', which is of non-class type 'P [50]' {aka 'std::pair<long long int, long long int> [50]'}
40 | man_len = abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second);
| ^~~~~
a.cc:40:109: error: request for member 'second' in 'students', which is of non-class type 'P [50]' {aka 'std::pair<long long int, long long int> [50]'}
40 | man_len = abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second);
| ^~~~~~
|
s457314893 | p03774 | C++ | #include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;
#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define INF 1000000000
typedef long long ll;
typedef pair<ll, ll> P;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z
int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
void solve(void){
int n, m;
cin >> n >> m;
P students[n];
P checkpoints[m];
rep(n, i) scanf("%lld%lld\n", &students[i].first, &students[i].second);
rep(m, i) scanf("%lld%lld\n", &checkpoints[i].first, &checkpoints[i].second);
rep(n, i){
ll man_len = INF;
int index = 0;
rep(m, j) {
if (man_len > abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second)) {
man_len = abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second);
index = j;
}
}
cout << index+1;
}
cout << '\n';
}
int main(void){
solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:39:63: error: request for member 'first' in 'students', which is of non-class type 'P [n]' {aka 'std::pair<long long int, long long int> [n]'}
39 | if (man_len > abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second)) {
| ^~~~~
a.cc:39:109: error: request for member 'second' in 'students', which is of non-class type 'P [n]' {aka 'std::pair<long long int, long long int> [n]'}
39 | if (man_len > abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second)) {
| ^~~~~~
a.cc:40:63: error: request for member 'first' in 'students', which is of non-class type 'P [n]' {aka 'std::pair<long long int, long long int> [n]'}
40 | man_len = abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second);
| ^~~~~
a.cc:40:109: error: request for member 'second' in 'students', which is of non-class type 'P [n]' {aka 'std::pair<long long int, long long int> [n]'}
40 | man_len = abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second);
| ^~~~~~
|
s248993113 | p03774 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
long long i,j,n,m;
cin >> n >> m;
for(i=0;i<n;i++)cin >> a[i] >> b[i];
for(i=0;i<n;i++)cin >> c[i] >> d[i];
for(i=0;i<n;i++){
long long ret = 1e16;
long long ans = -1;
for(j=0;j<m;i++){
if(ret>(abs(a[i]-c[i])+abs(b[i]-d[i]))){
ret = abs(a[i]-c[i])+abs(b[i]-d[i]);
ans = j+1;
}
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:26: error: 'a' was not declared in this scope
8 | for(i=0;i<n;i++)cin >> a[i] >> b[i];
| ^
a.cc:8:34: error: 'b' was not declared in this scope
8 | for(i=0;i<n;i++)cin >> a[i] >> b[i];
| ^
a.cc:9:26: error: 'c' was not declared in this scope
9 | for(i=0;i<n;i++)cin >> c[i] >> d[i];
| ^
a.cc:9:34: error: 'd' was not declared in this scope
9 | for(i=0;i<n;i++)cin >> c[i] >> d[i];
| ^
a.cc:14:19: error: 'a' was not declared in this scope
14 | if(ret>(abs(a[i]-c[i])+abs(b[i]-d[i]))){
| ^
a.cc:14:24: error: 'c' was not declared in this scope
14 | if(ret>(abs(a[i]-c[i])+abs(b[i]-d[i]))){
| ^
a.cc:14:34: error: 'b' was not declared in this scope
14 | if(ret>(abs(a[i]-c[i])+abs(b[i]-d[i]))){
| ^
a.cc:14:39: error: 'd' was not declared in this scope
14 | if(ret>(abs(a[i]-c[i])+abs(b[i]-d[i]))){
| ^
|
s704504733 | p03774 | C++ | #include <bits/stdc++.h>
//#include <math.h>
using namespace std;
#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;
struct edge {
int to, cost;
edge(int t,int c):to(t),cost(c) {}
};
//-----------------------------------------------------------------------------
int n,m;
int a[50],b[50],c[50],d[50];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin>>n>>m;
REP(i,n) cin>>a[i]>>b[i];
REP(i,m) cin>>c[i]>>d[i];
REP(i,n) {
int pos,d=INF;
REP(j,m) {
if(abs(a[i]-c[j])+abs(b[i]-d[j])<d) pos=j+1,d=abs(a[i]-c[j])+abs(b[i]-d[j]);
}
cout<<pos<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:43:53: error: invalid types 'int[int]' for array subscript
43 | if(abs(a[i]-c[j])+abs(b[i]-d[j])<d) pos=j+1,d=abs(a[i]-c[j])+abs(b[i]-d[j]);
| ^
a.cc:43:96: error: invalid types 'int[int]' for array subscript
43 | if(abs(a[i]-c[j])+abs(b[i]-d[j])<d) pos=j+1,d=abs(a[i]-c[j])+abs(b[i]-d[j]);
| ^
|
s636091074 | p03774 | C++ | #include <iostream>
#include <cmath>
using namespace std;
#define Rep(i,n) for(int i=0;i<(n);i++)
int a[50];
int b[50];
int c[50];
int d[50];
int main(void)
{
int N,M;
cin>>N>>M;
Rep(i,N)cin>>a[i]>>b[i];
Rep(i,M)cin>>c[i]>>d[i];
Rep(n,N){
int ans=1;
int mn=abs(a[n]-c[0])+abs(b[n]-d[0]);
Rep(m,M){
if(abs(a[n]-c[m])+abs(b[n]-d[m])<mn){
mn=abs(a[n]-c[m])+abs(b[n]-d[m]);
ans=m+1
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:11: error: expected ';' before '}' token
21 | ans=m+1
| ^
| ;
22 | }
| ~
|
s735853088 | p03774 | C++ | #include <iostream>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int a[50];
int b[50];
int c[50];
int d[50];
int main(void)
{
int N,M;
cin>>N>>M;
Rep(i,N)cin>>a[i]>>b[i];
Rep(i,M)cin>>c[i]>>d[i];
Rep(n,N){
int ans=1;
int mn=abs(a[n]-c[0])+abs(b[n]-d[0]);
Rep(m,M){
if(abs(a[n]-c[m])+abs(b[n]-d[m])<mn){
mn=abs(a[n]-c[m])+abs(b[n]-d[m]);
ans=m+1
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:5: error: 'i' was not declared in this scope
13 | Rep(i,N)cin>>a[i]>>b[i];
| ^
a.cc:13:1: error: 'Rep' was not declared in this scope; did you mean 'rep'?
13 | Rep(i,N)cin>>a[i]>>b[i];
| ^~~
| rep
a.cc:15:5: error: 'n' was not declared in this scope
15 | Rep(n,N){
| ^
|
s148567792 | p03774 | C++ | #include <iostream>
#include <math>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int a[50];
int b[50];
int c[50];
int d[50];
int main(void)
{
int N,M;
cin>>N>>M;
Rep(i,N)cin>>a[i]>>b[i];
Rep(i,M)cin>>c[i]>>d[i];
Rep(n,N){
int ans=1;
int mn=abs(a[n]-c[0])+abs(b[n]-d[0]);
Rep(m,M){
if(abs(a[n]-c[m])+abs(b[n]-d[m])<mn){
mn=abs(a[n]-c[m])+abs(b[n]-d[m]);
ans=m+1
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc:2:10: fatal error: math: No such file or directory
2 | #include <math>
| ^~~~~~
compilation terminated.
|
s431758934 | p03774 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
ll N,M; cin >> N >> M;
ll x[N],y[N],a[M],b[M];
for(int i=0; i<N; i++) {
cin >> x[i] >> y[i] ;
}
for(int i=0; i<M; i++) {
cin >> a[i] >> b[i];
}
for(int i=0; i<M; i++) {
ll ans = INT_MAX;
ll ind = 0;
for(int j=0; j<N; j++) {
if( ans < abs(x[i] - a[j]) + abs(y[i] - b[j]) ) ) {
ans = abs(x[i] - a[j]) + abs(y[i] - b[j]) );
ind = j;
}
}
cout << ind+1 << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:21:62: error: expected primary-expression before ')' token
21 | if( ans < abs(x[i] - a[j]) + abs(y[i] - b[j]) ) ) {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.