submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s511910524 | p00278 | C++ | #include <bits/stdc++.h>
using namespace std;
#define for_(i,a,b) for(int i=a;i<b;++i)
#define allof(a) a.begin(),a.end()
typedef pair< int, int > pii;
int N, Q;
vector< int > s, id;
set< int > read;
int count(int r) {
if ((int)read.size() == 0) return N;
set< int >::iterator it = read.end();
int res = 0, cur = N;
do {
--it;
int its = *it;
if (its < cur) res += cur - its - 1;
cur = lower_bound(allof(s), s[its] - r) - s.begin();
} while (it != read.begin());
res += cur;
return res;
}
int check(int x) {
int lb = 0, ub = (int)1e9 + 10;
while (ub - lb > 1) {
int med = (lb + ub) / 2;
if (x < count(med)) lb = med;
else ub = med;
}
if (count(lb) <= x) return lb;
return ub;
}
void query() {
for_(i,0,Q) {
string t; int a; cin >> t >> a;
if (t == "ADD") read.insert(id[a-1]);
if (t == "REMOVE") read.erase(id[a-1]);
if (t == "CHECK") {
int res = check(a);
if (res > (int)1e9) cout << "NA" << endl;
else cout << res << endl;
}
}
}
int main() {
cin >> N >> Q;
vector< pii > vp;
for_(i,0,N) {
int s; cin >> s;
vp.push_back(pii(s, i));
}
sort(allof(vp));
s.assign(N, 0);
id.assign(N, 0);
for_(i,0,N) {
s[i] = vp[i].first;
id[vp[i].second] = i;
}
query();
return 0;
} | a.cc:11:12: error: 'std::set<int> read' redeclared as different kind of entity
11 | set< int > read;
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
from /usr/include/signal.h:328,
from /usr/include/c++/14/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
from a.cc:1:
/usr/include/unistd.h:371:16: note: previous declaration 'ssize_t read(int, void*, size_t)'
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
a.cc: In function 'int count(int)':
a.cc:14:23: error: request for member 'size' in 'read', which is of non-class type 'ssize_t(int, void*, size_t)' {aka 'long int(int, void*, long unsigned int)'}
14 | if ((int)read.size() == 0) return N;
| ^~~~
a.cc:16:40: error: request for member 'end' in 'read', which is of non-class type 'ssize_t(int, void*, size_t)' {aka 'long int(int, void*, long unsigned int)'}
16 | set< int >::iterator it = read.end();
| ^~~
a.cc:24:29: error: request for member 'begin' in 'read', which is of non-class type 'ssize_t(int, void*, size_t)' {aka 'long int(int, void*, long unsigned int)'}
24 | } while (it != read.begin());
| ^~~~~
a.cc: In function 'void query()':
a.cc:47:38: error: request for member 'insert' in 'read', which is of non-class type 'ssize_t(int, void*, size_t)' {aka 'long int(int, void*, long unsigned int)'}
47 | if (t == "ADD") read.insert(id[a-1]);
| ^~~~~~
a.cc:49:41: error: request for member 'erase' in 'read', which is of non-class type 'ssize_t(int, void*, size_t)' {aka 'long int(int, void*, long unsigned int)'}
49 | if (t == "REMOVE") read.erase(id[a-1]);
| ^~~~~
|
s955930691 | p00278 | C++ | #include <bits/stdc++.h>
using namespace std;
#define for_(i,a,b) for(int i=a;i<b;++i)
#define allof(a) a.begin(),a.end()
typedef pair< int, int > pii;
int N, Q;
vector< int > s, id;
set< int > reader;
int count(int r) {
if ((int)read.size() == 0) return N;
set< int >::iterator it = reader.end();
int res = 0, cur = N;
do {
--it;
int its = *it;
if (its < cur) res += cur - its - 1;
cur = lower_bound(allof(s), s[its] - r) - s.begin();
} while (it != read.begin());
res += cur;
return res;
}
int check(int x) {
int lb = 0, ub = (int)1e9 + 10;
while (ub - lb > 1) {
int med = (lb + ub) / 2;
if (x < count(med)) lb = med;
else ub = med;
}
if (count(lb) <= x) return lb;
return ub;
}
void query() {
for_(i,0,Q) {
string t; int a; cin >> t >> a;
if (t == "ADD") reader.insert(id[a-1]);
if (t == "REMOVE") reader.erase(id[a-1]);
if (t == "CHECK") {
int res = check(a);
if (res > (int)1e9) cout << "NA" << endl;
else cout << res << endl;
}
}
}
int main() {
cin >> N >> Q;
vector< pii > vp;
for_(i,0,N) {
int s; cin >> s;
vp.push_back(pii(s, i));
}
sort(allof(vp));
s.assign(N, 0);
id.assign(N, 0);
for_(i,0,N) {
s[i] = vp[i].first;
id[vp[i].second] = i;
}
query();
return 0;
} | a.cc: In function 'int count(int)':
a.cc:14:23: error: request for member 'size' in 'read', which is of non-class type 'ssize_t(int, void*, size_t)' {aka 'long int(int, void*, long unsigned int)'}
14 | if ((int)read.size() == 0) return N;
| ^~~~
a.cc:24:29: error: request for member 'begin' in 'read', which is of non-class type 'ssize_t(int, void*, size_t)' {aka 'long int(int, void*, long unsigned int)'}
24 | } while (it != read.begin());
| ^~~~~
|
s181336663 | p00278 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, Q, s[1000000];
vector< int > Student;
multiset< int > Leader;
bool Check(int value, int x)
{
vector< int >::iterator last = Student.begin();
int Lost = 0;
for(multiset< int >::iterator it = Leader.begin(); it != Leader.end() && last != Student.end(); ++it) {
Lost += lower_bound(last, Student.end(), *it - value) - last;
last = upper_bound(last, Student.end(), *it);
}
Lost += max(0, Student.end() - last);
return(Lost <= x);
}
int BinarySearch(int Lower, int Upper, int x)
{
int Mid = (Lower + Upper) >> 1;
if(Lower >= Upper) return(Lower);
if(Check(Mid, x)) return(BinarySearch(Lower, Mid, x));
return(BinarySearch(Mid + 1, Upper, x));
}
main()
{
cin >> N >> Q;
Student.resize(N);
for(int i = 0; i < N; ++i) {
cin >> Student[i];
s[i] = Student[i];
}
sort(Student.begin(), Student.end());
while(Q--) {
string Query;
int a;
cin >> Query >> a;
if(Query[0] == 'A') { // "ADD"
Leader.insert(s[--a]);
} else if(Query[0] == 'R') { // "REMOVE"
Leader.erase(Leader.find(s[--a]));
} else { // "CHECK"
int ret = BinarySearch(0, 1 << 30, a);
if(ret == 1 << 30) cout << "NA" << endl;
else cout << ret << endl;
}
}
} | a.cc: In function 'bool Check(int, int)':
a.cc:16:14: error: no matching function for call to 'max(int, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
16 | Lost += max(0, Student.end() - last);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:16:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
16 | Lost += max(0, Student.end() - last);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:16:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
16 | Lost += max(0, Student.end() - last);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: At global scope:
a.cc:26:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
26 | main()
| ^~~~
|
s876619542 | p00278 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int s[1000000];
int student[1000000];
int N;
vector<int> L;
bool check(int x,int r) {
int start=0;
int sum=0;
for(int i=0;i<L.size();i++) {
int pos=max(lower_bound(s,s+N,L[i]-r)-s,start);
int k=upper_bound(s,s+N,L[i])-s;
sum+=(k-pos);
start=k;
}
return (N-sum)<=x;
}
int main() {
int Q;
scanf("%d %d",&N,&Q);
for(int i=0;i<N;i++) {
scanf("%d",&s[i]);
student[i]=s[i];
}
sort(s,s+N);
for(int i=0;i<Q;i++) {
char query[10];
int a;
scanf("%s %d",query,&a);
if(query[0]=='A') {
a--;
L.insert(lower_bound(L.begin(),L.end(),student[a]),student[a]);
}else if(query[0]=='R') {
a--;
L.erase(lower_bound(L.begin(),L.end(),student[a]));
}else {
int l=-1,r=1<<29;
while(r-l>1) {
int m=(l+r)/2;
if(check(a,m)) {
r=m;
}else {
l=m;
}
}
if(check(a,r)) {
printf("%d\n",r);
}else {
printf("NA\n");
}
}
}
} | a.cc: In function 'bool check(int, int)':
a.cc:13:28: error: no matching function for call to 'max(long int, int&)'
13 | int pos=max(lower_bound(s,s+N,L[i]-r)-s,start);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:13:28: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
13 | int pos=max(lower_bound(s,s+N,L[i]-r)-s,start);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:13:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
13 | int pos=max(lower_bound(s,s+N,L[i]-r)-s,start);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s038514546 | p00278 | C++ | # define _CRT_SECUREj_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12
template<class T> void debug(T a) { for (auto iiiiiiiiii : a)cout << iiiiiiiiii << endl; }
#define int long long
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
const int MAX_N = 1000000;
const int MAX_S = 1000000000;
int index[MAX_N];
vi a;
list<int> b;
int ok[MAX_N + 1];
signed main()
{
int n, q;
cin >> n >> q;
FOR(i, n)
{
cin >> index[i];
a.push_back(index[i]);
}
sort(ALL(a));
FOR(c, q)
{
string Q; int x;
cin >> Q >> x;
if (Q == "ADD")
{
x--;
b.insert(b.begin(),index[x]);
auto it = lower_bound(ALL(a), index[x]);
a.erase(it);
}
else if (Q == "REMOVE")
{
x--;
for (auto it = b.begin(); it != b.end(); it++)
{
if (*it == index[x])
{
b.erase(it);
break;
}
}
a.push_back(index[x]);
sort(ALL(a));
}
else
{
memset(ok, 0, sizeof ok);
for (auto it = b.begin(); it != b.end(); it++)
{
auto r = lower_bound(ALL(a), *it);
auto l = lower_bound(ALL(a), *it - MAX_S);
if (r == l)continue;
int L = l - a.begin(),R=r-a.begin();
ok[L]++; ok[R]--;
}
int count = 0;
for (int i = 0; i < a.size(); i++)
{
ok[i + 1] += ok[i];
if (ok[i] == 0)
{
count++;
}
}
if (count > x) { cout << "NA" << endl; }
else
{
int left = 0, right = MAX_S;
int middle;
while (right!=left)
{
middle = (left + right) / 2;
memset(ok, 0, sizeof ok);
for (auto it = b.begin(); it != b.end(); it++)
{
auto r = lower_bound(ALL(a), *it);
auto l = lower_bound(ALL(a), *it - middle);
if (r == l)continue;
int L = l - a.begin(), R = r - a.begin();
ok[L]++; ok[R]--;
}
count = 0;
for (int i = 0; i < a.size(); i++)
{
//cout << "ok[" << i << "]:" << ok[i] << endl;;
ok[i + 1] += ok[i];
if (ok[i] == 0)
{
count++;
}
}
//cout << middle << " "; DEBUG(count);
if (count > x)
{
left = middle+1;
}
else if (count <= x)
{
right = middle;
}
}
cout << left << endl;
}
}
}
} | a.cc:46:16: error: 'long long int index [1000000]' redeclared as different kind of entity
46 | int index[MAX_N];
| ^
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from a.cc:11:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'int main()':
a.cc:56:29: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
56 | cin >> index[i];
| ^
a.cc:57:34: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
57 | a.push_back(index[i]);
| ^
a.cc:68:49: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
68 | b.insert(b.begin(),index[x]);
| ^
a.cc:69:60: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
69 | auto it = lower_bound(ALL(a), index[x]);
| ^
a.cc:77:49: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
77 | if (*it == index[x])
| ^
a.cc:83:42: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
83 | a.push_back(index[x]);
| ^
|
s896325444 | p00278 | C++ | /* -----------------------------------------------------------------------------
????????????????????? 2013 ?????? ??????8
0283: Study Session
???????????????(??£??????)
g++ pckpre1308.cpp -O2
----------------------------------------------------------------------------- */
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define STUDENT_MAX (1000002)
#define SCORE_MAX 1000000002
#define INFTY 1000000002
//#define DEBUG
int score[STUDENT_MAX]; // ???????????????
map<int, int> MP; // (??????, ?????°)
vector<int> ATI; // ??????
vector<int> ATV; // ?´?????????°
vector<int> leaders; // ??????????????????????????????
vector<std::pair<int, int> > seg; // ??????
int N; // ????????°
int Q; // ?????¨????????°
/*
/* -----------------------------------------------------------------------------
???????????°??¨
----------------------------------------------------------------------------- */
void print_leaders() {
int lcnt = leaders.size();
printf("LEADERS: ");
for(int i = 0; i < lcnt; i++)
printf("%d ", leaders[i]);
printf("\n");
return ;
}
void print_acc_score() {
printf("ACC SCORE: ");
for(int i = 0; i < ATI.size(); i++) {
printf("%d %d\n", ATI[i], ATV[i]);
}
return ;
}
*/
/* -----------------------------------------------------------------------------
????????¢??°
----------------------------------------------------------------------------- */
int add(int a) {
// ?????????????????????a????????\???????????¢???
leaders.push_back(score[a]);
// ????????????????????????
std::sort(leaders.begin(), leaders.end());
return 0;
}
/* -----------------------------------------------------------------------------
????????¢??°
----------------------------------------------------------------------------- */
int del(int a) {
// ?????????????????????s????±??????????
int s = score[a];
// ??¢???
vector<int>::iterator it = std::find(leaders.begin(), leaders.end(), s);
// ?¶????
if(it != leaders.end()) leaders.erase(it);
return 0;
}
/* -----------------------------------------------------------------------------
??????????????????r??\????????\??????????????°??????????????¢??°
----------------------------------------------------------------------------- */
int getCount(int r){
seg.clear();
if (leaders.size() > 0 ) seg.push_back(make_pair(leaders[0]-r, leaders[0]));
for ( int i = 1; i < leaders.size(); i++ ){
int b = leaders[i]-r;
int e = leaders[i];
if ( b <= seg[seg.size()-1].second){
seg[seg.size()-1].second = max(seg[seg.size()-1].second, e);
} else {
seg.push_back(make_pair(b, e));
}
}
int cnt = 0;
for (int i = 0; i < seg.size(); i++) {
int a = lower_bound(ATI.begin(), ATI.end(), max(0, seg[i].first)) - ATI.begin() - 1;
int b = lower_bound(ATI.begin(), ATI.end(), max(0, seg[i].second)) - ATI.begin();
cnt += ATV[b] - ATV[a];
}
return cnt;
}
/* -----------------------------------------------------------------------------
??????????????????r??\???????????°
----------------------------------------------------------------------------- */
void bsearch(int X){
int l = -1;
int r = SCORE_MAX;
int m;
int cnt = getCount(r);
if (cnt < X ) { cout << "NA" << endl; return;}
while(1){
m = (l+r)/2;
cnt = getCount(m);
if ( cnt >= X ){
r = m;
} else if ( cnt < X ){
l = m;
}
if (r - l == 1) break;
}
cout << r << endl;
}
/* -----------------------------------------------------------------------------
?????????????????°??????
----------------------------------------------------------------------------- */
int main() {
char query[10]; // ??????
int param;
// ????????°N??¨?????¨????????°????????????
scanf("%d %d", &N, &Q);
// ????????¢????????????
for(int i = 1; i <= N; i++) {
int s;
// i??????????????????????????¢???????????????
scanf("%d", &s);
// ????????¢????????°
score[i] = s;
map<int, int>::iterator it = MP.find(s);
if(it == MP.end())
MP.insert(make_pair(s,1));
else
(*it).second ++;
}
// ?´???????
ATI.push_back(-1);
ATV.push_back(0);
int pre = 0;
for(map<int, int>::iterator it = MP.begin(); it != MP.end(); it++ ){
ATI.push_back((*it).first);
ATV.push_back((*it).second + ATV[pre++]);
}
#ifdef DEBUG
print_acc_score();
#endif
// ?????¨???????????????
for(int i = 1; i <= Q; i++) {
// ?????¨?????????????????????
scanf("%s %d", query, ¶m);
//
switch(query[0]) {
case 'A':
add(param);
#ifdef DEBUG
print_leaders();
#endif
break;
case 'R':
del(param);
#ifdef DEBUG
print_leaders();
#endif
break;
default:
bsearch(N - param);
break;
}
}
return 0;
} | a.cc:54:2: error: expected unqualified-id before '/' token
54 | */
| ^
a.cc: In function 'int main()':
a.cc:186:33: error: 'add' was not declared in this scope
186 | add(param);
| ^~~
|
s425538994 | p00278 | C++ | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
struct Info{
bool operator<(const struct Info &arg) const{
return score < arg.score;
};
int id,score;
};
struct Data{
Data(int arg_diff,int arg_index,int arg_leader_number){
diff = arg_diff;
index = arg_index;
leader_number = arg_leader_number;
}
bool operator<(const struct Data &arg) const{
return diff > arg.diff;
};
int diff,index,leader_number;
};
int main(){
int N,Q;
scanf("%d %d",&N,&Q);
Info* info = (Info*)malloc(sizeof(Info)*(N+1));
info[0].score = -1;
for(int i = 1; i <= N; i++){
scanf("%d",&info[i].score);
info[i].id = i;
}
sort(info,info+(N+1));
int* loc = new int[N+1]; //??°?????????????????????????¨??????????????????????
for(int i = 1; i <= N; i++){
loc[info[i].id] = i;
}
char order[10];
int value,current_number,need_number;
int left_index[100],self_score[100],max_loc;
bool* check = new bool[N+1];
vector<int> V;
priority_queue<Data> PQ;
Data data;
for(int loop = 0; loop < Q; loop++){
scanf("%s %d",order,&value);
switch(order[0]){
case 'A':
V.push_back(value);
break;
case 'R':
for(int i = 0; i < V.size(); i++){
if(V[i] == value){
V.erase(V.begin()+i);
break;
}
}
break;
case 'C':
need_number = N - value;
for(int i = 1; i <= N; i++){
check[i] = false;
}
current_number = 0;
max_loc = 0;
for(int i = 0; i < V.size(); i++){
check[loc[V[i]]] = true;
max_loc = max(max_loc,loc[V[i]]);
self_score[i] = info[loc[V[i]]].score;
current_number++;
left_index[i] = loc[V[i]];
//?????????????????????????????¨???????????????????????????
for(int k = loc[V[i]]-1; k >= 1 && info[k].score == self_score[i] && check[k] == false;k--){
current_number++;
left_index[i] = k;
check[k] = true;
}
for(int k = loc[V[i]]+1; k <= N && info[k].score == self_score[i] && check[k] == false;k++){
current_number++;
max_loc = max(max_loc,k);
check[k]=true;
}
}
if(current_number >= need_number){
printf("0\n");
continue;
}else if(max_loc < need_number){
printf("NA\n");
continue;
}
while(!PQ.empty())PQ.pop();
for(int i = 0; i < V.size(); i++){
if(left_index[i] >= 2){
PQ.push(Data(self_score[i]-info[left_index[i]-1].score,left_index[i]-1,i));
}
}
int ans = 0;
while(current_number < need_number){
ans = max(ans,PQ.top().diff);
data = PQ.top();
PQ.pop();
for(int k = data.index; k >= 1 && check[k] == false && self_score[data.leader_number]-info[k].score == data.diff;k--){
current_number++;
left_index[data.leader_number] = k;
check[k] = true;
}
if(left_index[data.leader_number] >= 2 && check[left_index[data.leader_number]-1] == false){
PQ.push(Data(self_score[data.leader_number]-info[left_index[data.leader_number]-1].score,left_index[data.leader_number]-1,data.leader_number));
}
}
printf("%d\n",ans);
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:68:14: error: no matching function for call to 'Data::Data()'
68 | Data data;
| ^~~~
a.cc:27:9: note: candidate: 'Data::Data(int, int, int)'
27 | Data(int arg_diff,int arg_index,int arg_leader_number){
| ^~~~
a.cc:27:9: note: candidate expects 3 arguments, 0 provided
a.cc:26:8: note: candidate: 'constexpr Data::Data(const Data&)'
26 | struct Data{
| ^~~~
a.cc:26:8: note: candidate expects 1 argument, 0 provided
a.cc:26:8: note: candidate: 'constexpr Data::Data(Data&&)'
a.cc:26:8: note: candidate expects 1 argument, 0 provided
|
s044405564 | p00278 | C++ | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
struct Info{
bool operator<(const struct Info &arg) const{
return score < arg.score;
};
int id,score;
};
struct Data{
Data(int arg_diff,int arg_index,int arg_leader_number){
diff = arg_diff;
index = arg_index;
leader_number = arg_leader_number;
}
bool operator<(const struct Data &arg) const{
return diff > arg.diff;
};
int diff,index,leader_number;
};
int main(){
int N,Q;
scanf("%d %d",&N,&Q);
Info* info = (Info*)malloc(sizeof(Info)*(N+1));
info[0].score = -1;
for(int i = 1; i <= N; i++){
scanf("%d",&info[i].score);
info[i].id = i;
}
sort(info,info+(N+1));
int* loc = new int[N+1];
for(int i = 1; i <= N; i++){
loc[info[i].id] = i;
}
char order[10];
int value,current_number,need_number;
int left_index[100],self_score[100],max_loc;
bool* check = new bool[N+1];
vector<int> V;
priority_queue<Data> PQ;
Data data;
for(int loop = 0; loop < Q; loop++){
scanf("%s %d",order,&value);
switch(order[0]){
case 'A':
V.push_back(value);
break;
case 'R':
for(int i = 0; i < V.size(); i++){
if(V[i] == value){
V.erase(V.begin()+i);
break;
}
}
break;
case 'C':
need_number = N - value;
for(int i = 1; i <= N; i++){
check[i] = false;
}
current_number = 0;
max_loc = 0;
for(int i = 0; i < V.size(); i++){
check[loc[V[i]]] = true;
max_loc = max(max_loc,loc[V[i]]);
self_score[i] = info[loc[V[i]]].score;
current_number++;
left_index[i] = loc[V[i]];
for(int k = loc[V[i]]-1; k >= 1 && info[k].score == self_score[i] && check[k] == false;k--){
current_number++;
left_index[i] = k;
check[k] = true;
}
for(int k = loc[V[i]]+1; k <= N && info[k].score == self_score[i] && check[k] == false;k++){
current_number++;
max_loc = max(max_loc,k);
check[k]=true;
}
}
if(current_number >= need_number){
printf("0\n");
continue;
}else if(max_loc < need_number){
printf("NA\n");
continue;
}
while(!PQ.empty())PQ.pop();
for(int i = 0; i < V.size(); i++){
if(left_index[i] >= 2 && check[left_index[i]-1] == false){
PQ.push(Data(self_score[i]-info[left_index[i]-1].score,left_index[i]-1,i));
}
}
int ans = 0;
while(current_number < need_number){
ans = max(ans,PQ.top().diff);
data = PQ.top();
PQ.pop();
for(int k = data.index; k >= 1 && check[k] == false && self_score[data.leader_number]-info[k].score == data.diff;k--){
current_number++;
left_index[data.leader_number] = k;
check[k] = true;
}
if(left_index[data.leader_number] >= 2 && check[left_index[data.leader_number]-1] == false){
PQ.push(Data(self_score[data.leader_number]-info[left_index[data.leader_number]-1].score,left_index[data.leader_number]-1,data.leader_number));
}
}
printf("%d\n",ans);
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:68:14: error: no matching function for call to 'Data::Data()'
68 | Data data;
| ^~~~
a.cc:27:9: note: candidate: 'Data::Data(int, int, int)'
27 | Data(int arg_diff,int arg_index,int arg_leader_number){
| ^~~~
a.cc:27:9: note: candidate expects 3 arguments, 0 provided
a.cc:26:8: note: candidate: 'constexpr Data::Data(const Data&)'
26 | struct Data{
| ^~~~
a.cc:26:8: note: candidate expects 1 argument, 0 provided
a.cc:26:8: note: candidate: 'constexpr Data::Data(Data&&)'
a.cc:26:8: note: candidate expects 1 argument, 0 provided
|
s498115524 | p00278 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define REP(i, b, e) for ( int i = b; i < e; i++)
#define rep(i, n) REP(i, 0, n)
static const int MAX_N = 1000000;
static const int MAX_P = 2000000000;
int N, M, Q, S[MAX_N];
map<int, int> PM; // point map
vector<int> ATI, ATV;
vector<int> MS;
set<int> R;
vector<pair<int, int> > seg;
void init(){
MS.clear();
for ( set<int>::iterator it = R.begin(); it != R.end(); it++ ){
MS.push_back(S[*it]);
}
sort(MS.begin(), MS.end());
}
int getCount(int r){
seg.clear();
if ( MS.size() > 0 ) seg.push_back(make_pair(MS[0]-r, MS[0]));
for ( int i = 1; i < MS.size(); i++ ){
int b = MS[i]-r;
int e = MS[i];
if ( b <= seg[seg.size()-1].second){
seg[seg.size()-1].second = max(seg[seg.size()-1].second, e);
} else {
seg.push_back(make_pair(b, e));
}
}
int cnt = 0;
for ( int i = 0; i < seg.size(); i++ ){
int a = distance(ATI.begin(), lower_bound(ATI.begin(), ATI.end(), max(0, seg[i].first) )) - 1;
int b = distance(ATI.begin(), lower_bound(ATI.begin(), ATI.end(), max(0, seg[i].second) ));
cnt += ATV[b] - ATV[a];
}
return cnt;
}
void bsearch(int X){
init();
int l = 0;
int r = MAX_P+2000000;
int m;
int diff = r - l;
int cnt = getCount(r);
if ( cnt < X ){
cout << "NA" << endl;
return;
}
bool ok = false;
for (int i = 0; i < 200; i++ ){
m = (l+r)/2;
cnt = getCount(m);
if ( cnt >= X ){
r = m;
ok = true;
} else if ( cnt < X ){
l = m;
}
if ( diff == l - r ) break;
diff = l - r;
}
cout << r << endl;
}
main(){
scanf("%d %d", &N, &Q);
MS.clear();
PM.clear();
ATI.clear();
ATV.clear();
rep(i, N) {
scanf("%d", &S[i]);
PM[S[i]]++;
}
bool isR[MAX_N];
rep(i, N) isR[i] = false;
M = 0;
ATI.push_back(-1);
ATV.push_back(0);
int pre = 0;
for ( map<int, int>::iterator it = PM.begin(); it != PM.end(); it++ ){
ATI.push_back((*it).first);
ATV.push_back((*it).second + ATV[pre++]);
}
string com;
int x;
rep(i, Q){
cin >> com >> x;
if ( com[0] == 'C' ){
if ( ! ( 0 <= x && x <= N ) ) cout << "wa" << endl;
bsearch(N - x);
} else if ( com[0] == 'R' ){
if ( ! ( 1 <= x && x <= N ) ) cout << "wa" << endl;
x--; // 0 base
assert( isR[x] ); isR[x] = false;
R.erase(R.find(x));
M--;
} else if ( com[0] == 'A' ){
if ( ! ( 1 <= x && x <= N ) ) cout << "wa" << endl;
x--; // 0 base
assert( !isR[x] ); isR[x] = true;
R.insert(x);
M++;
} else assert(false);
if ( M > 100 ) cout << "wa" << endl;
}
} | a.cc:84:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
84 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:120:7: error: 'assert' was not declared in this scope
120 | assert( isR[x] ); isR[x] = false;
| ^~~~~~
a.cc:7:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
6 | #include<set>
+++ |+#include <cassert>
7 | using namespace std;
a.cc:126:7: error: 'assert' was not declared in this scope
126 | assert( !isR[x] ); isR[x] = true;
| ^~~~~~
a.cc:126:7: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
a.cc:129:12: error: 'assert' was not declared in this scope
129 | } else assert(false);
| ^~~~~~
a.cc:129:12: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
|
s963468797 | p00278 | C++ | #include <iostream>
#include <vector>
#include <set>
using namespace std;
typedef long long LL;
template <class T>
struct BIT/*{{{*/
{
vector<T> tree;
const int size;
BIT(int s) : tree(s), size(s) {}
// i 番目までの要素の累積和
T read(int i) const
{
T sum = 0;
while (i > 0) {
sum += tree[i];
i -= i & -i;
}
return sum;
}
// i 番目の要素
T read_single(int i) const
{
T sum = tree[i];
if (i > 0) {
const int z = i - (i & -i);
--i;
while (i != z) {
sum -= tree[i];
i -= (i & -i);
}
}
return sum;
}
void add(int i, T v)
{
while (i <= size) {
tree[i] += v;
i += (i & -i);
}
}
// read(i) == vとなる最小のi。存在しなければ-1。
int search(T v) {
int left = 0, right = size;
while(left+1 < right) {
const int center = (left+right) / 2;
if(read(center) < v) {
left = center;
} else {
right = center;
}
}
if(right == size || read(right) != v) return -1;
return right;
}
};/*}}}*/
bool solve() {
int N, Q;
if(!(cin >> N >> Q)) return false;
if(!N && !Q) return false;
BIT<LL> bit(N+10);
vector<LL> scores(N);
LL LIM = 0;
for(int i = 0; i < N; ++i) {
cin >> scores[i];
LIM += scores[i];
}
vector<LL> score_list = scores;
score_list.push_back(-1); // sentinel
sort(begin(score_list), end(score_list));
score_list.erase(unique(begin(score_list), end(score_list)), end(score_list));
for(int i = 0; i < N; ++i) {
scores[i] = lower_bound(begin(score_list), end(score_list), scores[i]) - begin(score_list);
bit.add(scores[i], 1);
}
multiset<int> leaders;
for(int _ = 0; _ < Q; ++_) {
string query;
int x;
cin >> query >> x;
if(query == "ADD") {
leaders.insert(x-1);
bit.add(scores[x-1], -1);
} else if(query == "REMOVE") {
leaders.erase(leaders.find(x-1));
bit.add(scores[x-1], 1);
} else if(query == "CHECK") {
if(leaders.size() == 0) {
if(x >= N) cout << 0 << endl;
else cout << "NA" << endl;
} else {
bool found = false;
LL left = -1, right = LIM;
while(left+1 < right) {
const LL r = (left + right) / 2;
LL outlier = 0;
LL prev_score = -1;
LL prev_leader = -1;
for(auto leader : leaders) {
const LL score = score_list[scores[leader]];
if(score - r - 1 > prev_score) {
int lim = lower_bound(begin(score_list), end(score_list), score - r - 1) - begin(score_list);
if(score_list[lim] > score - r - 1) --lim;
outlier += bit.read(lim) - (prev_leader == -1 ? 0 : bit.read(scores[prev_leader]));
}
prev_score = score;
prev_leader = leader;
}
outlier += bit.read(N+5) - bit.read(scores[prev_leader]);
if(outlier <= x) {
right = r;
found = true;
} else {
left = r;
}
}
if(found) cout << right << endl;
else cout << "NA" << endl;
}
}
}
return true;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
while(solve()) ;
return 0;
} | a.cc: In function 'bool solve()':
a.cc:79:5: error: 'sort' was not declared in this scope; did you mean 'short'?
79 | sort(begin(score_list), end(score_list));
| ^~~~
| short
a.cc:80:22: error: 'unique' was not declared in this scope
80 | score_list.erase(unique(begin(score_list), end(score_list)), end(score_list));
| ^~~~~~
|
s849968416 | p00278 | C++ | #include <iostream>
#include <vector>
#include <set>
#include <iterator>
using namespace std;
typedef long long LL;
template <class T>
struct BIT/*{{{*/
{
vector<T> tree;
const int size;
BIT(int s) : tree(s), size(s) {}
// i 番目までの要素の累積和
T read(int i) const
{
T sum = 0;
while (i > 0) {
sum += tree[i];
i -= i & -i;
}
return sum;
}
// i 番目の要素
T read_single(int i) const
{
T sum = tree[i];
if (i > 0) {
const int z = i - (i & -i);
--i;
while (i != z) {
sum -= tree[i];
i -= (i & -i);
}
}
return sum;
}
void add(int i, T v)
{
while (i <= size) {
tree[i] += v;
i += (i & -i);
}
}
// read(i) == vとなる最小のi。存在しなければ-1。
int search(T v) {
int left = 0, right = size;
while(left+1 < right) {
const int center = (left+right) / 2;
if(read(center) < v) {
left = center;
} else {
right = center;
}
}
if(right == size || read(right) != v) return -1;
return right;
}
};/*}}}*/
bool solve() {
int N, Q;
if(!(cin >> N >> Q)) return false;
if(!N && !Q) return false;
BIT<LL> bit(N+10);
vector<LL> scores(N);
LL LIM = 0;
for(int i = 0; i < N; ++i) {
cin >> scores[i];
LIM += scores[i];
}
vector<LL> score_list = scores;
score_list.push_back(-1); // sentinel
sort(begin(score_list), end(score_list));
score_list.erase(unique(begin(score_list), end(score_list)), end(score_list));
for(int i = 0; i < N; ++i) {
scores[i] = lower_bound(begin(score_list), end(score_list), scores[i]) - begin(score_list);
bit.add(scores[i], 1);
}
multiset<int> leaders;
for(int _ = 0; _ < Q; ++_) {
string query;
int x;
cin >> query >> x;
if(query == "ADD") {
leaders.insert(x-1);
bit.add(scores[x-1], -1);
} else if(query == "REMOVE") {
leaders.erase(leaders.find(x-1));
bit.add(scores[x-1], 1);
} else if(query == "CHECK") {
if(leaders.size() == 0) {
if(x >= N) cout << 0 << endl;
else cout << "NA" << endl;
} else {
bool found = false;
LL left = -1, right = LIM;
while(left+1 < right) {
const LL r = (left + right) / 2;
LL outlier = 0;
LL prev_score = -1;
LL prev_leader = -1;
for(auto leader : leaders) {
const LL score = score_list[scores[leader]];
if(score - r - 1 > prev_score) {
int lim = lower_bound(begin(score_list), end(score_list), score - r - 1) - begin(score_list);
if(score_list[lim] > score - r - 1) --lim;
outlier += bit.read(lim) - (prev_leader == -1 ? 0 : bit.read(scores[prev_leader]));
}
prev_score = score;
prev_leader = leader;
}
outlier += bit.read(N+5) - bit.read(scores[prev_leader]);
if(outlier <= x) {
right = r;
found = true;
} else {
left = r;
}
}
if(found) cout << right << endl;
else cout << "NA" << endl;
}
}
}
return true;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
while(solve()) ;
return 0;
} | a.cc: In function 'bool solve()':
a.cc:80:5: error: 'sort' was not declared in this scope; did you mean 'short'?
80 | sort(begin(score_list), end(score_list));
| ^~~~
| short
a.cc:81:22: error: 'unique' was not declared in this scope
81 | score_list.erase(unique(begin(score_list), end(score_list)), end(score_list));
| ^~~~~~
|
s602803565 | p00278 | C++ | #include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <fstream>
#include <cassert>
using namespace std;
//common
typedef long long i64,ll;
#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,r) for(int i=(l);i<(int)(r);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))
//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x) cerr << #x << " = " << (x)
#define DUMPLN(x) DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE() cerr<< " (L" << __LINE__ << ")"
#define LINELN() LINE()<<endl
#define CHECK(exp,act) if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e) CHECK(e,true);if(!(e)) exit(1);
#endif
template<class T> inline string toString(const vector<T>& x) {
stringstream ss;
REP(i,x.size()){
if(i!=0)ss<<" ";
ss<< x[i];
}
return ss.str();
}
template<class T> inline string toString(const vector<vector<T> >& map) {
stringstream ss;
REP(i,map.size()){
if(i!=0)ss<<BR;
ss<< toString(map[i]);
}
return ss.str();
}
template<class K,class V> string toString(map<K,V>& x) {
string res;stringstream ss;
for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
return ss.str();
}
string BITtoString(int bit){
stringstream ss;
while(bit!=0){ss<<(bit%2);bit/=2;}
string res=ss.str();reverse(ALL(res));
return res;
}
template<typename T,typename V> inline T pmod(T v,V MOD){
return (v%MOD+MOD)%MOD;
}
class Main{
public:
void run(){
int N,Q;cin >> N>>Q;
vector<pair<ll,int>> ss(N);
REP(i,N){
cin >> ss[i].first;
ss[i].second=i;
}
sort(ALL(ss));
vector<int> sv(N);REP(i,N)sv[i]=ss[i].first;
vector<int> itossi(N);REP(i,N)itossi[ss[i].second]=i;
map<int,int> lmap;
REP(q,Q){
string Comm;cin >> Comm;
if(Comm=="ADD"){
int a;cin >> a;a--;
lmap[itossi[a]]=1;
}else if(Comm=="REMOVE"){
int a;cin >> a;a--;
lmap.erase(itossi[a]);
}else{
int x;cin >> x;
vector<int> ls;EACH(it,lmap)ls.push_back(it->first);
sort(ALL(ls));
//count
ll INF=1LL<<38;
ll l=-1,r=INF;
while(r-l>1){
ll m=(l+r)/2;int pd=-1;
int team=0;
REP(i,ls.size()){
int d=max(lower_bound(ALL(sv),sv[ls[i]]-m)-sv.begin(),pd);
team+=ls[i]-d+1;
pd=ls[i]+1;
}
int los=N-team;
if(los<=x)r=m;
else l=m;
}
if(r!=INF)cout << r <<endl;
else cout <<"NA" <<endl;
}
}
}
};
int main(){
//ios::sync_with_stdio(false);
Main().run();
return 0;
} | a.cc: In member function 'void Main::run()':
a.cc:121:58: error: no matching function for call to 'max(__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type, int&)'
121 | int d=max(lower_bound(ALL(sv),sv[ls[i]]-m)-sv.begin(),pd);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:121:58: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
121 | int d=max(lower_bound(ALL(sv),sv[ls[i]]-m)-sv.begin(),pd);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:12:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:121:58: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
121 | int d=max(lower_bound(ALL(sv),sv[ls[i]]-m)-sv.begin(),pd);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s540911952 | p00279 | C++ | #include <cmath>
#include <cstdio>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const double EPS=1e-8;
const double INF=1e77;
struct point{
double x,y;
point():x(0),y(0){}
point(double x,double y):x(x),y(y){}
point operator-(const point &a)const{ return point(x-a.x,y-a.y); }
bool operator==(const point &a)const{ return abs(x-a.x)<EPS && abs(y-a.y)<EPS; }
};
double cross(const point &a,const point &b){ return a.x*b.y-a.y*b.x; }
typedef vector<point> polygon;
enum{CCW=1,CW=-1,ON=0};
int ccw(const point &a,const point &b,const point &c){
double rdir=cross(b-a,c-a);
if(rdir> EPS) return CCW;
if(rdir<-EPS) return CW;
return ON;
}
double area(const polygon &F){
int n=F.size();
double a=0;
rep(i,n) a+=cross(F[i],F[(i+1)%n]);
return abs(a)/2;
}
int n;
point P[40];
int K;
double ans;
point Q[40],Q_ans[40];
bool vis[40];
void dfs(int i){
if(i==K){
double res=area(polygon(Q,Q+K));
if(res<ans){
ans=res;
memcpy(Q_ans,Q,sizeof Q);
}
return;
}
double res=INF;
rep(j,n) if(!vis[j]) {
Q[i]=P[j];
if(ccw(Q[i-2],Q[i-1],Q[ i ])==CCW
&& ccw(Q[i-1],Q[ i ],Q[ 0 ])==CCW
&& ccw(Q[ i ],Q[ 0 ],Q[ 1 ])==CCW){
vis[j]=true;
dfs(i+1);
vis[j]=false;
}
}
}
int main(){
scanf("%d",&n);
rep(i,n) scanf("%lf%lf",&P[i].x,&P[i].y);
int q; scanf("%d",&q);
rep(_,q){
scanf("%d",&K);
ans=INF;
rep(i,n) rep(j,n) if(i!=j) {
Q[0]=P[i];
Q[1]=P[j];
rep(k,n) vis[k]=false;
vis[i]=vis[j]=true;
dfs(2);
}
if(ans<INF/2){
int i0=0;
vector<int> seq(K);
rep(i,K){
seq[i]=find(P,P+n,Q_ans[i])-P;
if(make_pair(Q_ans[i].y,Q_ans[i].x)<make_pair(Q_ans[i0].y,Q_ans[i0].x)) i0=i;
}
rep(i,i0){
seq.push_back(seq[0]);
seq.erase(seq.begin());
}
rep(i,K) printf("%d%c",seq[i]+1,i<K-1?' ':'\n');
}
else puts("NA");
}
return 0;
} | a.cc: In function 'void dfs(int)':
a.cc:52:25: error: 'memcpy' was not declared in this scope
52 | memcpy(Q_ans,Q,sizeof Q);
| ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <vector>
+++ |+#include <cstring>
4 |
a.cc: In function 'int main()':
a.cc:91:40: error: 'find' was not declared in this scope
91 | seq[i]=find(P,P+n,Q_ans[i])-P;
| ^~~~
|
s913038377 | p00279 | C++ | #include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#define INF 1e8
using namespace std;
typedef long long ll;
struct P{
ll x,y,id;
double dir;
P(){}
P(ll xx,ll yy,ll pp){
x=xx;
y=yy;
id=pp;
dir=atan2((double)yy,(double)xx);
if(dir<0)dir=M_PI*2.0+dir;
}
P operator -(P p2){
return P(x-p2.x,y-p2.y,id);
}
bool operator<(const P& p1)const{
if(dir==p1.dir)return x<p1.x;
return dir<p1.dir;
}
};
P p[41];
bool used[41];
P pp[41];
ll n,q;
//dp[????????°][????§?][??????]
ll dp[41][41][41];
ll poll[41][41][41][41];
ll res[41];
ll respoll[41][41];
ll main(void){
scanf("%d",&n);
for(ll i=0;i<n;i++){
ll x,y;
scanf("%lld %lld",&x,&y);
p[i]=P(x,y,i+1);
res[i+1]=INF;
}
for(ll turn=0;turn<n-2;turn++){
ll nec=-1;
for(ll i=0;i<n;i++){
if(used[i])continue;
if(nec==-1)nec=i;
else if(p[i].y<p[nec].y || (p[i].y==p[nec].y && p[i].x<p[nec].x))nec=i;
}
P ch=p[nec];
ll cnt=0;
for(ll i=0;i<n;i++){
if(used[i])continue;
pp[cnt++]=p[i]-ch;
}
sort(pp,pp+n-turn);
for(ll i=3;i<=cnt;i++){
for(ll j=0;j<=cnt;j++){
for(ll k=0;k<=cnt;k++){
dp[i][j][k]=INF;
}
}
}
for(ll i=1;i<cnt;i++){
for(ll j=i+1;j<cnt;j++){
ll cross=pp[i].x*pp[j].y-pp[j].x*pp[i].y;
if(cross>0){
dp[3][i][j]=cross;
poll[3][i][j][0]=0;
poll[3][i][j][1]=i;
poll[3][i][j][2]=j;
if(dp[3][i][j]<res[3]){
res[3]=dp[3][i][j];
respoll[3][0]=pp[0].id;
respoll[3][1]=pp[i].id;
respoll[3][2]=pp[j].id;
}
}else dp[3][i][j]=INF;
}
}
for(ll i=3;i<cnt;i++){
for(ll j=1;j<cnt;j++){
for(ll k=j+1;k<cnt;k++){
for(ll l=k+1;l<cnt;l++){
ll cross=pp[k].x*pp[l].y-pp[k].y*pp[l].x;
ll cross2=(pp[poll[i][j][k][i-2]].x-pp[k].x)*(pp[l].y-pp[k].y)-(pp[poll[i][j][k][i-2]].y-pp[k].y)*(pp[l].x-pp[k].x);
if(cross>0 && cross2<0 && cross+dp[i][j][k]<dp[i+1][j][l]){
dp[i+1][j][l]=cross+dp[i][j][k];
for(ll m=0;m<i;m++)poll[i+1][j][l][m]=poll[i][j][k][m];
poll[i+1][j][l][i]=l;
if(dp[i+1][j][l]<res[i+1]){
res[i+1]=dp[i+1][j][l];
for(ll m=0;m<i+1;m++)respoll[i+1][m]=pp[poll[i+1][j][l][m]].id;
}
}
}
}
}
}
used[nec]=true;
}
scanf("%d",&q);
for(ll i=0;i<q;i++){
ll que;
scanf("%d",&que);
if(res[que]==INF)prllf("NA\n");
else{
for(ll i=0;i<que;i++){
prllf("%d%c",respoll[que][i],i==que-1?'\n':' ');
}
}
}
return 0;
} | a.cc:38:1: error: '::main' must return 'int'
38 | ll main(void){
| ^~
a.cc: In function 'int main()':
a.cc:109:34: error: 'prllf' was not declared in this scope
109 | if(res[que]==INF)prllf("NA\n");
| ^~~~~
a.cc:112:33: error: 'prllf' was not declared in this scope
112 | prllf("%d%c",respoll[que][i],i==que-1?'\n':' ');
| ^~~~~
|
s097468811 | p00279 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct point{
ll x,y;
point operator - (const point &p)const{
return (point){x-p.x,y-p.y};
}
bool operator < (const point &p)const{
return (y==p.y?x<p.x:y<p.y);
}
};
ll cross(point a,point b){
return a.x*b.y-b.x*a.y;
}
ll n;
point t[40];
ll dp[40][40][40][41];
ll pre[40][40][40][41];
int main(){
cin>>n;
for(int i=0;i<n;i++)cin>>t[i].x>>t[i].y;
fill(dp[0],dp[40], 1e9);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i==j)continue;
if(t[j].y<t[i].y)continue;
dp[i][i][j][2]=0;
}
}
for(int si=0;si<n;si++){
for(int k=2;k+1<=n;k++){
for(int i=0;i<n;i++){
if(t[i].y<t[si].y)continue;
for(int j=0;j<n;j++){
if(t[j].y<t[si].y)continue;
if(dp[si][i][j][k]==1e9)continue;
for(int to=0;to<n;to++){
if(t[to].y<t[si].y)continue;
if(cross(t[j]-t[i],t[to]-t[j])<=0)continue;
ll cost = dp[si][i][j][k];
ll addcost = cross(t[j]-t[si],t[to]-t[si]);
if(addcost<=0)continue;
cost+=addcost;
if(cost < dp[si][j][to][k+1] ){
dp[si][j][to][k+1]=cost;
pre[si][j][to][k+1]=i;
}
}
}
}
}
}
int q,a;
cin>>q;
while(q--){
cin>>a;
int I,J,K;
ll mini=1e9;
point g;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
if(dp[i][j][k][a]>mini)continue;
if(dp[i][j][k][a]==mini&&g<t[i])continue;
g=t[i];
mini=dp[i][j][k][a];
I=i,J=j,K=k;
}
}
}
if(mini==1e9){
cout<<"NA"<<endl;
continue;
}
vector<int> ans;
for(int i=0;i<a-1;i++){
ans.push_back(K);
I=I;
int tmp=pre[I][J][K][a-i];
K=J;
J=tmp;
}
ans.push_back(I);
reverse(ans.begin(),ans.end());
for(int i=0;i<(int)ans.size();i++){
if(i)cout<<' ';
cout<<ans[i]+1;
}
cout<<endl;
}
return 0;
} | 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: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int (*)[40][41]; _Tp = double; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int (*)[40][41]; _Tp = double]'
998 | { std::__fill_a1(__first, __last, __value); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int (*)[40][41]; _Tp = double]'
1029 | std::__fill_a(__first, __last, __value);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:27:7: required from here
27 | fill(dp[0],dp[40], 1e9);
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: incompatible types in assignment of 'const double' to 'long long int [40][41]'
952 | *__first = __tmp;
| ~~~~~~~~~^~~~~~~
|
s640154884 | p00279 | C++ | error | a.cc:1:1: error: 'error' does not name a type
1 | error
| ^~~~~
|
s793218608 | p00280 | C++ | #include<iostream>
using namespace std;
int j,y;
void dfs(int a,int b,string game){
if(a==j && b==y){
cout<< game<< endl;
return;
}
else if(a>j || b>y) return;
else if((a<3 && b==5) || (a==5 && b<3)) return;
dfs(a+1,b,game+'A');
dfs(a,b+1,game+'B');
}
main(){
cin>> j>> y;
dfs(0,0, | a.cc:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
17 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:19:11: error: expected primary-expression at end of input
19 | dfs(0,0,
| ^
a.cc:19:11: error: expected '}' at end of input
a.cc:17:7: note: to match this '{'
17 | main(){
| ^
|
s303102919 | p00280 | C++ | #include<bits/stdc++.h>
using namespace std;
string keiro[100000];
void tansaku(int J,int Y,string now);
int j,y;
main(){
cin>>j>>y;
tansaku(0,0,"");
}
void tansaku(int J,int Y,string now){
if(J==j&&Y==y){
cout<<now<<endl;
return;
}
if(J>j || Y>y)
return;
if(b<5||(b==5&&a==4)){
tansaku(J+1,Y,now+"A");
}
if(a<5||(a==5&&b==4)){
tansaku(J,Y+1,now+"B");
}
return;
} | a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main(){
| ^~~~
a.cc: In function 'void tansaku(int, int, std::string)':
a.cc:18:6: error: 'b' was not declared in this scope
18 | if(b<5||(b==5&&a==4)){
| ^
a.cc:18:18: error: 'a' was not declared in this scope
18 | if(b<5||(b==5&&a==4)){
| ^
a.cc:22:6: error: 'a' was not declared in this scope
22 | if(a<5||(a==5&&b==4)){
| ^
a.cc:22:18: error: 'b' was not declared in this scope
22 | if(a<5||(a==5&&b==4)){
| ^
|
s597699001 | p00280 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string score;
string ans[127];
string win;
int a,b;
int cou;
void saiki(int ac,int bc ,int d) {
if(d == a+b && (score[a+b-1] == win[0] || win[0] == 'd') ) {
cou++;
for(int i=0;i<a+b;i++) ans[cou-1] += score[i];
}
if(a+b > d) {
if(ac < a) {
score[d] = 'A';
saiki(ac+1,bc,d+1);
}
if(bc < b) {
score[d] = 'B';
saiki(ac,bc+1,d+1);
}
}
}
int main(){
cin >> a >> b;
win = "d";
score.resize(a+b);
if(a > b && (a >= 5 && b != 4) || a == 6) win = "A";
else if(b > a && (b >= 5 && a !=4) || b == 6) win = "B";
// cout << win << endl;
cou = 0;
saiki(0,0,0);
sort(ans,ans+cou);
for(int i=0;i<cou;i++) {
cout << ans[i] << endl;
}
return 0;
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string score;
string ans[127];
string win;
int a,b;
int cou;
void saiki(int ac,int bc ,int d) {
if(d == a+b && (score[a+b-1] == win[0] || win[0] == 'd') ) {
cou++;
for(int i=0;i<a+b;i++) ans[cou-1] += score[i];
}
if(a+b > d) {
if(ac < a) {
score[d] = 'A';
saiki(ac+1,bc,d+1);
}
if(bc < b) {
score[d] = 'B';
saiki(ac,bc+1,d+1);
}
}
}
int main(){
cin >> a >> b;
win = "d";
score.resize(a+b);
if(a > b && (a >= 5 && b != 4) || a == 6) win = "A";
else if(b > a && (b >= 5 && a !=4) || b == 6) win = "B";
// cout << win << endl;
cou = 0;
saiki(0,0,0);
sort(ans,ans+cou);
for(int i=0;i<cou;i++) {
cout << ans[i] << endl;
}
return 0;
}
} | a.cc: In function 'int main()':
a.cc:65:34: error: a function-definition is not allowed here before '{' token
65 | void saiki(int ac,int bc ,int d) {
| ^
a.cc:86:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
86 | int main(){
| ^~
a.cc:86:9: note: remove parentheses to default-initialize a variable
86 | int main(){
| ^~
| --
a.cc:86:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:86:11: error: a function-definition is not allowed here before '{' token
86 | int main(){
| ^
|
s556681338 | p00280 | C++ | #include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int a, b;
int main() {
scanf("%d%d", &a, &b);
if(a + b != 10) {
for(int i = 0; i < (1 << (a + b)); i++) {
if(__popcnt(i) == a) {
for(int j = 0; j < a + b; j++) {
if(i & (1 << j)) printf("A");
else printf("B");
}
printf("\n");
}
}
}
else {
for(int i = 0; i < 256; i++) {
string s;
if(__popcnt(i) == 4) {
for(int j = 0; j < 8; j++) {
if(i & (1 << j)) s += "A";
else s += "B";
}
}
if(a == 6 && b == 4) cout << s << "AA" << endl;
if(a == 5 && b == 5) cout << s << "AB" << endl << s << "BA" << endl;
if(a == 4 && b == 6) cout << s << "BB" << endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:28: error: '__popcnt' was not declared in this scope
10 | if(__popcnt(i) == a) {
| ^~~~~~~~
a.cc:22:28: error: '__popcnt' was not declared in this scope
22 | if(__popcnt(i) == 4) {
| ^~~~~~~~
|
s636985189 | p00280 | C++ | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
greater < string()>;
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
set<string>getans(const int j, const int y, const int nj, const int ny) {
{
set<string>sets;
if (j > nj) {
const int nextj = nj + 1;
const int nexty = ny;
if (nextj == j&&nexty == y) {
sets.emplace("A");
}
if ((nextj>=5||nexty>=5)&&abs(nextj-nexty)>1) {
}
else {
set<string>aset(getans(j, y, nextj, nexty));
for (auto s : aset) {
s = "A" + s;
sets.emplace(s);
}
}
}
if (y > ny) {
const int nextj = nj ;
const int nexty = ny + 1;
if (nextj == j&&nexty == y) {
sets.emplace("B");
}
if ((nextj >= 5 || nexty >= 5) && abs(nextj - nexty)>1) {
}
else {
set<string>aset(getans(j, y, nextj, nexty));
for (auto s : aset) {
s = "B" + s;
sets.emplace(s);
}
}
}
return sets;
}
}
int main() {
int j, y; cin >> j >> y;
set<string>anss(getans(j, y, 0, 0));
for (auto ans : anss) {
cout << ans << endl;
}
return 0;
} | a.cc:11:1: error: declaration does not declare anything [-fpermissive]
11 | greater < string()>;
| ^~~~~~~~~~~~~~~~~~~
|
s777007545 | p00281 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <time.h>
#include <cctype>
#include <deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FFOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define RREP(i,b) FFOR(i,1,b)
#define PB push_back
#define F first
#define S second
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef LL ut;
typedef long double ld;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut> VI;
typedef pair<ut,pr> ppr;
typedef priority_queue<pr,Vpr, greater<pr> > PQ;
const int SIZE=1e+4+10;
const ut INF=1<<30;
const ld eps=1e-6;
const LL mod=1e+9 + 7;
int N, M, L;
vector<pr> data[SIZE];
int main() {
cin >> N >> M;
int s, t, e;
while(1){
scanf("%d%d%d", &s, &t, &e);
if(!s && !t && !e)
break;
t--; s--;
data[t].PB(pr(s, e));
}
cin >> L;
int b;
REP(i,L){
int ans[N+1] = {0};
REP(j,M){
scanf("%d", &b);
REP(k,data[j].size()){
ans[data[j][k].F] += b * data[j][k].S;
}
}
REP(j,N){
if(j)
printf(" ");
printf("%d", ans[j]);
}
printf("\n");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:48:17: error: reference to 'data' is ambiguous
48 | data[t].PB(pr(s, e));
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:38:12: note: 'std::vector<std::pair<long long int, long long int> > data [10010]'
38 | vector<pr> data[SIZE];
| ^~~~
a.cc:56:31: error: reference to 'data' is ambiguous
56 | REP(k,data[j].size()){
| ^~~~
a.cc:15:37: note: in definition of macro 'FOR'
15 | #define FOR(i,a,b) for(int i=(a);i<(b);i++)
| ^
a.cc:56:25: note: in expansion of macro 'REP'
56 | REP(k,data[j].size()){
| ^~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:38:12: note: 'std::vector<std::pair<long long int, long long int> > data [10010]'
38 | vector<pr> data[SIZE];
| ^~~~
a.cc:57:37: error: reference to 'data' is ambiguous
57 | ans[data[j][k].F] += b * data[j][k].S;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:38:12: note: 'std::vector<std::pair<long long int, long long int> > data [10010]'
38 | vector<pr> data[SIZE];
| ^~~~
a.cc:57:58: error: reference to 'data' is ambiguous
57 | ans[data[j][k].F] += b * data[j][k].S;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:38:12: note: 'std::vector<std::pair<long long int, long long int> > data [10010]'
38 | vector<pr> data[SIZE];
| ^~~~
|
s084406817 | p00281 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<unordered_map>
using namespace std;
int a[10000][10000];
int main() {
memset(a, 0, sizeof(a));
} | a.cc: In function 'int main()':
a.cc:10:9: error: 'memset' was not declared in this scope
10 | memset(a, 0, sizeof(a));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include<unordered_map>
+++ |+#include <cstring>
6 | using namespace std;
|
s259722833 | p00281 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,ml,bu;
cin>>n>>m;
vector<int>a,b,c;
int x,y,z;
while(cin>>x>>y>>z,x){
a.push_back(x-1);
b.push_back(y-1);
c.push_back(z);
}
cin >> l;
vector<int>d(m);
for(int i=0;i<l;i++){
vector<int>co(n);
for(int j=0;j<m;j++){
cin>>bu;
d[j]=bu;
}
for(int j=0;j<a.size();j++)
co[a[j]]+=d[b[j]]*c[j];
for(int j=0;j<n;j++){
cout << co[j] ;
if(j+1!=n)
cout<<' ';
}
cout<<endl;
}
} | a.cc: In function 'int main()':
a.cc:5:11: error: 'm' was not declared in this scope; did you mean 'ml'?
5 | cin>>n>>m;
| ^
| ml
a.cc:13:10: error: 'l' was not declared in this scope
13 | cin >> l;
| ^
|
s535169579 | p00281 | C++ | /* ?????¢????????¨?????? 586 + 79 = 665(KiB) ??????????????????????????? */
/* ????´°??????????????§ */
#include <iostream>
#include <vector>
#include <cstdio>
struct JobRecord
{
int staff;
int job;
int count;
};
int main(void)
{
using namespace std;
int num_of_staffs, num_of_jobs;
cin >> num_of_staffs >> num_of_jobs;
vector<JobRecord> v_job_record;
vector<int> v_staff, v_job, v_count;
/* ??\???????¨?????????????????????? */
/* ?????§ 50000 ?????????????????? */
/* ????????§?????¢????????¨?????? 50000(???) * 3(??????, ??????????¨????, ?????°) * 4(Bytes) = 600000(Bytes) ==> ?´?586KiB */
while(1)
{
JobRecord input;
cin >> input.staff >> input.job >> input.count;
if( input.staff == 0 && input.job == 0 && input.count == 0 )
{
break;
}
/* ??\??????????????? */
v_job_record.push_back(input);
}
int num_of_calc;
cin >> num_of_calc;
/* ???????¨???? */
for(int calc_count = 0; calc_count < num_of_calc; calc_count++)
{
/* ???????¨???????????????§?????¢????????¨??????????¨??????¨?????? */
/* v_unit_price : 10000(??\???????¨?????????§) * 4 = 40000 Bytes */
/* v_salary : 10000(????????°?????§) * 4 = 40000 Bytes */
/* ????¨???§ 80000 Bytes ==> ?´? 79 KiB */
vector<int> v_unit_price(num_of_jobs); /* ???????????¨????????? */
vector<int> v_salary(num_of_staffs, 0); /* ???????????¨?????????. ????????? 0 ????????????????¨???? */
/* ??\??? */
for(int job = 0; job < num_of_jobs; job++)
{
cin >> v_unit_price[job];
}
/* ?¨???? */
for(int i = 0; i < v_job_record.size(); i++)
{
/* ???????????\???????¨??????? 1????????????????????§?????????????????????????????¨???????????? 0??????????????????????????? */
int staff = v_job_record[i].staff;
int job = v_job_record[i].job;
int count = v_job_record[i].count;
int unit_price = v_unit_price[ job - 1 ];
v_salary[ staff - 1 ] += unit_price * count;
}
/* ?????? */
for(auto salary : v_salary)
{
printf(salary != v_salary[num_of_staffs - 1] ? "%d ":"%d\n", v_salary[j]);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:74:95: error: 'j' was not declared in this scope
74 | printf(salary != v_salary[num_of_staffs - 1] ? "%d ":"%d\n", v_salary[j]);
| ^
|
s670946567 | p00282 | Java | import java.util.Scanner;
import java.math.BigInteger;
public class Jinkoki {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
String units[] = {"Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan",
"Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
while(sc.hasNext()){
String m = sc.next();
int n = sc.nextInt();
if(n == 0) break;
BigInteger bi = new BigInteger(m);
bi = bi.pow(n);
for(int i = 68; i >= 4; i -= 4){
BigInteger div = new BigInteger("10");
if(bi.divide(div.pow(i)).signum() == 1){
System.out.printf("%s%s",bi.divide(div.pow(i)),units[i / 4 - 1]);
bi = bi.remainder(div.pow(i));
}
}
if(bi.signum() == 1){
System.out.print(bi);
}
System.out.println();
}
}
} | Main.java:4: error: class Jinkoki is public, should be declared in a file named Jinkoki.java
public class Jinkoki {
^
1 error
|
s695607235 | p00282 | Java | package Jinkoki;
import java.util.Scanner;
import java.math.BigInteger;
public class Jinkoki {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
String units[] = {"Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan",
"Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
while(sc.hasNext()){
String m = sc.next();
int n = sc.nextInt();
if(n == 0) break;
BigInteger bi = new BigInteger(m);
bi = bi.pow(n);
for(int i = 68; i >= 4; i -= 4){
BigInteger div = new BigInteger("10");
if(bi.divide(div.pow(i)).signum() == 1){
System.out.printf("%s%s",bi.divide(div.pow(i)),units[i / 4 - 1]);
bi = bi.remainder(div.pow(i));
}
}
if(bi.signum() == 1){
System.out.print(bi);
}
System.out.println();
}
}
} | Main.java:6: error: class Jinkoki is public, should be declared in a file named Jinkoki.java
public class Jinkoki {
^
1 error
|
s205662504 | p00282 | Java | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
String [] unit = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
Scanner sc = new Scanner(System.in);
while(sc.hasNextInt()){
int m = sc.nextInt();
int n = sc.nextInt();
if(m==0 && n==0) break;
Math.BigInteger b = valueOf(Math.pow(m,n));
String ans = "";
for(int i=0;i<18;i++){
String digit = remainder(b,10000);
ans = digit.concat(unit[i]+ans);
b = divide(b,10000);
}
System.out.println(ans);
}
}
}
| Main.java:11: error: cannot find symbol
Math.BigInteger b = valueOf(Math.pow(m,n));
^
symbol: class BigInteger
location: class Math
Main.java:11: error: cannot find symbol
Math.BigInteger b = valueOf(Math.pow(m,n));
^
symbol: method valueOf(double)
location: class Main
2 errors
|
s812568929 | p00282 | C | a[];main(n,m,i,*p){for(;scanf("%d%d",&m,&n)*n;puts(a))for(*a=1;~n--;)for(i=18;i;*p=~n?p[1]+=*p*m/1e4,*p*m%10000:*p&&!printf("%d%.3s",*p,51-i*3+"MtsFksNytAsgGgsGokSaiSeiKanKo\0JouJo\0GaiKeiChoOkuMan"))p=a+--i;} | main.c:1:1: warning: data definition has no type or storage class
1 | a[];main(n,m,i,*p){for(;scanf("%d%d",&m,&n)*n;puts(a))for(*a=1;~n--;)for(i=18;i;*p=~n?p[1]+=*p*m/1e4,*p*m%10000:*p&&!printf("%d%.3s",*p,51-i*3+"MtsFksNytAsgGgsGokSaiSeiKanKo\0JouJo\0GaiKeiChoOkuMan"))p=a+--i;}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:16: error: expected ')' before '*' token
1 | a[];main(n,m,i,*p){for(;scanf("%d%d",&m,&n)*n;puts(a))for(*a=1;~n--;)for(i=18;i;*p=~n?p[1]+=*p*m/1e4,*p*m%10000:*p&&!printf("%d%.3s",*p,51-i*3+"MtsFksNytAsgGgsGokSaiSeiKanKo\0JouJo\0GaiKeiChoOkuMan"))p=a+--i;}
| ^
| )
main.c:1:1: warning: array 'a' assumed to have one element
1 | a[];main(n,m,i,*p){for(;scanf("%d%d",&m,&n)*n;puts(a))for(*a=1;~n--;)for(i=18;i;*p=~n?p[1]+=*p*m/1e4,*p*m%10000:*p&&!printf("%d%.3s",*p,51-i*3+"MtsFksNytAsgGgsGokSaiSeiKanKo\0JouJo\0GaiKeiChoOkuMan"))p=a+--i;}
| ^
|
s737050772 | p00282 | C++ | #include <bits/stdc++.h>
using namespace std;
string s[]={ "","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts" };
main(){
int n,m;
while(cin>>m>>n,m){
int a[18]={};
a[0]
for(int i=0;i<n;i++)
for(int j=17;j>=0;j--){
a[j]*=m;
a[j+1]+=a[j]/10000;
a[j]=a[j]%10000;
}
for(int i=17;i>=0;i--)if(a[i])cout<<a[i]<<s[i];
cout<<endl;
}
} | a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:8:9: error: expected ';' before 'for'
8 | a[0]
| ^
| ;
9 | for(int i=0;i<n;i++)
| ~~~
a.cc:9:17: error: 'i' was not declared in this scope
9 | for(int i=0;i<n;i++)
| ^
a.cc:10:20: error: 'j' was not declared in this scope
10 | for(int j=17;j>=0;j--){
| ^
|
s602969151 | p00283 | C++ | #include <iostream>
#include <algorithm>
#define INF (2 << 28)
using namespace std;
int d, n, dp[111][111];
int a[111], e[111], r[111];
int rec(int exp, int hp){
if(hp <= 0) return 0;
int ret = INF;
for(int i = 0; i < n; i++){
if(r[i] <= exp)
ret = min(ret, rec(exp + e[i], hp - a[i]) + 1);
}
return dp[exp][hp] = ret;
}
int main(){
while(cin >> d >> n, d||n){
for(int i = 0; i < n; i++) cin >> a[i] >> e[i] >> r[i];
memset(dp, -1, sizeof(dp));
int dd = rec(0, d);
if(dd == INF) cout << "NA" << endl;
else cout << dd << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'memset' was not declared in this scope
26 | memset(dp, -1, sizeof(dp));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | #define INF (2 << 28)
|
s562604335 | p00283 | C++ |
import java.util.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
public class Main {
int INF = 1 << 28;
int d, n;
int[] a, e, r;
void run() {
Scanner sc = new Scanner(System.in);
for (;;) {
d = sc.nextInt(); n = sc.nextInt();
if ((d|n) == 0) break;
a = new int[n]; e = new int[n]; r = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt(); e[i] = sc.nextInt(); r[i] = sc.nextInt();
}
mem = new int[300][300];
for (int[] a : mem) fill(a, -1);
int ret = solve(0, d);
if (ret == INF) {
System.out.println("NA");
} else {
System.out.println(ret);
}
}
}
int[][] mem;
int solve(int exp, int hp) {
if (hp < 0) return 0;
if (mem[exp][hp] > 0) return mem[exp][hp];
int min = INF;
for (int i = 0; i < n; i++) if (r[i] <= exp){
min = min(min, solve(exp + e[i], hp - a[i]) + 1);
}
return mem[exp][hp] = min;
}
void debug(Object...os) {
System.out.println(deepToString(os));
}
public static void main(String[] args) {
new Main().run();
}
} | a.cc:2:1: error: 'import' does not name a type
2 | import java.util.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import static java.util.Arrays.*;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import static java.util.Collections.*;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import static java.lang.Math.*;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
8 | public class Main {
| ^~~~~~
|
s807357064 | p00283 | C++ | #include <iostream>
#include <algorithm>
#define INF 100000000
using namespace std;
int n;
int a[101],e[101],r[101];
int dp[kai][ex];
int ans ;
void saiki(int d,int ex,int kai) {
if(d <= 0 && ans > kai) ans = kai;
if(d > 0) {
for(int i=0;i<n;i++) {
if(r[i] <= ex) {
saiki(d-a[i],ex+e[i],kai+1);
}
}
}
}
int main() {
while(1) {
int d;
cin >> d >> n;
if(d==0 && n ==0) break;
for(int i=0;i<n;i++) cin >> a[i] >> e[i] >> r[i];
ans =INF;
saiki(d,0,0);
if(ans == INF) cout << "NA" <<endl;
else cout << ans <<endl;
}
return 0;
}
| a.cc:8:8: error: 'kai' was not declared in this scope
8 | int dp[kai][ex];
| ^~~
a.cc:8:13: error: 'ex' was not declared in this scope; did you mean 'e'?
8 | int dp[kai][ex];
| ^~
| e
|
s209413879 | p00283 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int D, N, w, a[111], e[111], r[111], dp[111][111][222];
int rec(int f1, int f2, int d) {
if (f1 >= D) return d;
if (dp[f1][f2][d]) return dp[f1][f2][d] - 1;
int ret = 999999999;
for (int i = 0; i < N; i++) {
if (!a[i] && (!e[i] || f2 == w)) continue;
if (f2 >= r[i]) ret = min(ret, rec(f1 + a[i], min(f2 + e[i], w), d + 1));
}
dp[f1][f2][d] = ret + 1;
return ret;
}
int main() {
while (cin >> D >> N, D | N) {
for (int i = 0; i < N; i++) cin >> a[i] >> e[i] >> r[i];
w = max_element(r, r + N);
for (int i = 0; i < D; i++) {
for (int j = 0; j <= w; j++) {
for (int k = 0; k < N * 2; k++) {
dp[i][j][k] = 0;
}
}
}
int ret = rec(0, 0, 0);
if (ret == 999999999) cout << "NA" << endl;
else cout << ret << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:32: error: invalid conversion from 'int*' to 'int' [-fpermissive]
19 | w = max_element(r, r + N);
| ~~~~~~~~~~~^~~~~~~~~~
| |
| int*
|
s002407430 | p00283 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<set>
#include<list>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
struct c {
int d, e, f;
};
c k[100];
int a, b;
int memo[101][101];
int saiki(int n, int m) {//????????????n??§????¨???????m
if (memo[n][m] != -1)return memo[n][m];
int MIN = 1 << 29;
for (int i = 0; i < b; i++) {
if (k[i].f <= m) {
if (k[i].d >= n)return memo[n][m]=1;
MIN = min(MIN, 1+saiki(n-k[i].d, min(100, k[i].e + m)));
}
}
return memo[n][m]=MIN;
}
int main() {
while (cin >> a >> b, a | b) {
memset(memo, -1, sizeof(memo));
for (int g = 0; g < b; g++) {
int h, i, j; scanf("%d%d%d", &h, &i, &j);
k[g] = { h,i,j };
}
int S = saiki(a, 0);
if (S >= 1 << 29) { puts("NA"); }
else cout << S << endl;
}
} | a.cc: In function 'int main()':
a.cc:31:17: error: 'memset' was not declared in this scope
31 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include<unordered_map>
+++ |+#include <cstring>
10 | using namespace std;
|
s882949647 | p00283 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<set>
#include<list>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
struct c {
int d, e, f;
};
c k[100];
int a, b;
int memo[101][101];
int saiki(int n, int m) {//????????????n??§????¨???????m
int MIN = 1 << 29;
for (int i = 0; i < b; i++) {
if (k[i].f <= m) {
if (k[i].d >= n)return memo[n][m]=1;
int O = 0;
if (memo[n - k[i].d][min(100, k[i].e + m)] != -1) {
O = 1+memo[n - k[i].d][min(100, k[i].e + m)];
}
else {
O = 1 + saiki(n - k[i].d, min(100, k[i].e + m));
}
MIN = min(MIN,O);
}
}
return memo[n][m]=MIN;
}
int main() {
while (cin >> a >> b, a | b) {
memset(memo, -1, sizeof(memo));
for (int g = 0; g < b; g++) {
int h, i, j; scanf("%d%d%d", &h, &i, &j);
k[g] = { h,i,j };
}
int S = saiki(a, 0);
if (S >= 1 << 29) { puts("NA"); }
else cout << S << endl;
}
} | a.cc: In function 'int main()':
a.cc:37:17: error: 'memset' was not declared in this scope
37 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include<unordered_map>
+++ |+#include <cstring>
10 | using namespace std;
|
s800448939 | p00283 | C++ | #include<bits/stdc++.h>
#define mk make_pair
#define f first
#define s second
using namespace std;
int d,n,dp[10000][100010];
vector<pair<pair<int,int>,int> >v;
int dfs(int p,int x){
int res=0,k=1;
if(p<=0)return 0;
if(dp[p][x])return dp[p][x];
for(int i=0;i<v.size();i++)
if(v[i].s<=x){
if(k)k--,res=dfs(p-v[i].f.f,x+v[i].f.s)+1;
else res=min(res,dfs(p-v[i].f.f,x+v[i].f.s)+1);
}
return dp[p][x]=res;
}
int main(){
while(cin>>d>>n,d){
memset(dp,0,sizeof(dp));
v.clear();
while(n--){
int a,b,c;
cin>>a>>b>>c;
v.push_back(mk(mk(a,b),c));
}
int p=dfs(d,0);
if(!p)cout<<"NA"<<endl;
else cout<<p<<endl;
}
} | /tmp/cc0ax1X8.o: in function `dfs(int, int)':
a.cc:(.text+0x9b): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
a.cc:(.text+0xcd): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
a.cc:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
a.cc:(.text+0x11c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
a.cc:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
a.cc:(.text+0x183): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
/tmp/cc0ax1X8.o: in function `main':
a.cc:(.text+0x221): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
a.cc:(.text+0x2af): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
/tmp/cc0ax1X8.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x394): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
a.cc:(.text+0x3ad): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0ax1X8.o
collect2: error: ld returned 1 exit status
|
s269454285 | p00283 | C++ | #include<bits/stdc++.h>
#define mk make_pair
#define f first
#define s second
using namespace std;
int d,n,dp[110][1000];
vector<pair<pair<int,int>,int> >v;
int dfs(int p,int x,int q){
int res=0,k=1;
if(x>=1000&&p==q)return 10000000;
if(p<=0)return 0;
if(dp[p][x])return dp[p][x];
for(int i=0;i<v.size();i++)
if(v[i].s<=x){
if(k)k--,res=dfs(p-v[i].f.f,x+v[i].f.s,p)+1;
else res=min(res,dfs(p-v[i].f.f,x+v[i].f.s,p)+1);
}
return dp[p][x]=res;
}
int main(){
while(cin>>d>>n,d){
memset(dp,0,sizeof(dp));
v.clear();
while(n--){
int a,b,c;
cin>>a>>b>>c;
if(a+b)v.push_back(mk(mk(a,b),c));
}
int p=dfs(d,0,d);
if(!p)cout<<"NA"<<endl;
else cout<<p<<endl;
| a.cc: In function 'int main()':
a.cc:31:24: error: expected '}' at end of input
31 | else cout<<p<<endl;
| ^
a.cc:21:21: note: to match this '{'
21 | while(cin>>d>>n,d){
| ^
a.cc:31:24: error: expected '}' at end of input
31 | else cout<<p<<endl;
| ^
a.cc:20:11: note: to match this '{'
20 | int main(){
| ^
|
s627024529 | p00283 | C++ | #include<bits/stdc++.h>
#define mk make_pair
#define f first
#define s second
using namespace std;
int d,n,s;
vector<pair<pair<int,int>,int> >v;
void dfs(int p,int x,int t){
if(t>=s)return;
if(p<0){s=t;return;}
if(x>10000)return;
for(int i=0;i<v.size();i++)
if(v[i].s<=x)dfs(p-v[i].f.f,x+v[i].f.s,t+1);
}
int main(){
while(cin>>d>>n,d){
memset(dp,0,sizeof(dp));
v.clear();s=1000000;
while(n--){
int a,b,c;
cin>>a>>b>>c;
if(a+b)v.push_back(mk(mk(a,b),c));
}
sort(v.begin(),v.end());
dfs(d,0,0);
if(s!=10000000)cout<<"NA"<<endl;
else cout<<s<<endl;
}
} | a.cc: In function 'int main()':
a.cc:17:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
17 | memset(dp,0,sizeof(dp));
| ^~
| dup
|
s228437105 | p00283 | C++ | #include<bits/stdc++.h>
#define mk make_pair
#define f first
#define s second
using namespace std;
int d,n,s;
vector<pair<pair<int,int>,int> >v;
void dfs(int p,int x,int t){
if(t>=s)return;
if(p<0){s=t;return;}
if(x>10000)return;
for(int i=v.size()-1;i>=0;i--)
if(v[i].s<=x)dfs(p-v[i].f.f,x+v[i].f.s,t+1);
}
int main(){
while(cin>>d>>n,d){
memset(dp,0,sizeof(dp));
v.clear();s=1000000;
while(n--){
int a,b,c;
cin>>a>>b>>c;
if(a+b)v.push_back(mk(mk(a,b),c));
}
sort(v.begin(),v.end());
dfs(d,0,0);
if(s!=10000000)cout<<"NA"<<endl;
else cout<<s<<endl;
}
} | a.cc: In function 'int main()':
a.cc:17:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
17 | memset(dp,0,sizeof(dp));
| ^~
| dup
|
s940459315 | p00283 | C++ | #include<bits/stdc++.h>
#define mk make_pair
#define f first
#define s second
using namespace std;
int d,n,dp[110][100000];
vector<pair<pair<int,int>,int> >v;
int dfs(int p,int x,int t){
int res=0,k=1;
if(t>=100)return 10000000;
if(p<=0)return 0;
if(dp[p][x])return dp[p][x];
for(int i=0;i<v.size();i++)
if(v[i].s<=x){
if(k)k--,res=dfs(p-v[i].f.f,x+v[i].f.s,t+1)+1;
else res=min(res,dfs(p-v[i].f.f,x+v[i].f.s,t+1)+1);
}
return dp[p][x]=res;
}
int main(){
while(cin>>d>>n,d){
memset(dp,0,sizeof(dp));
v.clear();
while(n--){
int a,b,c;
cin>>a>>b>>c;
if(a+b)v.push_back(mk(mk(a,b),c));
}
sort(v.begin(),v.end(),greater<pair<pair<in,int>,int> >());
int p=dfs(d,0,0);
if(!p)cout<<"NA"<<endl;
else cout<<p<<endl;
}
} | a.cc: In function 'int main()':
a.cc:29:46: error: 'in' was not declared in this scope; did you mean 'yn'?
29 | sort(v.begin(),v.end(),greater<pair<pair<in,int>,int> >());
| ^~
| yn
a.cc:29:52: error: template argument 1 is invalid
29 | sort(v.begin(),v.end(),greater<pair<pair<in,int>,int> >());
| ^
a.cc:29:57: error: template argument 1 is invalid
29 | sort(v.begin(),v.end(),greater<pair<pair<in,int>,int> >());
| ^
a.cc:29:59: error: template argument 1 is invalid
29 | sort(v.begin(),v.end(),greater<pair<pair<in,int>,int> >());
| ^
|
s726631707 | p00283 | C++ | #include<bits/stdc++.h>
#define mk make_pair
#define f first
#define s second
using namespace std;
int d,n,dp[110];
vector<pair<pair<int,int>,int> >v;
int dfs(int p,int x,int t){
int res=0;
if(t>=100)return 10000000;
if(p<=0)return 0;
if(dp[p])return dp[p];
for(int i=0;i<v.size();i++)
if(v[i].s<=x){
if(k)k--,res=dfs(p-v[i].f.f,x+v[i].f.s,t+1)+1;
else res=min(res,dfs(p-v[i].f.f,x+v[i].f.s,t+1)+1);
}
return dp[p]=res;
}
int main(){
while(cin>>d>>n,d){
memset(dp,0,sizeof(dp));
v.clear();
while(n--){
int a,b,c;
cin>>a>>b>>c;
if(a+b)v.push_back(mk(mk(a,b),c));
}
sort(v.begin(),v.end(),greater<pair<pair<int,int>,int> >());
int p=dfs(d,0,0);
if(!p)cout<<"NA"<<endl;
else cout<<p<<endl;
}
} | a.cc: In function 'int dfs(int, int, int)':
a.cc:15:10: error: 'k' was not declared in this scope
15 | if(k)k--,res=dfs(p-v[i].f.f,x+v[i].f.s,t+1)+1;
| ^
|
s617941184 | p00283 | C++ | require 'set'
def bfs(start_node, extra = nil)
return 0 if start_node.is_goal?(extra)
reached = Set[start_node]
dist = 1
queue = [start_node]
until queue.empty?
next_queue = []
until queue.empty?
node = queue.shift
node.each_next_node(extra) do |next_node|
return dist if next_node.is_goal?(extra)
next if reached.include?(next_node)
reached << next_node
next_queue << next_node
end
end
dist += 1
queue = next_queue
end
return nil
end
class Array
def is_goal?(extra)
self[0] <= 0
end
def each_next_node(extra)
d, t = self
(extra[:valid_weapons][t] || []).each do |a, e|
ne = t + e
ne = extra[:max_e] if ne > extra[:max_e]
yield [d - a, ne]
end
end
end
loop do
d, n = gets.split.map(&:to_i)
break if n == 0
weapons = (1..n).map { gets.split.map(&:to_i) }
weapons.sort_by!(&:last)
valid_weapons = {}
(0..weapons[-1][2]).each do |t|
l = weapons.select {|a, e, r| r <= t}
l.map! {|a, e, _| [a, e]}
l.uniq!
l = l.select {|a1, e1| l.all?{|a2, e2| (a1 == a2 && e1 == e2) || (a1 > a2 || e1 > e2)}}
valid_weapons[t] = l
end
puts bfs([d, 0], {:valid_weapons => valid_weapons, :max_e => weapons[-1][2]}) || 'NA'
end
| a.cc:1:9: warning: multi-character character constant [-Wmultichar]
1 | require 'set'
| ^~~~~
a.cc:43:16: error: too many decimal points in number
43 | weapons = (1..n).map { gets.split.map(&:to_i) }
| ^~~~
a.cc:46:6: error: too many decimal points in number
46 | (0..weapons[-1][2]).each do |t|
| ^~~~~~~~~~
a.cc:53:86: warning: multi-character character constant [-Wmultichar]
53 | puts bfs([d, 0], {:valid_weapons => valid_weapons, :max_e => weapons[-1][2]}) || 'NA'
| ^~~~
a.cc:1:1: error: 'require' does not name a type
1 | require 'set'
| ^~~~~~~
a.cc:44:5: error: 'weapons' does not name a type
44 | weapons.sort_by!(&:last)
| ^~~~~~~
a.cc:46:6: error: expected unqualified-id before numeric constant
46 | (0..weapons[-1][2]).each do |t|
| ^~~~~~~~~~
a.cc:46:6: error: expected ')' before numeric constant
46 | (0..weapons[-1][2]).each do |t|
| ~^~~~~~~~~~
| )
a.cc:48:9: error: 'l' does not name a type
48 | l.map! {|a, e, _| [a, e]}
| ^
a.cc:49:9: error: 'l' does not name a type
49 | l.uniq!
| ^
a.cc:51:9: error: 'valid_weapons' does not name a type
51 | valid_weapons[t] = l
| ^~~~~~~~~~~~~
a.cc:53:81: error: expected unqualified-id before ')' token
53 | puts bfs([d, 0], {:valid_weapons => valid_weapons, :max_e => weapons[-1][2]}) || 'NA'
| ^
|
s575075284 | p00284 | Java | ??import java.util.*;
class Main {
public static void main(String... args) {
final Scanner sc = new Scanner(System.in);
final int N = sc.nextInt();
for (int i = 0; i < N; i++) {
final int a = sc.nextInt();
final int b = sc.nextInt();
System.out.println(Integer.bitCount(Math.abs(a)) + Integer.bitCount(Math.abs(b)));
}
}
} | Main.java:1: error: class, interface, enum, or record expected
??import java.util.*;
^
1 error
|
s720663470 | p00284 | Java | ??import java.util.*;
public class Main {
public static void main(String... args) {
final Scanner sc = new Scanner(System.in);
final int N = sc.nextInt();
for (int i = 0; i < N; i++) {
final int a = sc.nextInt();
final int b = sc.nextInt();
System.out.println(Integer.bitCount(Math.abs(a)) + Integer.bitCount(Math.abs(b)));
}
}
} | Main.java:1: error: class, interface, enum, or record expected
??import java.util.*;
^
1 error
|
s582187083 | p00284 | Java | public static void main(String[] args) {
// TODO ?????????????????????????????????????????????
// ?¨??????\??????????????????????????????Scanner???????????§??????????????????
Scanner sc = new Scanner(System.in);
// int ????????????????????????
int n = sc.nextInt();
for(int i=0;i<n;i++){
int b = sc.nextInt();
int c = sc.nextInt();
int dirst = Math.abs(b-c);
int cnt=0;
int flag=0;
while(true){
if (dirst%2!=1){
cnt++;
dirst=dirst/2;
}else if (dirst!=1){//?\???°
flag++;
dirst--;
}else if(dirst==1){
break;
}
}
// ?¨????????????????????????????
System.out.println(cnt+flag);
}
} | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
1 error
|
s231061346 | p00284 | C | main(){
int n,m;
scanf("%d%d",&n,&m);
if(n*m<0)printf("%d\n",__builtin_popcnt(-n)+__builtin_popcnt(m));
else printf("%d\n",__builtin_popcnt(m-n));
exit(0);
} | main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main(){
| ^~~~
main.c: In function 'main':
main.c:3:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | scanf("%d%d",&n,&m);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | main(){
main.c:3:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | scanf("%d%d",&n,&m);
| ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:4:10: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
4 | if(n*m<0)printf("%d\n",__builtin_popcnt(-n)+__builtin_popcnt(m));
| ^~~~~~
main.c:4:10: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:4:10: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:4:10: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:4:24: error: implicit declaration of function '__builtin_popcnt'; did you mean '__builtin_popcount'? [-Wimplicit-function-declaration]
4 | if(n*m<0)printf("%d\n",__builtin_popcnt(-n)+__builtin_popcnt(m));
| ^~~~~~~~~~~~~~~~
| __builtin_popcount
main.c:5:6: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
5 | else printf("%d\n",__builtin_popcnt(m-n));
| ^~~~~~
main.c:5:6: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:6:1: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
6 | exit(0);
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | main(){
main.c:6:1: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
6 | exit(0);
| ^~~~
main.c:6:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
|
s393394859 | p00284 | C | main(){
int t,n,m;
for(scanf("%d",&t);t--;){
scanf("%d%d",&n,&m);
if(n*m<0)printf("%d\n",__builtin_popcount(-n)+__builtin_popcount(m));
else{if(m<0)m=-m;if(n<0)n=-n;printf("%d\n",__builtin_popcount(m^n));
}
exit(0);
} | main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main(){
| ^~~~
main.c: In function 'main':
main.c:3:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | for(scanf("%d",&t);t--;){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | main(){
main.c:3:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | for(scanf("%d",&t);t--;){
| ^~~~~
main.c:3:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:10: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
5 | if(n*m<0)printf("%d\n",__builtin_popcount(-n)+__builtin_popcount(m));
| ^~~~~~
main.c:5:10: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:5:10: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:5:10: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:6:30: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
6 | else{if(m<0)m=-m;if(n<0)n=-n;printf("%d\n",__builtin_popcount(m^n));
| ^~~~~~
main.c:6:30: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:8:1: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
8 | exit(0);
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | main(){
main.c:8:1: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
8 | exit(0);
| ^~~~
main.c:8:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:9:1: error: expected declaration or statement at end of input
9 | }
| ^
|
s365948615 | p00284 | C | main(){
int t,n,m,l;
for(scanf("%d",&t);t--;){
scanf("%d%d",&n,&m);
if(n*m<0)printf("%d\n",__builtin_popcount(-n)+__builtin_popcount(m));
else{l=if(m<0)m=-m;if(n<0)n=-n;printf("%d\n",__builtin_popcount(n-(n^m))+__builtin_popcount(m-(n^m)));}
}
exit(0);
} | main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main(){
| ^~~~
main.c: In function 'main':
main.c:3:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | for(scanf("%d",&t);t--;){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | main(){
main.c:3:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | for(scanf("%d",&t);t--;){
| ^~~~~
main.c:3:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:10: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
5 | if(n*m<0)printf("%d\n",__builtin_popcount(-n)+__builtin_popcount(m));
| ^~~~~~
main.c:5:10: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:5:10: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:5:10: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:6:8: error: expected expression before 'if'
6 | else{l=if(m<0)m=-m;if(n<0)n=-n;printf("%d\n",__builtin_popcount(n-(n^m))+__builtin_popcount(m-(n^m)));}
| ^~
main.c:6:32: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
6 | else{l=if(m<0)m=-m;if(n<0)n=-n;printf("%d\n",__builtin_popcount(n-(n^m))+__builtin_popcount(m-(n^m)));}
| ^~~~~~
main.c:6:32: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:8:1: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
8 | exit(0);
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | main(){
main.c:8:1: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
8 | exit(0);
| ^~~~
main.c:8:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
|
s598803406 | p00284 | C++ | #include<bits/stdc++.h>
using namespace std;
int s, d;
bool check(int train,int n){
if(!train) return true;
int shift = pow(2,train);
if(n + shift > d) return false;
rep(i,32){
if(abs(n) & (1<<i)){
if(i && (1<<i) % shift == 0) return true;
else return false;
}
}
return true;
}
int cnt(int no){
int i = 0;
while(check(i,no)) i++;
return i - 1;
}
int solve(int now, int cost){
if(now == d) return cost;
int train = cnt(now);
if(now + pow(2,train) <= d){
return solve(now+pow(2,train),cost+1);
}else{
return solve(now,cost+1);
}
}
int main(){
int N;
cin >> N;
while(N--){
cin >> s >> d;
cout << solve(s,0) << endl;
}
} | a.cc: In function 'bool check(int, int)':
a.cc:8:7: error: 'i' was not declared in this scope
8 | rep(i,32){
| ^
a.cc:8:3: error: 'rep' was not declared in this scope
8 | rep(i,32){
| ^~~
|
s542787729 | p00284 | C++ | int s, d;
bool check(int train,int n){
if(!train) return true;
int shift = pow(2,train);
if(n + shift > d) return false;
for(int i = 0; i < 32; i++){
if(abs(n) & (1<<i)){
if(i && (1<<i) % shift == 0) return true;
else return false;
}
}
return true;
}
int cnt(int no){
int i = 0;
while(check(i,no)) i++;
return i - 1;
}
int solve(int now, int cost){
if(now == d) return cost;
int train = cnt(now);
if(now + pow(2,train) <= d){
return solve(now+pow(2,train),cost+1);
}else{
return solve(now,cost+1);
}
}
int main(){
int N;
cin >> N;
while(N--){
cin >> s >> d;
cout << solve(s,0) << endl;
}
} | a.cc: In function 'bool check(int, int)':
a.cc:4:15: error: 'pow' was not declared in this scope
4 | int shift = pow(2,train);
| ^~~
a.cc:7:8: error: 'abs' was not declared in this scope
7 | if(abs(n) & (1<<i)){
| ^~~
a.cc: In function 'int solve(int, int)':
a.cc:22:12: error: 'pow' was not declared in this scope; did you mean 'now'?
22 | if(now + pow(2,train) <= d){
| ^~~
| now
a.cc: In function 'int main()':
a.cc:30:3: error: 'cin' was not declared in this scope
30 | cin >> N;
| ^~~
a.cc:33:5: error: 'cout' was not declared in this scope
33 | cout << solve(s,0) << endl;
| ^~~~
a.cc:33:27: error: 'endl' was not declared in this scope
33 | cout << solve(s,0) << endl;
| ^~~~
|
s394488627 | p00284 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
#include <Windows.h>
#include "MT.h"
using namespace std;
#define int long long
int solve(int s, int d) {
int ret = abs(s)%2 + abs(d)%2;
if (s == d) return 0;
s += abs(s)%2;
d -= abs(d)%2;
ret += solve(s/2, d/2);
return ret;
}
signed main(){
int N;
cin >> N;
for (int i = 0; i < N; i++) {
int s, d;
cin >> s >> d;
cout << solve(s, d) << endl;
}
return 0;
} | a.cc:7:10: fatal error: Windows.h: No such file or directory
7 | #include <Windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s482946714 | p00284 | C++ | #include <stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int choise(int s, int d);
int main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
int N,M,a;
int s;
int d;
cin >> N;
for (int i=0; i < N; i++) {
cin >> s;
cin >> d;
count = 0;
choise(s,d);
}
}
int choise(int s,int d) {
int max = d - s;
int i = 1;
int ans=0;
for (i=1;i<=max;i=i*2) {
if (s%i == 0) {
ans = i;
}
}
static int count=0;
count++;
if (ans == 0) {
printf("%d\n",count-1);
return 0;
}
choise(s + ans, d);
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'count' was not declared in this scope
26 | count = 0;
| ^~~~~
a.cc: In function 'int choise(int, int)':
a.cc:58:15: warning: control reaches end of non-void function [-Wreturn-type]
58 | choise(s + ans, d);
| ~~~~~~^~~~~~~~~~~~
|
s867191025 | p00284 | C++ | #include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
int dfs(int s, int g) {
if (s == g)return 0;
int n = 1;
while ((g / n + (g < 0 && g%n != 0))*n - (s / n)*n) / n > 0)n <<= 1; n >>= 1;
int a = (s / n)*n, b = (g / n + (g < 0 && g%n != 0))*n;
if (b > g)abort();
return 1 + dfs(s, a) + dfs(b, g);
}
signed main() {
int n; scanf("%lld", &n);
rep(i, n) {
int s, d; scanf("%lld%lld", &s, &d);
printf("%lld\n", dfs(s, d));
}
} | a.cc: In function 'long long int dfs(long long int, long long int)':
a.cc:15:61: error: expected primary-expression before '/' token
15 | while ((g / n + (g < 0 && g%n != 0))*n - (s / n)*n) / n > 0)n <<= 1; n >>= 1;
| ^
|
s715757056 | p00284 | C++ | #include<bits/stdc++.h>
#define int long long
using namespace std;
int main(){
int a;
cin>>a;
for(int b=0;b<a;b++){
int c,d;cin>>c>>d;
int i=0;
for(;c!=d;i++){
for(int j=1;;j<<=1){
if(j>d-c){c+=j/2;break;}
}
}
cout<<i<<endl;
}
} | cc1plus: error: '::main' must return 'int'
|
s656485964 | p00284 | C++ | #include <iostream>
#include <intrin.h>
#include <assert.h>
using namespace std;
int main()
{
int N;
cin >> N;
for (int i = 0; i < N; ++i)
{
int s, d;
cin >> s >> d;
if (s <= 0 && d >= 0)
{
cout << __popcnt(-s) + __popcnt(d) << endl;
}
else if (s < 0 && d < 0)
{
cout << __popcnt((-s) ^ (-d)) << endl;
}
else if (s >= 0)
{
assert(d > 0);
cout << __popcnt(s^d) << endl;
}
}
} | a.cc:2:10: fatal error: intrin.h: No such file or directory
2 | #include <intrin.h>
| ^~~~~~~~~~
compilation terminated.
|
s220603895 | p00285 | C++ | #include<bits/stdc++.h>
using namespace std;
int m, w;
int bm[22], bw[22];
int memo[22][1<<13];
int e(int i, int j){
int p = abs(bm[i] - bw[j]);
return p * (p-30) * (p-30);
}
int solve(int cntm, int bitw){
if(~memo[cntm][bitw]) return memo[cntm][bitw];
if(cntm == m) return 0;
int ret = 0;
for(int i=0;i<w;i++)
if(!(bitw & (1<<i)))
ret = max(ret, solve(cntm+1, (bitw | (1<<i))) + e(cntm, i));
ret = max(ret, solve(cnt+1, bitw));
return memo[cntm][bitw] = ret;
}
int main(){
while(cin >> m >> w){
for(int i=0;i<m;i++) cin >> bm[i];
for(int i=0;i<w;i++) cin >> bw[i];
memset(memo, -1, sizeof(memo));
cout << solve(0, 0) << endl;
}
} | a.cc: In function 'int solve(int, int)':
a.cc:25:24: error: 'cnt' was not declared in this scope; did you mean 'cntm'?
25 | ret = max(ret, solve(cnt+1, bitw));
| ^~~
| cntm
|
s099372378 | p00285 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int n, m, a[12], b[12], dp[1 << 12];
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
if (n < m) swap(n, m), swap(a, b);
for (int i = 1; i < (1 << n); i++) {
int r = __builtin_popcount(i);
if (r > m) continue;
for (int j = 0; j < n; j++) {
if (i & (1 << j)) {
int p = abs(a[j] - b[r - 1]);
dp[i] = max(dp[i], dp[i - (1 << j)] + p * (p - 30) * (p - 30));
}
}
}
cout << *max_element(dp, dp + 1 << n) << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:41: error: invalid operands of types 'int*' and 'int' to binary 'operator<<'
20 | cout << *max_element(dp, dp + 1 << n) << endl;
| ~~~~~~ ^~ ~
| | |
| int* int
|
s261165749 | p00286 | C++ | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef vector<int> vec;
vec Add(vec,vec);
vec Power(vec,int);
vec Formula();
vec Ar();
vec v[27];
string s;
int n,p;
int main(){
int k,h,a;
char c;
cin>>n>>k;
while(k--){
cin>>c>>h;
for(int i=0;i<n;i++) v[c-'A'].push_back(i);
for(int i=0;i<h-1;i++)
for(int j=0;j<n-1;j++){
cin>>a;
if(a) swap(v[c-'A'][j],v[c-'A'][j+1]);
}
}
cin>>k;
while(k--){
cin>>s;
s+='$';
p=0;
vec ans=Formula();
for(int i=0;i<n;i++){
if(i) cout<<' ';
cout<<ans[i]+1;
}
cout<<endl;
}
return 0;
}
vec Add(vec A,vec B){
vec res=vec(n);
for(int i=0;i<n;i++) res[i]=A[B[i]];
return res;
}
vec Power(vec A,int x){
vec res;
for(int i=0;i<n;i++) res.push_back(i);
while(x){
if(x%2) res=Add(res,A);
x/=2;
A=Add(A,A);
}
return res;
}
vec Formula(){
vec res=Ar();
if(s[p]=='+') p++,res=Add(res,Ar());
return res;
}
vec Ar(){
if(s[p]=='('){
p++;
vec res=Formula();
p++;
return res;
}
if('0'<=s[p]&&s[p]<='9'){
int num=0;
while('0'<=s[p]&&s[p]<='9') num=num*10+s[p]-'0',p++;
vec res=Ar();
return Power(res,num);
}
if('A'<=s[p]&&s[p]<='Z') return v[s[p++]-'A'];
}
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef vector<int> vec;
vec Add(vec,vec);
vec Power(vec,int);
vec Formula();
vec Ar();
vec v[27];
string s;
int n,p;
int main(){
int k,h,a;
char c;
cin>>n>>k;
while(k--){
cin>>c>>h;
for(int i=0;i<n;i++) v[c-'A'].push_back(i);
for(int i=0;i<h-1;i++)
for(int j=0;j<n-1;j++){
cin>>a;
if(a) swap(v[c-'A'][j],v[c-'A'][j+1]);
}
}
cin>>k;
while(k--){
cin>>s;
s+='$';
p=0;
vec ans=Formula();
for(int i=0;i<n;i++){
if(i) cout<<' ';
cout<<ans[i]+1;
}
cout<<endl;
}
return 0;
}
vec Add(vec A,vec B){
vec res=vec(n);
for(int i=0;i<n;i++) res[i]=A[B[i]];
return res;
}
vec Power(vec A,int x){
vec res;
for(int i=0;i<n;i++) res.push_back(i);
while(x){
if(x%2) res=Add(res,A);
x/=2;
A=Add(A,A);
}
return res;
}
vec Formula(){
vec res=Ar();
if(s[p]=='+') p++,res=Add(res,Ar());
return res;
}
vec Ar(){
if(s[p]=='('){
p++;
vec res=Formula();
p++;
return res;
}
if('0'<=s[p]&&s[p]<='9'){
int num=0;
while('0'<=s[p]&&s[p]<='9') num=num*10+s[p]-'0',p++;
vec res=Ar();
return Power(res,num);
}
if('A'<=s[p]&&s[p]<='Z') return v[s[p++]-'A'];
} | a.cc:93:5: error: redefinition of 'vec v [27]'
93 | vec v[27];
| ^
a.cc:12:5: note: 'vec v [27]' previously declared here
12 | vec v[27];
| ^
a.cc:94:8: error: redefinition of 'std::string s'
94 | string s;
| ^
a.cc:13:8: note: 'std::string s' previously declared here
13 | string s;
| ^
a.cc:95:5: error: redefinition of 'int n'
95 | int n,p;
| ^
a.cc:14:5: note: 'int n' previously declared here
14 | int n,p;
| ^
a.cc:95:7: error: redefinition of 'int p'
95 | int n,p;
| ^
a.cc:14:7: note: 'int p' previously declared here
14 | int n,p;
| ^
a.cc:97:5: error: redefinition of 'int main()'
97 | int main(){
| ^~~~
a.cc:16:5: note: 'int main()' previously defined here
16 | int main(){
| ^~~~
a.cc:125:5: error: redefinition of 'vec Add(vec, vec)'
125 | vec Add(vec A,vec B){
| ^~~
a.cc:44:5: note: 'vec Add(vec, vec)' previously defined here
44 | vec Add(vec A,vec B){
| ^~~
a.cc:131:5: error: redefinition of 'vec Power(vec, int)'
131 | vec Power(vec A,int x){
| ^~~~~
a.cc:50:5: note: 'vec Power(vec, int)' previously defined here
50 | vec Power(vec A,int x){
| ^~~~~
a.cc:142:5: error: redefinition of 'vec Formula()'
142 | vec Formula(){
| ^~~~~~~
a.cc:61:5: note: 'vec Formula()' previously defined here
61 | vec Formula(){
| ^~~~~~~
a.cc:148:5: error: redefinition of 'vec Ar()'
148 | vec Ar(){
| ^~
a.cc:67:5: note: 'vec Ar()' previously defined here
67 | vec Ar(){
| ^~
a.cc: In function 'vec Ar()':
a.cc:81:1: warning: control reaches end of non-void function [-Wreturn-type]
81 | }
| ^
a.cc: In function 'vec Ar()':
a.cc:162:1: warning: control reaches end of non-void function [-Wreturn-type]
162 | }
| ^
|
s301014497 | p00287 | C++ | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define lb lower_bound
#define all(v) (v).begin(), (v).end()
#define at(a, b) get<b>(a)
typedef pair<int, int> PR;
typedef tuple<int, int, int> TP;
const int INF = 1 << 28;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
struct UnionFind {
vector<int> parent;
UnionFind(int n){
parent.resize(n);
for (int i = 0; i < n; i++){
parent[i] = i;
}
}
int find(int x){
if (parent[x] == x) return x;
return parent[x] = find(parent[x]);
}
bool same(int x, int y){
return find(x) == find(y);
}
bool unite(int x, int y){
x = find(x);
y = find(y);
if (x == y) return false;
parent[x] = y;
}
};
int W, H, M, Q;
vector<int> px, py, qx, qy;
vector<int> sx, sy, gx, gy;
vector<int> xs, ys;
vector<vector<int> > grid;
vector<vector<int> > graph;
inline bool ok(int x, int y)
{
return x > 0 && y > 0 && x < W - 1 && y < H - 1;
}
inline int conv(int x, int y)
{
return x * H + y;
}
int solve(int s, int g)
{
vector<int> dist(graph.size(), INF);
dist[s] = 0;
queue<PR> que;
que.push(PR(s, 0));
while (que.size()){
PR pr = que.front(); que.pop();
int pos = pr.first;
int sum = pr.second;
if (dist[pos] < sum) continue;
if (pos == g) return sum;
for (int i = 0; i < graph[pos].size(); i++){
int to = graph[pos][i];
if (dist[to] <= sum + 1) continue;
dist[to] = sum + 1;
que.push(PR(to, sum + 1));
}
}
assert(0);
}
int main()
{
scanf("%d %d %d", &W, &H, &M);
px.resize(M);
py.resize(M);
qx.resize(M);
qy.resize(M);
px.pb(0);
py.pb(0);
qx.pb(W);
qy.pb(0);
px.pb(0);
py.pb(0);
qx.pb(0);
qy.pb(H);
px.pb(W);
py.pb(0);
qx.pb(W);
qy.pb(H);
px.pb(0);
py.pb(H);
qx.pb(W);
qy.pb(H);
for (int i = 0; i < M; i++){
scanf("%d %d %d %d", &px[i], &py[i], &qx[i], &qy[i]);
px[i] *= 2;
py[i] *= 2;
qx[i] *= 2;
qy[i] *= 2;
xs.pb(px[i] - 1);
xs.pb(px[i]);
xs.pb(px[i] + 1);
xs.pb(qx[i] - 1);
xs.pb(qx[i]);
xs.pb(qx[i] + 1);
ys.pb(py[i] - 1);
ys.pb(py[i]);
ys.pb(py[i] + 1);
ys.pb(qy[i] - 1);
ys.pb(qy[i]);
ys.pb(qy[i] + 1);
}
for (int i = M; i < qx.size(); i++){
px[i] *= 2;
py[i] *= 2;
qx[i] *= 2;
qy[i] *= 2;
xs.pb(px[i] - 1);
xs.pb(px[i]);
xs.pb(px[i] + 1);
xs.pb(qx[i] - 1);
xs.pb(qx[i]);
xs.pb(qx[i] + 1);
ys.pb(py[i] - 1);
ys.pb(py[i]);
ys.pb(py[i] + 1);
ys.pb(qy[i] - 1);
ys.pb(qy[i]);
ys.pb(qy[i] + 1);
}
M = qx.size();
scanf("%d", &Q);
sx.resize(Q);
sy.resize(Q);
gx.resize(Q);
gy.resize(Q);
for (int i = 0; i < Q; i++){
scanf("%d %d %d %d", &sx[i], &sy[i], &gx[i], &gy[i]);
sx[i] *= 2;
sy[i] *= 2;
gx[i] *= 2;
gy[i] *= 2;
xs.pb(sx[i] - 1);
xs.pb(sx[i]);
xs.pb(sx[i] + 1);
xs.pb(gx[i] - 1);
xs.pb(gx[i]);
xs.pb(gx[i] + 1);
ys.pb(sy[i] - 1);
ys.pb(sy[i]);
ys.pb(sy[i] + 1);
ys.pb(gy[i] - 1);
ys.pb(gy[i]);
ys.pb(gy[i] + 1);
}
sort(all(xs));
xs.erase(unique(all(xs)), xs.end());
sort(all(ys));
ys.erase(unique(all(ys)), ys.end());
W = xs.size();
H = ys.size();
for (int i = 0; i < M; i++){
px[i] = lb(all(xs), px[i]) - xs.begin();
py[i] = lb(all(ys), py[i]) - ys.begin();
qx[i] = lb(all(xs), qx[i]) - xs.begin();
qy[i] = lb(all(ys), qy[i]) - ys.begin();
}
for (int i = 0; i < Q; i++){
sx[i] = lb(all(xs), sx[i]) - xs.begin();
sy[i] = lb(all(ys), sy[i]) - ys.begin();
gx[i] = lb(all(xs), gx[i]) - xs.begin();
gy[i] = lb(all(ys), gy[i]) - ys.begin();
}
grid = vector<vector<int> >(W, vector<int>(H, 0));
for (int i = 0; i < M; i++){
for (int x = px[i]; x <= qx[i]; x++){
for (int y = py[i]; y <= qy[i]; y++){
grid[x][y] = 1;
}
}
}
UnionFind uf(W * H);
graph = vector<vector<int> >(W * H, vector<int>());
for (int x = 0; x < W; x++){
for (int y = 0; y < H; y++){
if (!ok(x, y)) continue;
int nx, ny;
nx = x + 1;
ny = y;
if (ok(nx, ny) && !grid[x][y] && !grid[nx][ny]){
uf.unite(conv(x, y), conv(nx, ny));
}
nx = x;
ny = y + 1;
if (ok(nx, ny) && !grid[x][y] && !grid[nx][ny]){
uf.unite(conv(x, y), conv(nx, ny));
}
}
}
for (int x = 0; x < W; x++){
for (int y = 0; y < H; y++){
if (!grid[x][y]) continue;
if (!ok(x, y)) continue;
int lx, ly, rx, ry, l, r;
lx = x - 1;
ly = y;
rx = x + 1;
ry = y;
if (
ok(lx, ly) &&
ok(rx, ry) &&
!grid[lx][ly] &&
!grid[rx][ry] &&
){
l = uf.find(conv(lx, ly));
r = uf.find(conv(rx, ry));
if (!uf.same(l, r)){
graph[l].pb(r);
graph[r].pb(l);
}
}
lx = x;
ly = y - 1;
rx = x;
ry = y + 1;
if (
ok(lx, ly) &&
ok(rx, ry) &&
!grid[lx][ly] &&
!grid[rx][ry] &&
){
l = uf.find(conv(lx, ly));
r = uf.find(conv(rx, ry));
if (!uf.same(l, r)){
graph[l].pb(r);
graph[r].pb(l);
}
}
}
}
/*for (int i = 0; i < graph.size(); i++){
for (int v : graph[i]){
printf("%d ", v);
}
if (graph[i].size()) puts("");
}*/
/*for (int i = 0; i < W; i++){
for (int j = 0; j < H; j++){
printf("%d", grid[i][j]);
}
puts("");
}*/
for (int i = 0; i < Q; i++){
int s = uf.find(conv(sx[i], sy[i]));
int g = uf.find(conv(gx[i], gy[i]));
printf("%d\n", solve(s, g));
}
} | a.cc: In function 'int main()':
a.cc:231:25: error: expected primary-expression before ')' token
231 | ){
| ^
a.cc:248:25: error: expected primary-expression before ')' token
248 | ){
| ^
a.cc: In member function 'bool UnionFind::unite(int, int)':
a.cc:36:27: warning: control reaches end of non-void function [-Wreturn-type]
36 | parent[x] = y;
|
s982232900 | p00287 | C++ | #include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <deque>
#include <tuple>
using namespace std;
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())
typedef pair<int, int> Pii;
void compress(vector<int>& v) {
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
}
int w, h;
typedef pair<Pii, int> P;
vector<P> e[350][350];
int cost[350][350];
int solve(Pii s, Pii g) {
memset(cost, 0x1f, sizeof(cost));
deque<Pii> deq;
deq.push_back(s);
cost[s.first][s.second] = 0;
while (!deq.empty()) {
Pii cur = deq.front(); deq.pop_front();
if (cur == g)
return cost[g.first][g.second];
for (auto to : e[cur.first][cur.second]) {
int nf, ns;
tie(nf, ns) = to.first;
int ncost = cost[cur.first][cur.second] + to.second;
if (ncost < cost[nf][ns]) {
cost[nf][ns] = ncost;
if (to.second == 0) {
deq.push_front(Pii(nf, ns));
} else {
deq.push_back(Pii(nf, ns));
}
}
}
}
return -1;
}
int main() {
int m; cin >> w >> h >> m;
vector<int> cx, cy;
cx.push_back(0);
cx.push_back(1);
cx.push_back(w - 1);
cx.push_back(w);
cy.push_back(0);
cy.push_back(1);
cy.push_back(h - 1);
cy.push_back(h);
vector < pair<Pii, Pii>> seg;
FOR(i, m) {
int pa, pb, qa, qb;
cin >> pa >> pb >> qa >> qb;
seg.emplace_back(Pii(pa, pb), Pii(qa, qb));
if (pa > qa || pb > qb) swap(seg.back().first, seg.back().second);
if(pa - 1 >= 0) cx.push_back(pa - 1);
cx.push_back(pa);
if (pa + 1 <= w) cx.push_back(pa + 1);
if (qa - 1 >= 0) cx.push_back(qa - 1);
cx.push_back(qa);
if (qa + 1 <= w) cx.push_back(qa + 1);
if (pb - 1 >= 0) cy.push_back(pb - 1);
cy.push_back(pb);
if (pb + 1 <= h) cy.push_back(pb + 1);
if (qb - 1 >= 0) cy.push_back(qb - 1);
cy.push_back(qb);
if (qb + 1 <= h) cy.push_back(qb + 1);
}
compress(cx); compress(cy);
auto co = [&cx, &cy](Pii xy) {
int a = lower_bound(cx.begin(), cx.end(), xy.first) - cx.begin();
int b = lower_bound(cy.begin(), cy.end(), xy.second) - cy.begin();
return Pii(a, b);
};
tie(w, h) = co(Pii(w, h));
FOR(i, m) {
seg[i].first = co(seg[i].first);
seg[i].second = co(seg[i].second);
}
FOR(x, sz(cx) - 2) FOR(y, sz(cy) - 1) {
int nx = x + 1, ny = y;
int c = 0;
for (auto& s : seg) {
if (s.first.first != nx) continue;
if (s.second.first != nx) continue;
if (s.first.second <= y && y < s.second.second) c = 1;
}
e[x][y].push_back(P(Pii(nx, ny), c));
e[nx][ny].push_back(P(Pii(x, y), c));
}
FOR(x, sz(cx) - 1) FOR(y, sz(cy) - 2) {
int nx = x , ny = y + 1;
int c = 0;
for (auto& s : seg) {
if (s.first.second != ny) continue;
if (s.second.second != ny) continue;
if (s.first.first <= x && x < s.second.first) c = 1;
}
e[x][y].push_back(P(Pii(nx, ny), c));
e[nx][ny].push_back(P(Pii(x, y), c));
}
int q; cin >> q;
FOR(i, q) {
int a, b, c, d; cin >> a >> b >> c >> d;
Pii s(a, b), g(c, d);
s = co(s); s.first--; s.second--;
g = co(g); g.first--; g.second--;
int ans = solve(s, g);
cout << ans << endl;
}
} | a.cc: In function 'int solve(Pii, Pii)':
a.cc:27:9: error: 'memset' was not declared in this scope
27 | memset(cost, 0x1f, sizeof(cost));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <deque>
+++ |+#include <cstring>
7 | #include <tuple>
|
s455666219 | p00287 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef pair<long long,long long>P;
long long w,h,m;
long long dotti=0;
vector<long long> xv,yv;
int masu[501][501]={0};
long long X1[105],X2[105],Y1[105],Y2[105];
long long dx[4]={0,1,0,-1};
long long dy[4]={1,0,-1,0};
long long check[501][501]={0};
vector<long long> node[505];
queue<P> que;
long long compress(long long *x1,long long *x2,long long w);
main(){
cin>>w>>h>>m;
w*=2;
h*=2;
for(int i=0;i<m;i++){
cin>>X1[i]>>Y1[i]>>X2[i]>>Y2[i];
X1[i]*=2;
X2[i]*=2;
Y1[i]*=2;
Y2[i]*=2;
}
w=compress(X1,X2,w);
dotti=1;
h=compress(Y1,Y2,h);
for(int i=0;i<m;i++){
for(long long y=Y1[i];y<=Y2[i];y++){
for(long long x=X1[i];x<=X2[i];x++){
if(y<500&&x<500&&y>=0&&x>=0){
masu[y][x]=-1;
}
}
}
}
long long now=0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(masu[i][j]==0){
now++;
que.push(P(i,j));
while(!que.empty()){
int nowy=que.front().first;
int nowx=que.front().second;
que.pop();
masu[nowy][nowx]=now;
for(int k=0;k<4;k++){
long long nx=nowx+dx[k];
long long ny=nowy+dy[k];
if(ny>=0&&ny<h&&nx>=0&&nx<w&&masu[ny][nx]==0){
que.push(P(ny,nx));
}
}
}
}
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
long long me=masu[i][j];
for(int k=0;k<4;k++){
long long ny=i+dy[k]*2;
long long nx=j+dx[k]*2;
if(ny>=0&&ny<h&&nx>=0&&nx<w){
long long to=masu[ny][nx];
if(me!=-1&&to!=-1&&me!=to&&check[me][to]==0){
node[me].push_back(to);
node[to].push_back(me);
check[me][to]=1;
check[to][me]=1;
}
}
}
}
}
long long e;
long long mincost[505];
cin>>e;
if(m==0){
for(int i=0;i<e;i++){
cin>>sx>>sy>>gx>>gy;
cout<<0<<endl;
}
}
else{
for(int i=0;i<e;i++){
long long s,g;
long long sx,sy,gx,gy;
cin>>sx>>sy>>gx>>gy;
sx*=2;
sx++;
sy*=2;
sy++;
gx*=2;
gx++;
gy*=2;
gy++;
long long sxp,syp,gxp,gyp;
sxp=upper_bound(xv.begin(),xv.end(),sx)-xv.begin()-1;
syp=upper_bound(yv.begin(),yv.end(),sy)-yv.begin()-1;
gxp=upper_bound(xv.begin(),xv.end(),gx)-xv.begin()-1;
gyp=upper_bound(yv.begin(),yv.end(),gy)-yv.begin()-1;
if(sxp>=0&&syp>=0&&gxp>=0&&gyp>=0&&sxp<w&&gxp<w&&syp<h&&gyp<h){
s=masu[syp][sxp];
g=masu[gyp][gxp];
if(s==-1||g==-1) break;
for(int j=1;j<=now;j++){
mincost[j]=(1LL<<60);
}
priority_queue<P,vector<P>,greater<P> >que;
que.push(P(0,s));
while(!que.empty()){
long long nowc=que.top().first;
long long nowp=que.top().second;
que.pop();
if(nowp==g){
cout<<nowc<<endl;
break;
}
for(int j=0;j<node[nowp].size();j++){
long long nextp=node[nowp][j];
if(mincost[nextp]>nowc+1){
mincost[nextp]=nowc+1;
que.push(P(nowc+1,nextp));
}
}
}
}
}
}
}
long long compress(long long *x1,long long *x2,long long W){
vector<long long> xs;
for(int i=0;i<m;i++){
for(long long d=-1;d<=1;d++){
long long tx1=x1[i]+d,tx2=x2[i]+d;
if(0<=tx1&&tx1<=W) xs.push_back(tx1);
if(0<=tx2&&tx2<=W) xs.push_back(tx2);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i=0;i<m;i++){
x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
}
if(dotti==0) xv=xs;
else yv=xs;
return xs.size();
} | a.cc:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
15 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:83:12: error: 'sx' was not declared in this scope; did you mean 'dx'?
83 | cin>>sx>>sy>>gx>>gy;
| ^~
| dx
a.cc:83:16: error: 'sy' was not declared in this scope; did you mean 'dy'?
83 | cin>>sx>>sy>>gx>>gy;
| ^~
| dy
a.cc:83:20: error: 'gx' was not declared in this scope; did you mean 'dx'?
83 | cin>>sx>>sy>>gx>>gy;
| ^~
| dx
a.cc:83:24: error: 'gy' was not declared in this scope; did you mean 'dy'?
83 | cin>>sx>>sy>>gx>>gy;
| ^~
| dy
|
s171685775 | p00287 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef pair<long long,long long>P;
long long w,h,m;
long long dotti=0;
vector<long long> xv,yv;
int masu[501][501]={0};
long long X1[105],X2[105],Y1[105],Y2[105];
long long dx[4]={0,1,0,-1};
long long dy[4]={1,0,-1,0};
long long check[501][501]={0};
vector<long long> node[505];
queue<P> que;
long long compress(long long *x1,long long *x2,long long w);
main(){
cin>>w>>h>>m;
w*=2;
h*=2;
for(int i=0;i<m;i++){
cin>>X1[i]>>Y1[i]>>X2[i]>>Y2[i];
X1[i]*=2;
X2[i]*=2;
Y1[i]*=2;
Y2[i]*=2;
}
w=compress(X1,X2,w);
dotti=1;
h=compress(Y1,Y2,h);
for(int i=0;i<m;i++){
for(long long y=Y1[i];y<=Y2[i];y++){
for(long long x=X1[i];x<=X2[i];x++){
if(y<500&&x<500&&y>=0&&x>=0){
masu[y][x]=-1;
}
}
}
}
long long now=0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(masu[i][j]==0){
now++;
que.push(P(i,j));
while(!que.empty()){
int nowy=que.front().first;
int nowx=que.front().second;
que.pop();
masu[nowy][nowx]=now;
for(int k=0;k<4;k++){
long long nx=nowx+dx[k];
long long ny=nowy+dy[k];
if(ny>=0&&ny<h&&nx>=0&&nx<w&&masu[ny][nx]==0){
que.push(P(ny,nx));
}
}
}
}
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
long long me=masu[i][j];
for(int k=0;k<4;k++){
long long ny=i+dy[k]*2;
long long nx=j+dx[k]*2;
if(ny>=0&&ny<h&&nx>=0&&nx<w){
long long to=masu[ny][nx];
if(me!=-1&&to!=-1&&me!=to&&check[me][to]==0){
node[me].push_back(to);
node[to].push_back(me);
check[me][to]=1;
check[to][me]=1;
}
}
}
}
}
long long e;
long long mincost[505];
long long sx,sy,gx,gy;
cin>>e;
if(m==0){
for(int i=0;i<e;i++){
cin>>sx>>sy>>gx>>gy;
cout<<0<<endl;
}
}
else{
for(int i=0;i<e;i++){
long long s,g;
cin>>sx>>sy>>gx>>gy;
sx*=2;
//sx++;
sy*=2;
//sy++;
gx*=2;
//gx++;
gy*=2;
//gy++;
long long sxp,syp,gxp,gyp;
sxp=max(0,upper_bound(xv.begin(),xv.end(),sx)-xv.begin()-1);
syp=max(0,upper_bound(yv.begin(),yv.end(),sy)-yv.begin()-1);
gxp=max(0,upper_bound(xv.begin(),xv.end(),gx)-xv.begin()-1);
gyp=max(0,upper_bound(yv.begin(),yv.end(),gy)-yv.begin()-1);
if(sxp>=0&&syp>=0&&gxp>=0&&gyp>=0&&sxp<w&&gxp<w&&syp<h&&gyp<h){
s=masu[syp][sxp];
g=masu[gyp][gxp];
if(s==-1||g==-1) break;
for(int j=1;j<=now;j++){
mincost[j]=(1LL<<60);
}
priority_queue<P,vector<P>,greater<P> >que;
que.push(P(0,s));
while(!que.empty()){
long long nowc=que.top().first;
long long nowp=que.top().second;
que.pop();
if(nowp==g){
cout<<nowc<<endl;
break;
}
for(int j=0;j<node[nowp].size();j++){
long long nextp=node[nowp][j];
if(mincost[nextp]>nowc+1){
mincost[nextp]=nowc+1;
que.push(P(nowc+1,nextp));
}
}
}
}
else{
cout<<sxp<<" "<<syp<<" "<<gxp<<" "<<gyp<<endl;
}
}
}
}
long long compress(long long *x1,long long *x2,long long W){
vector<long long> xs;
for(int i=0;i<m;i++){
for(long long d=-1;d<=1;d++){
long long tx1=x1[i]+d,tx2=x2[i]+d;
if(0<=tx1&&tx1<W) xs.push_back(tx1);
if(0<=tx2&&tx2<W) xs.push_back(tx2);
}
}
sort(xs.begin(),xs.end());
xs.erase(unique(xs.begin(),xs.end()),xs.end());
for(int i=0;i<m;i++){
x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
}
if(dotti==0) xv=xs;
else yv=xs;
return xs.size();
} | a.cc:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
15 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:101:14: error: no matching function for call to 'max(int, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)'
101 | sxp=max(0,upper_bound(xv.begin(),xv.end(),sx)-xv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:101:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type' {aka 'long int'})
101 | sxp=max(0,upper_bound(xv.begin(),xv.end(),sx)-xv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:101:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
101 | sxp=max(0,upper_bound(xv.begin(),xv.end(),sx)-xv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:102:14: error: no matching function for call to 'max(int, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)'
102 | syp=max(0,upper_bound(yv.begin(),yv.end(),sy)-yv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:102:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type' {aka 'long int'})
102 | syp=max(0,upper_bound(yv.begin(),yv.end(),sy)-yv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:102:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
102 | syp=max(0,upper_bound(yv.begin(),yv.end(),sy)-yv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:103:14: error: no matching function for call to 'max(int, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)'
103 | gxp=max(0,upper_bound(xv.begin(),xv.end(),gx)-xv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:103:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type' {aka 'long int'})
103 | gxp=max(0,upper_bound(xv.begin(),xv.end(),gx)-xv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:103:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
103 | gxp=max(0,upper_bound(xv.begin(),xv.end(),gx)-xv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:104:14: error: no matching function for call to 'max(int, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)'
104 | gyp=max(0,upper_bound(yv.begin(),yv.end(),gy)-yv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:104:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type' {aka 'long int'})
104 | gyp=max(0,upper_bound(yv.begin(),yv.end(),gy)-yv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:104:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
104 | gyp=max(0,upper_bound(yv.begin(),yv.end(),gy)-yv.begin()-1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s028237723 | p00287 | C++ | #include<bits/stdc++.h>
#define f first
#define s second
#define mk make_pair
#define P pair<int,int>
using namespace std;
int w,h,m,sx,sy,gx,gy;
vector<pair<P,P> >v;
vector<int>ax,ay;
map<int,int>mx,my;
map<P,int>qx,qy;
int a[401][401],ppp;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int ddx[]={2,0,0,-2};
int ddy[]={0,2,-2,0};
vector<int>g[405];
bool used[605]605];
void Grip(){
mx[0]=0;my[0]=0;
int pre=0;
for(int i=1;i<ax.size();i++){
int pp=ax[i];
ax[i]=ax[i-1]+3;
qx[mk(pre,pp)]=ax[i]-1;
mx[pp]=ax[i];
pre=pp;
}
pre=0;
for(int i=1;i<ay.size();i++){
int pp=ay[i];
ay[i]=ay[i-1]+3;
qy[mk(pre,pp)]=ay[i]-1;
my[pp]=ay[i];
pre=pp;
}
h=ay[ay.size()-1];
w=ax[ax.size()-1];
}
void mapmaker(){
for(int i=0;i<v.size();i++){
int sx=mx[v[i].f.f],sy=my[v[i].f.s];
int gx=mx[v[i].s.f],gy=my[v[i].s.s];
for(int j=sx;j<=gx;j++)
for(int k=sy;k<=gy;k++)
a[k][j]=-1;
}
for(int i=0;i<=w;i++)a[h][i]=a[0][i]=-1;
for(int i=0;i<=h;i++)a[i][0]=a[i][w]=-1;
}
void fullfill(int y,int x,int d){
a[y][x]=d;
for(int i=0;i<4;i++){
int rx=x+dx[i],ry=y+dy[i];
if(rx>=0&&ry>=0&&rx<=w&&ry<=h)
if(!a[ry][rx])fullfill(ry,rx,d);
}
}
void graphmaker(int y,int x){
used[y][x]=1;
for(int i=0;i<4;i++){
int rx=x+ddx[i],ry=y+ddy[i];
if(rx>=0&&ry>=0&&rx<=w&&ry<=h)
if(a[ry][rx]!=a[y][x])
g[a[y][x]].push_back(a[ry][rx]);
}
for(int i=0;i<4;i++){
int rx=x+dx[i],ry=y+dy[i];
if(rx>=0&&ry>=0&&rx<=h&&ry<=w)
if(!a[ry][rx])graphmaker(ry,rx);
}
}
int main(){
cin>>w>>h>>m;
memset(a,0,sizeof(a));
ax.clear();ay.clear();v.clear();
mx.clear();my.clear();
qx.clear();qy.clear();
ax.push_back(w*2);ax.push_back(0);
ay.push_back(h*2);ay.push_back(0);
for(int i=0;i<405;i++)g[i].clear();
for(int i=0;i<m;i++){
cin>>sx>>sy>>gx>>gy;
v.push_back(mk(mk(sx*2,sy*2),mk(gx*2,gy*2)));
ax.push_back(sx*2);ax.push_back(gx*2);
ay.push_back(sy*2);ay.push_back(gy*2);
}
sort(ax.begin(),ax.end());
sort(ay.begin(),ay.end());
ax.erase(unique(ax.begin(),ax.end()),ax.end());
ay.erase(unique(ay.begin(),ay.end()),ay.end());
Grip();
mapmaker();
// fullfill(490,490,-1);
int cc=1;
for(int i=0;i<=h;i++)
for(int j=0;j<=w;j++){
if(!a[i][j])fullfill(i,j,cc++);
}
memset(used,0,sizeof(used));
for(int i=0;i<h;i++)
for(int j=0;j<w;j++)
if(0<a[i][j]&&!used[i][j])
graphmaker(i,j);
for(int i=0;i<405;i++)
if(g[i].size())
g[i].erase(unique(g[i].begin(),g[i].end()),g[i].end());
cin>>m;
while(m--){
cin>>sx>>sy>>gx>>gy;sx*=2;sy*=2;gx*=2;gy*=2;
for(map<P,int>::iterator it=qx.begin();it!=qx.end();it++)
if((*it).f.f<sx&&(*it).f.s>=sx){sx=(*it).s;break;}
for(map<P,int>::iterator it=qx.begin();it!=qx.end();it++)
if((*it).f.f<gx&&(*it).f.s>=gx){gx=(*it).s;break;}
for(map<P,int>::iterator it=qy.begin();it!=qy.end();it++)
if((*it).f.f<sy&&(*it).f.s>=sy){sy=(*it).s;break;}
for(map<P,int>::iterator it=qy.begin();it!=qy.end();it++)
if((*it).f.f<gy&&(*it).f.s>=gy){gy=(*it).s;break;}
int so=a[sy][sx],go=a[gy][gx];
int use[100]={};
use[so]=1;
queue<pair<int,int> >q;
q.push(mk(so,0));
while(!q.empty()){
P u=q.front();q.pop();
if(u.f==go){
cout<<u.s<<endl;
goto L;
}
for(int i=0;i<g[u.f].size();i++)
if(!use[g[u.f][i]]){
use[g[u.f][i]]=1;
q.push(mk(g[u.f][i],u.s+1));
}
}L:;
}
} | a.cc:18:15: error: expected initializer before numeric constant
18 | bool used[605]605];
| ^~~
a.cc: In function 'void graphmaker(int, int)':
a.cc:60:3: error: 'used' was not declared in this scope
60 | used[y][x]=1;
| ^~~~
a.cc: In function 'int main()':
a.cc:100:12: error: 'used' was not declared in this scope
100 | memset(used,0,sizeof(used));
| ^~~~
|
s658021261 | p00287 | C++ | #include<bits/stdc++.h>
#define f first
#define s second
#define mk make_pair
#define P pair<int,int>
using namespace std;
int w,h,m,sx,sy,gx,gy;
vector<pair<P,P> >v;
vector<int>ax,ay;
map<int,int>mx,my;
map<P,int>qx,qy;
int a[1001][1001],ppp;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int ddx[]={2,0,0,-2};
int ddy[]={0,2,-2,0};
vector<int>g[405];
bool used[1005][1005];
void Grip(){
mx[0]=0;my[0]=0;
int pre=0;
for(int i=1;i<ax.size();i++){
int pp=ax[i];
ax[i]=ax[i-1]+2;
qx[mk(pre,pp)]=ax[I]-1;
mx[pp]=ax[i];
pre=pp;
}
pre=0;
for(int i=1;i<ay.size();i++){
int pp=ay[i];
ay[i]=ay[i-1]+2;
qy[mk(pre,pp)]=ay[I]-1;
my[pp]=ay[i];
pre=pp;
}
h=ay[ay.size()-1];
w=ax[ax.size()-1];
}
void mapmaker(){
for(int i=0;i<v.size();i++){
int sx=mx[v[i].f.f],sy=my[v[i].f.s];
int gx=mx[v[i].s.f],gy=my[v[i].s.s];
for(int j=sx;j<=gx;j++)
for(int k=sy;k<=gy;k++)
a[k][j]=-1;
}
for(int i=0;i<=w;i++)a[h][i]=a[0][i]=-1;
for(int i=0;i<=h;i++)a[i][0]=a[i][w]=-1;
}
void fullfill(int y,int x,int d){
a[y][x]=d;
for(int i=0;i<4;i++){
int rx=x+dx[i],ry=y+dy[i];
if(rx>=0&&ry>=0&&rx<=w&&ry<=h)
if(!a[ry][rx])fullfill(ry,rx,d);
}
}
void graphmaker(int y,int x){
used[y][x]=1;
for(int i=0;i<4;i++){
int rx=x+ddx[i],ry=y+ddy[i];
if(rx>=0&&ry>=0&&rx<=w&&ry<=h)
if(a[ry][rx]!=a[y][x]&&a[ry][rx]>0)
g[a[y][x]].push_back(a[ry][rx]);
}
for(int i=0;i<4;i++){
int rx=x+dx[i],ry=y+dy[i];
if(rx>=0&&ry>=0&&rx<=h&&ry<=w)
if(!a[ry][rx]&&used[ry][rx]==0)graphmaker(ry,rx);
}
}
int main(){
cin>>w>>h>>m;
memset(a,0,sizeof(a));
ax.clear();ay.clear();v.clear();
mx.clear();my.clear();
qx.clear();qy.clear();
ax.push_back(w*2);ax.push_back(0);
ay.push_back(h*2);ay.push_back(0);
for(int i=0;i<405;i++)g[i].clear();
for(int i=0;i<m;i++){
cin>>sx>>sy>>gx>>gy;
v.push_back(mk(mk(sx*2,sy*2),mk(gx*2,gy*2)));
ax.push_back(sx*2);ax.push_back(gx*2);
ay.push_back(sy*2);ay.push_back(gy*2);
}
sort(ax.begin(),ax.end());
sort(ay.begin(),ay.end());
ax.erase(unique(ax.begin(),ax.end()),ax.end());
ay.erase(unique(ay.begin(),ay.end()),ay.end());
Grip();
mapmaker();
// fullfill(490,490,-1);
int cc=1;
for(int i=0;i<=h;i++)
for(int j=0;j<=w;j++){
if(!a[i][j])fullfill(i,j,cc++);
}
memset(used,0,sizeof(used));
for(int i=0;i<h;i++)
for(int j=0;j<w;j++)
if(0<a[i][j]&&!used[i][j])
graphmaker(i,j);
for(int i=0;i<405;i++)
if(g[i].size())
g[i].erase(unique(g[i].begin(),g[i].end()),g[i].end());
cin>>m;
while(m--){
cin>>sx>>sy>>gx>>gy;sx*=2;sy*=2;gx*=2;gy*=2;
for(map<P,int>::iterator it=qx.begin();it!=qx.end();it++)
if((*it).f.f<sx&&(*it).f.s>=sx){sx=(*it).s;break;}
for(map<P,int>::iterator it=qx.begin();it!=qx.end();it++)
if((*it).f.f<gx&&(*it).f.s>=gx){gx=(*it).s;break;}
for(map<P,int>::iterator it=qy.begin();it!=qy.end();it++)
if((*it).f.f<sy&&(*it).f.s>=sy){sy=(*it).s;break;}
for(map<P,int>::iterator it=qy.begin();it!=qy.end();it++)
if((*it).f.f<gy&&(*it).f.s>=gy){gy=(*it).s;break;}
if(a[sy][sx]<0){
if(a[sy+1][sx]>0)sy++;
else if(a[sy][sx+1]>0)sx++;
else sy++,sx++;
}
if(a[gy][gx]<0){
if(a[gy+1][gx]>0)gy++;
else if(a[gy][gx+1]<0)gxx++;
else gy++,gx++;
}
int so=a[sy][sx],go=a[gy][gx];
int use[100]={};
use[so]=1;
queue<pair<int,int> >q;
q.push(mk(so,0));
while(!q.empty()){
P u=q.front();q.pop();
if(u.f==go){
cout<<u.s<<endl;
goto L;
}
for(int i=0;i<g[u.f].size();i++)
if(!use[g[u.f][i]]){
use[g[u.f][i]]=1;
q.push(mk(g[u.f][i],u.s+1));
}
}L:;
}
} | a.cc: In function 'void Grip()':
a.cc:25:23: error: 'I' was not declared in this scope
25 | qx[mk(pre,pp)]=ax[I]-1;
| ^
a.cc:33:23: error: 'I' was not declared in this scope
33 | qy[mk(pre,pp)]=ay[I]-1;
| ^
a.cc: In function 'int main()':
a.cc:126:23: error: 'gxx' was not declared in this scope; did you mean 'gx'?
126 | else if(a[gy][gx+1]<0)gxx++;
| ^~~
| gx
|
s600733248 | p00287 | C++ | #include<bits/stdc++.h>
#define f first
#define s second
#define mk make_pair
#define P pair<int,int>
using namespace std;
int w,h,m,sx,sy,gx,gy;
vector<pair<P,P> >v;
vector<int>ax,ay;
map<int,int>mx,my;
map<P,int>qx,qy;
int a[1001][1001],ppp;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int ddx[]={2,0,0,-2};
int ddy[]={0,2,-2,0};
vector<int>g[405];
bool used[1005][1005];
void Grip(){
mx[0]=0;my[0]=0;
int pre=0;
for(int i=1;i<ax.size();i++){
int pp=ax[i];
ax[i]=ax[i-1]+2;
qx[mk(pre,pp)]=ax[i]-1;
mx[pp]=ax[i];
pre=pp;
}
pre=0;
for(int i=1;i<ay.size();i++){
int pp=ay[i];
ay[i]=ay[i-1]+2;
qy[mk(pre,pp)]=ay[i]-1;
my[pp]=ay[i];
pre=pp;
}
h=ay[ay.size()-1];
w=ax[ax.size()-1];
}
void mapmaker(){
for(int i=0;i<v.size();i++){
int sx=mx[v[i].f.f],sy=my[v[i].f.s];
int gx=mx[v[i].s.f],gy=my[v[i].s.s];
for(int j=sx;j<=gx;j++)
for(int k=sy;k<=gy;k++)
a[k][j]=-1;
}
for(int i=0;i<=w;i++)a[h][i]=a[0][i]=-1;
for(int i=0;i<=h;i++)a[i][0]=a[i][w]=-1;
}
void fullfill(int y,int x,int d){
a[y][x]=d;
for(int i=0;i<4;i++){
int rx=x+dx[i],ry=y+dy[i];
if(rx>=0&&ry>=0&&rx<=w&&ry<=h)
if(!a[ry][rx])fullfill(ry,rx,d);
}
}
void graphmaker(int y,int x){
used[y][x]=1;
for(int i=0;i<4;i++){
int rx=x+ddx[i],ry=y+ddy[i];
if(rx>=0&&ry>=0&&rx<=w&&ry<=h)
if(a[ry][rx]!=a[y][x]&&a[ry][rx]>0)
g[a[y][x]].push_back(a[ry][rx]);
}
for(int i=0;i<4;i++){
int rx=x+dx[i],ry=y+dy[i];
if(rx>=0&&ry>=0&&rx<=h&&ry<=w)
if(!a[ry][rx]&&used[ry][rx]==0)graphmaker(ry,rx);
}
}
int main(){
cin>>w>>h>>m;
memset(a,0,sizeof(a));
ax.clear();ay.clear();v.clear();
mx.clear();my.clear();
qx.clear();qy.clear();
ax.push_back(w*2);ax.push_back(0);
ay.push_back(h*2);ay.push_back(0);
for(int i=0;i<405;i++)g[i].clear();
for(int i=0;i<m;i++){
cin>>sx>>sy>>gx>>gy;
v.push_back(mk(mk(sx*2,sy*2),mk(gx*2,gy*2)));
ax.push_back(sx*2);ax.push_back(gx*2);
ay.push_back(sy*2);ay.push_back(gy*2);
}
sort(ax.begin(),ax.end());
sort(ay.begin(),ay.end());
ax.erase(unique(ax.begin(),ax.end()),ax.end());
ay.erase(unique(ay.begin(),ay.end()),ay.end());
Grip();
mapmaker();
// fullfill(490,490,-1);
int cc=1;
for(int i=0;i<=h;i++)
for(int j=0;j<=w;j++){
if(!a[i][j])fullfill(i,j,cc++);
}
memset(used,0,sizeof(used));
for(int i=0;i<h;i++)
for(int j=0;j<w;j++)
if(0<a[i][j]&&!used[i][j])
graphmaker(i,j);
for(int i=0;i<405;i++)
if(g[i].size())
g[i].erase(unique(g[i].begin(),g[i].end()),g[i].end());
cin>>m;
while(m--){
cin>>sx>>sy>>gx>>gy;sx*=2;sy*=2;gx*=2;gy*=2;
for(map<P,int>::iterator it=qx.begin();it!=qx.end();it++)
if((*it).f.f<sx&&(*it).f.s>=sx){sx=(*it).s;break;}
for(map<P,int>::iterator it=qx.begin();it!=qx.end();it++)
if((*it).f.f<gx&&(*it).f.s>=gx){gx=(*it).s;break;}
for(map<P,int>::iterator it=qy.begin();it!=qy.end();it++)
if((*it).f.f<sy&&(*it).f.s>=sy){sy=(*it).s;break;}
for(map<P,int>::iterator it=qy.begin();it!=qy.end();it++)
if((*it).f.f<gy&&(*it).f.s>=gy){gy=(*it).s;break;}
if(a[sy][sx]<0){
if(a[sy+1][sx]>0)sy++;
else if(a[sy][sx+1]>0)sx++;
else sy++,sx++;
}
if(a[gy][gx]<0){
if(a[gy+1][gx]>0)gy++;
else if(a[gy][gx+1]<0)gxx++;
else gy++,gx++;
}
int so=a[sy][sx],go=a[gy][gx];
int use[100]={};
use[so]=1;
queue<pair<int,int> >q;
q.push(mk(so,0));
while(!q.empty()){
P u=q.front();q.pop();
if(u.f==go){
cout<<u.s<<endl;
goto L;
}
for(int i=0;i<g[u.f].size();i++)
if(!use[g[u.f][i]]){
use[g[u.f][i]]=1;
q.push(mk(g[u.f][i],u.s+1));
}
}L:;
}
} | a.cc: In function 'int main()':
a.cc:126:23: error: 'gxx' was not declared in this scope; did you mean 'gx'?
126 | else if(a[gy][gx+1]<0)gxx++;
| ^~~
| gx
|
s082195237 | p00288 | C++ | #include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <deque>
#include <tuple>
#include <cstring>
#include <functional>
#include <queue>
using namespace std;
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())
typedef pair<int, int> Pii;
using namespace std;
struct Edge {
int cap;
int to;
int rev;
Edge() {}
Edge(int c, int t, int r) : cap(c), to(t), rev(r) {}
};
struct CostEdge : public Edge {
int cost;
CostEdge() : Edge() {}
CostEdge(int c, int t, int cs, int r) :
Edge(c, t, r), cost(cs) {
}
};
template<class E>
class Graph {
public:
typedef std::vector<std::vector<E> > G;
private:
G g;
public:
Graph(int n) : g(G(n)) {}
void addEdge(int from, int to, int cap, int cost) {
g[from].push_back(E(cap, to, cost, g[to].size()));
g[to].push_back(E(0, from, -cost, g[from].size() - 1));
}
G &getRowGraph() {
return g;
}
};
template<class E>
int minCostFlow(Graph<E> &graph, int s, int t, int f, bool negative = false) {
typedef pair<int, int> P;
typename Graph<E>::G &g = graph.getRowGraph();
int n = g.size();
int res = 0;
vector<int> h(n, 0);
vector<int> prevv(n);
vector<int> preve(n);
const int inf = 10000000;
int eps = 1e-9;
while (f > 0) {
priority_queue<P, vector<P>, greater<P> > que;
vector<int> dist(n, inf);
dist[s] = 0;
que.push(P(0, s));
while (!que.empty()) {
P p = que.top(); que.pop();
int v = p.second;
if (dist[v] < p.first - eps) continue;
for (int i = 0; i < (int)g[v].size(); i++) {
E &e = g[v][i];
if (e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to] + eps) {
dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
prevv[e.to] = v;
preve[e.to] = i;
que.push(P(dist[e.to], e.to));
}
}
}
if (dist[t] == inf) return -1;
for (int v = 0; v < n; v++) h[v] += dist[v];
int d = f;
for (int v = t; v != s; v = prevv[v]) {
d = min(d, g[prevv[v]][preve[v]].cap);
}
f -= d;
res += d * h[t];
for (int v = t; v != s; v = prevv[v]) {
E &e = g[prevv[v]][preve[v]];
e.cap -= d;
g[v][e.rev].cap += d;
}
//cout << f << " " << res << endl;
//if( fabs(res - lastRes) < 1e-5 ) return res;
//lastRes = res;
}
return res;
}
struct P {
int x, y, c, f;
};
int main() {
int N, M, B;
while (cin >> N >> M >> B && N) {
vector<P> people(N);
for (int i = 0; i < N; i++) cin >> people[i].x >> people[i].y;
vector<P> place(M);
for (int i = 0; i < M; i++) {
cin >> place[i].x >> place[i].y >> place[i].c >> place[i].f;
}
auto f = [&](int D,int bit){
if( D < 0 ) return (int)1e9;
int ans = 1e9;
int sum = 0;
int cnt = 0;
for (int i = 0; i < M; i++) {
if (bit >> i & 1) {
sum += place[i].c;
cnt += place[i].f;
}
}
Graph<CostEdge> _g(N + M + 2);
auto& g = _g.getRowGraph();
int s = g.size() - 1;
int t = g.size() - 2;
for (int i = 0; i < N; i++)
_g.addEdge(s, i, 1, 0);
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if((bit>>j&1)==0)continue;
int dist = max(0, abs(people[i].x - place[j].x) + abs(people[i].y - place[j].y) - D);
_g.addEdge(i, N + j, 1, dist);
}
}
for (int i = 0; i < M; i++) {
_g.addEdge(N + i, t, place[i].c, 0);
}
int res = minCostFlow(_g, s, t, N);
if( res != -1 ) ans = min(ans,res + cnt + __builtin_popcount(bit)*D*B);
return ans;
};
int ans = 1e9;
for(int bit = 0 ; bit < (1<<M) ; bit++){
int l = 0 , r = 2000;
while(r - l > 2) {
int a = (2*l+r)/3;
int b = (l+2*r)/3;
if( f(a,bit) > f(b,bit) ){
l = a;
}else{
r = b;
}
}
for(int i = l; i < r; i++) ans = min(ans,f(i,bit));
+
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:165:9: error: expected primary-expression before '}' token
165 | }
| ^
|
s662204142 | p00288 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
struct edge { int to,cap,cost,rev; };
int N,M,B;
int ax[100],ay[100];
int bx[5],by[5];
int c[5],d[5];
int g[100][5];
int h[200],dist[200];
vector<edge> G[200];
int prevv[200],preve[200];
int INF = 1e8;
void init_edge(){
for(int i=0;i<200;i++)G[i].clear();
}
void add_edge(int from,int to,int cap,int cost){
G[from].push_back((edge){to,cap,cost,(int)G[to].size()});
G[to].push_back((edge){from,0,-cost,(int)G[from].size()-1});
}
int min_cost_flow(int s,int t,int f){
int res = 0;
fill(h,h+200,0);
while(f>0){
priority_queue< P, vector<P>, greater<P> > que;
fill( dist, dist+200 , INF );
dist[s]=0;
que.push(P(0,s));
while(!que.empty()){
P p = que.top(); que.pop();
int v = p.second;
if(dist[v]<p.first)continue;
for(int i=0;i<(int)G[v].size();i++){
edge &e = G[v][i];
if(e.cap>0&&dist[e.to] > dist[v]+e.cost+h[v]-h[e.to]){
dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
prevv[e.to]=v;
preve[e.to]=i;
que.push(P(dist[e.to],e.to));
}
}
}
if(dist[t]==INF)return INF;
for(int v=0;v<105;v++)h[v]+=dist[v];
int d=f;
for(int v=t;v!=s;v=prevv[v]){
d=min(d,G[prevv[v]][preve[v]].cap);
}
f-=d;
res+=d*h[t];
for(int v=t;v!=s;v=prevv[v]){
edge &e = G[prevv[v]][preve[v]];
e.cap -= d;
G[v][e.rev].cap += d;
}
}
return res;
}
int solve(int x){
int res=INF;
for(int S=0;S<(1<<M);S++){
int cost=0;
init_edge();
for(int i=0;i<N;i++){
add_edge(N+M,i,1,0);
for(int j=0;j<M;j++){
if(S>>j&1){
add_edge(i,N+j,1,max(0,g[i][j]-x));
}
}
}
for(int i=0;i<M;i++){
if(S>>i&1){
add_edge(N+i,N+M+1,c[i],0);
cost+=d[i];
}
}
int A1=min_cost_flow(N+M,N+M+1,N);
int A2=cost;
int A3=B*x* __builtin_popcount(S);
res=min(res,A1+A2+A3);
}
return res;
}
int main(){
while(1){
scanf("%d %d %d",&N,&M,&B);
if(N==0&&M==0&&B==0)break;
for(int i=0;i<N;i++)scanf("%d %d",&ax[i],&ay[i]);
for(int i=0;i<M;i++)scanf("%d %d %d %d",&bx[i],&by[i],&c[i],&d[i]);
int ans=INF;
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
g[i][j]=abs(ax[i]-bx[j])+abs(ay[i]-by[j]);
}
}
/*
map<int,bool> used;
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
for(int k=-5;k<5;k++){
int nk=max(0,g[i][j]+k);
if(used[nk])continue;
used[nk]=true;
ans=min(ans,solve(nk));
}
}
}
*/
int X=INF;
for(int i=0;i<=4000;i++){
int Y=solve(i);
if(X<Y)break;
ans=min(ans,Y);
X=Y;
}
int X=INF;
for(int i=100;i<=4000;i++){
int Y=solve(i);
if(X<Y)break;
ans=min(ans,Y);
X=Y;
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:128:9: error: redeclaration of 'int X'
128 | int X=INF;
| ^
a.cc:120:9: note: 'int X' previously declared here
120 | int X=INF;
| ^
|
s018301341 | p00289 | C++ | #define EQ(a,b) (fabs((a)-(b)) < EPS)
#define MAX_N 100000
#define MAX_M 300000
int main(){
int n, m;
cin >> n >> m;
vector<pair<int, int> > e;
for (int i = 0; i < m; ++i) {
int s, t;
cin >> s >> t;
e.push_back(make_pair(t, s));
}
sort(e.begin(), e.end());
int ret[MAX_N + 1] = {};
int j = 0;
for (int i = 2; i <= n; ++i) {
while (e[j].first != i) ++j;
if (e[j].second == 1 || (j+1 < e.size() && e[j+1].first == i)) ret[i] = i;
else ret[i] = e[j].second;
}
int q;
cin >> q;
for (int i = 0; i < q; ++i) {
int r;
cin >> r;
cout << ret[r] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
8 | cin >> n >> m;
| ^~~
a.cc:9:9: error: 'vector' was not declared in this scope
9 | vector<pair<int, int> > e;
| ^~~~~~
a.cc:9:16: error: 'pair' was not declared in this scope
9 | vector<pair<int, int> > e;
| ^~~~
a.cc:9:21: error: expected primary-expression before 'int'
9 | vector<pair<int, int> > e;
| ^~~
a.cc:13:17: error: 'e' was not declared in this scope
13 | e.push_back(make_pair(t, s));
| ^
a.cc:13:29: error: 'make_pair' was not declared in this scope
13 | e.push_back(make_pair(t, s));
| ^~~~~~~~~
a.cc:15:14: error: 'e' was not declared in this scope
15 | sort(e.begin(), e.end());
| ^
a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'short'?
15 | sort(e.begin(), e.end());
| ^~~~
| short
a.cc:28:17: error: 'cout' was not declared in this scope
28 | cout << ret[r] << endl;
| ^~~~
a.cc:28:35: error: 'endl' was not declared in this scope
28 | cout << ret[r] << endl;
| ^~~~
|
s338091591 | p00290 | Java | public class AOJ0295{public static void main(String[] a){java.util.Scanner s=new java.util.Scanner(System.in);System.out.println(s.nextInt()*s.nextInt());}} | Main.java:1: error: class AOJ0295 is public, should be declared in a file named AOJ0295.java
public class AOJ0295{public static void main(String[] a){java.util.Scanner s=new java.util.Scanner(System.in);System.out.println(s.nextInt()*s.nextInt());}}
^
1 error
|
s036473262 | p00290 | Java | import java.util.Scanner;
public class Mon1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int d = sc.nextInt();
int c = sc.nextInt();
System.out.println(d*c);
}
} | Main.java:2: error: class Mon1 is public, should be declared in a file named Mon1.java
public class Mon1 {
^
1 error
|
s570123104 | p00290 | Java |
public class Main {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int table = stdin.nextInt();
int chairs = stdin.nextInt();
System.out.println(table * chairs);
}
} | Main.java:6: error: cannot find symbol
Scanner stdin = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:6: error: cannot find symbol
Scanner stdin = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s203693730 | p00290 | C | #include <stdio.h>
int main(void){
int a,b;
scanf("%d%d", &a, &b);
printf("%d\n",aB; );
return 0;
} | main.c: In function 'main':
main.c:6:15: error: 'aB' undeclared (first use in this function); did you mean 'a'?
6 | printf("%d\n",aB; );
| ^~
| a
main.c:6:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:17: error: expected ')' before ';' token
6 | printf("%d\n",aB; );
| ~ ^
| )
|
s881036898 | p00290 | C | #include<stdio.h>
int main
{
int c,d;
scanf("%d %d",&c,&d);
c=c*d;
printf("%d",c);
return 0;
} | main.c:3:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
3 | {
| ^
|
s824265539 | p00290 | C | #include<stdio.h>
int main(void){
int i,a,b;
scanf("%d%d"&a,&b);
i=a*b;
printf("%d\n",i);
} | main.c: In function 'main':
main.c:4:16: error: invalid operands to binary & (have 'char *' and 'int')
4 | scanf("%d%d"&a,&b);
| ~~~~~~^
| |
| char *
|
s058070290 | p00290 | C | #include<stdio.h>
int main(void){
int i,a,b;
scanf("%d%d"&a,&b);
i=a*b;
printf("%d\n",i);
} | main.c: In function 'main':
main.c:4:16: error: invalid operands to binary & (have 'char *' and 'int')
4 | scanf("%d%d"&a,&b);
| ~~~~~~^
| |
| char *
|
s641633699 | p00290 | C | #include <stdio.h>
int main(void) {
int d=<100;
int c=<10;
scanf("%d %d",&d,&c);
d=d*c;
printf("%d\n",d);
// your code goes here
return 0;
} | main.c: In function 'main':
main.c:4:15: error: expected expression before '<' token
4 | int d=<100;
| ^
main.c:5:15: error: expected expression before '<' token
5 | int c=<10;
| ^
|
s690483857 | p00290 | C | #include <stdio.h>
int main(void) {
int d<101;
int c<11;
scanf("%d %d",&d,&c);
d=d*c;
printf("%d\n",d);
// your code goes here
return 0;
} | main.c: In function 'main':
main.c:4:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
4 | int d<101;
| ^
main.c:4:14: error: expected expression before '<' token
main.c:5:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
5 | int c<11;
| ^
main.c:5:14: error: expected expression before '<' token
main.c:6:24: error: 'd' undeclared (first use in this function)
6 | scanf("%d %d",&d,&c);
| ^
main.c:6:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:27: error: 'c' undeclared (first use in this function)
6 | scanf("%d %d",&d,&c);
| ^
|
s846552659 | p00290 | C | #include <stdio.h>
int main(void) {
int d,c;
scanf("%d %d",&d,&c);
printf("%d",d*c\n);
return 0;
} | main.c: In function 'main':
main.c:6:24: error: stray '\' in program
6 | printf("%d",d*c\n);
| ^
main.c:6:24: error: expected ')' before 'n'
6 | printf("%d",d*c\n);
| ~ ^~
| )
|
s806109831 | p00290 | C | #include <stdio.h>
int main(void) {
int d,c;
scanf("%d %d",&d,&c);
printf("%d",d*c\n);
return 0;
} | main.c: In function 'main':
main.c:6:24: error: stray '\' in program
6 | printf("%d",d*c\n);
| ^
main.c:6:24: error: expected ')' before 'n'
6 | printf("%d",d*c\n);
| ~ ^~
| )
|
s540241249 | p00290 | C | #include <stdio.h>
int main(void) {
int d[99];
int c[9];
scanf("%d %d",&d,&c);
d=d*c;
printf("%d\n",d);
// your code goes here
return 0;
} | main.c: In function 'main':
main.c:7:12: error: invalid operands to binary * (have 'int *' and 'int *')
7 | d=d*c;
| ~^
| ||
| |int *
| int *
|
s862736316 | p00290 | C | #include<stdio.h>
int main(void)
{
int chair,table;
scanf("%d %d",&chair,&table);
printf("%d\n"chair*table);
return 0;
} | main.c: In function 'main':
main.c:8:16: error: expected ')' before 'chair'
8 | printf("%d\n"chair*table);
| ~ ^~~~~
| )
|
s497623233 | p00290 | C | #include<iostream>
using namespace std;
int main () {
int d, c;
cin >>d >> c;
int sosu=d*c;
cout<<d*c<<end|;
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s853576945 | p00290 | C | clude<iostream>
using namespace std;
int main () {
int d, c#in;
cin >>d >> c;
int sosu=d*c;
cout<<d*c<<endl;
return 0;
} | main.c:1:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | clude<iostream>
| ^
main.c: In function 'main':
main.c:7:17: error: stray '#' in program
7 | int d, c#in;
| ^
main.c:7:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'in'
7 | int d, c#in;
| ^~
main.c:9:9: error: 'cin' undeclared (first use in this function)
9 | cin >>d >> c;
| ^~~
main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:20: error: 'c' undeclared (first use in this function)
9 | cin >>d >> c;
| ^
main.c:13:9: error: 'cout' undeclared (first use in this function)
13 | cout<<d*c<<endl;
| ^~~~
main.c:13:20: error: 'endl' undeclared (first use in this function)
13 | cout<<d*c<<endl;
| ^~~~
|
s443259446 | p00290 | C | #include<stdio.h>
int main(void) {
int d, c;
scanf_s("%d %d", &d, &c);
printf("%d", d*c);
return 0;
} | main.c: In function 'main':
main.c:4:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
4 | scanf_s("%d %d", &d, &c);
| ^~~~~~~
| scanf
|
s676449350 | p00290 | C | #include<stdio.h>
int main(void)
{
int a, b;
scanf_s("%d %d", &a, &b);
printf("%d", a * b);
return 0;
} | main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
6 | scanf_s("%d %d", &a, &b);
| ^~~~~~~
| scanf
|
s539982868 | p00290 | C | #include<stdio.h>
int main(void){
int d,c;
scanf("%d%d",&d,&c);
printf("%d\n",d*c);
return 0:
} | main.c: In function 'main':
main.c:8:13: error: expected ';' before ':' token
8 | return 0:
| ^
| ;
|
s936010095 | p00290 | C++ | #include <iostream>
using namespace std;
int main(){
int d.c;
cin>>d>>c;
cout<<d*2=c<<endl:
}
| a.cc: In function 'int main()':
a.cc:4:6: error: expected initializer before '.' token
4 | int d.c;
| ^
a.cc:5:9: error: 'd' was not declared in this scope
5 | cin>>d>>c;
| ^
a.cc:5:12: error: 'c' was not declared in this scope
5 | cin>>d>>c;
| ^
|
s546991794 | p00290 | C++ | #include <iostream>
using namespace std;
int main(){
int d.c;
cin>>d>>c;
cout<<d*2="c"<<endl:
}
| a.cc: In function 'int main()':
a.cc:4:6: error: expected initializer before '.' token
4 | int d.c;
| ^
a.cc:5:9: error: 'd' was not declared in this scope
5 | cin>>d>>c;
| ^
a.cc:5:12: error: 'c' was not declared in this scope
5 | cin>>d>>c;
| ^
a.cc:6:17: error: invalid operands of types 'const char [2]' and '<unresolved overloaded function type>' to binary 'operator<<'
6 | cout<<d*2="c"<<endl:
| ~~~^~~~~~
|
s844988351 | p00290 | C++ | #include <iostream>
using namespace std;
int main(){
int d.c;
cin>>d>>c;
cout<<d*2=c<<endl:
}
| a.cc: In function 'int main()':
a.cc:4:6: error: expected initializer before '.' token
4 | int d.c;
| ^
a.cc:5:9: error: 'd' was not declared in this scope
5 | cin>>d>>c;
| ^
a.cc:5:12: error: 'c' was not declared in this scope
5 | cin>>d>>c;
| ^
|
s121341156 | p00290 | C++ | #include <iostream>
using namespace std;
int main(){
int d,c;
cin>>d>>c;
cout<<d*2=c<<endl:
}
| a.cc: In function 'int main()':
a.cc:6:15: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
6 | cout<<d*2=c<<endl:
| ~^~~~~~
|
s606607832 | p00290 | C++ | #include <iostream>
using namespace std;
int main(){
int d,c;
cin>>d>>c;
cout<<d*c<<endl:
}
| a.cc: In function 'int main()':
a.cc:6:19: error: expected ';' before ':' token
6 | cout<<d*c<<endl:
| ^
| ;
|
s965950230 | p00290 | C++ | #include<cstdio>
int main(){
int a,b;
scanf("%d%d",&a,&b);
paintf("%d\n",a*b);
return 0;
} | a.cc: In function 'int main()':
a.cc:5:5: error: 'paintf' was not declared in this scope; did you mean 'printf'?
5 | paintf("%d\n",a*b);
| ^~~~~~
| printf
|
s346537693 | p00290 | C++ | n;main(m){scanf("%d%d",&n,&m);n*=m;!vprintf("%d\n",&n);exit(0);} | a.cc:1:1: error: 'n' does not name a type
1 | n;main(m){scanf("%d%d",&n,&m);n*=m;!vprintf("%d\n",&n);exit(0);}
| ^
a.cc:1:7: error: expected constructor, destructor, or type conversion before '(' token
1 | n;main(m){scanf("%d%d",&n,&m);n*=m;!vprintf("%d\n",&n);exit(0);}
| ^
|
s815117530 | p00290 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int d,c;
cin >> d >> c;
cout << d * c << end
} | a.cc: In function 'int main()':
a.cc:9:23: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
9 | cout << d * c << end
| ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
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 overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
|
s301450057 | p00290 | C++ | #include <stdio.h>
int main(void){
int a,b;
scanf("%d%d", &a, &b);
printf("%d\n",aB; );
return 0;
} | a.cc: In function 'int main()':
a.cc:6:15: error: 'aB' was not declared in this scope; did you mean 'a'?
6 | printf("%d\n",aB; );
| ^~
| a
a.cc:6:19: error: expected primary-expression before ')' token
6 | printf("%d\n",aB; );
| ^
|
s042642193 | p00290 | C++ | #include <iostream>
#include <stdio>
using namespace std;
int main() {
int a, b;
scanf("%d%d", &a, &b);
cout << a * b<< endl;
return 0;
} | a.cc:2:10: fatal error: stdio: No such file or directory
2 | #include <stdio>
| ^~~~~~~
compilation terminated.
|
s453970133 | p00290 | C++ | w#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
//#define endl "\n"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
template<class T> inline bool chmax(T & x, T const & y){ return x<y ? x=y,true : false; }
template<class T> inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif
// ll const mod = 1000000007;
// ll const inf = 1LL<<60;
int main(){
int a,b;
cin >> a >> b;
cout << a*b << endl;
} | a.cc:1:2: error: stray '#' in program
1 | w#define _CRT_SECURE_NO_WARNINGS
| ^
a.cc:1:1: error: 'w' does not name a type
1 | w#define _CRT_SECURE_NO_WARNINGS
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:3:
/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'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) 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:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive |
s356350760 | p00290 | C++ | #include <iostream>
using namespace std;
int main() {
cin >> a >> b;
cout << a * b << endl;
} | a.cc: In function 'int main()':
a.cc:6:12: error: 'a' was not declared in this scope
6 | cin >> a >> b;
| ^
a.cc:6:17: error: 'b' was not declared in this scope
6 | cin >> a >> b;
| ^
|
s130614626 | p00290 | C++ | #include <iostream
int main(){
int n, m;
std::cin >> n >> m;
std::cout << n * m << std::endl;
} | a.cc:1:19: error: missing terminating > character
1 | #include <iostream
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.