submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s153061938 | p03651 | C++ | as | a.cc:1:1: error: 'as' does not name a type
1 | as
| ^~
|
s749512485 | p03651 | C++ | #include <vector>
#include <iostream>
#include <assert.h>
#define Unknown 2
#define No 0
#define Yes 1
int n, k, max;
std::vector<unsigned char> v;
std::vector<int> box;
void init() {
std::sort(box.begin(), box.end(), std::greater<int>());
max = box[0];
v.resize(max + 1, Unknown);
for(int i = 0; i < n; i++) {
int a = box[i];
// std::cout << a << "\n";
v[a] = Yes;
for(int j = i + 1; j < n; j++) {
const int diff = a - box[j];
// std::cout << a << " - " << box[j] << " = " << diff << "\n";
// std::cout << diff << "\n";
v[diff] = Yes;
}
}
}
bool configurable(int n) {
if(max < n || n <= 0)
return false;
//std::cout << "? " << n << "\n";
if(v[n] != Unknown) {
//std::cout << "P(" << n << ") = " << v[n] << "\n";
return v[n] == Yes;
}
v[n] = No;
for(int x = 1; x <= max - n; x++) {
if(configurable(n + x) && configurable(x)) {
//std::cout << n << " = (" << (n + x) << " - " << x << ")\n";
v[n] = Yes;
return true;
}
}
return false;
}
int main() {
std::cin >> n;
std::cin >> k;
box.resize(n);
for(int i = 0; i < n; i++) {
std::cin >> box[i];
}
init();
if(configurable(k)) {
std::cout << "POSSIBLE\n";
} else {
std::cout << "IMPOSSIBLE\n";
}
return 0;
} | a.cc: In function 'void init()':
a.cc:14:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
14 | std::sort(box.begin(), box.end(), std::greater<int>());
| ^~~~
| qsort
|
s195499480 | p03651 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(void){
int n, k, a[100005];
cin >> n >> k;
for(int i=0;i<n;i++){
cin >> a[i];
if(a[i] == k){
cout << "POSSIBLE" << endl;
return 0;
}
}
sort(a,a+n);
if(a[n-1] < k){
cout << "IMPOSSIBLE" << endl;
return 0;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
22 | }
| ^
a.cc:5:15: note: to match this '{'
5 | int main(void){
| ^
|
s787535105 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if(b == 0) return a;
else return gcd(b, a%b);
}
int main() {
int N, K; cin >> N >> K;
int g = -1, m = -1;
for(int i=0; i<N; i++) {
int p; cin >> p;
if(i == 0) g = p;
else g = gcd(g, p);
m = max(m, p);
}
if(K % g == 0 && K <= M) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:25: error: 'M' was not declared in this scope
18 | if(K % g == 0 && K <= M) cout << "POSSIBLE" << endl;
| ^
|
s627347375 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
#define for_(i,a,b) for(int i=(a);i<(b);++i)
int main() {
int N, K;
cin >> N >> K;
vector< int > A(N);
for_(i,0,N) cin >> A[i];
sort(A, A+N);
int g = A[0];
for_(i,1,N) g = __gcd(g, A[i]);
puts(K <= A[N-1] && K % g == 0 ? "POSSIBLE" : "IMPOSSIBLE");
} | a.cc: In function 'int main()':
a.cc:12:18: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int')
12 | sort(A, A+N);
| ~^~
| | |
| | int
| std::vector<int>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
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_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
12 | sort(A, A+N);
| ^
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const _CharT*' and 'std::vector<int>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'const _CharT*' and 'std::vector<int>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
12 | sort(A, A+N);
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)'
340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>'
12 | sort(A, A+N);
| ^
/usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const _Tp&)'
349 | op |
s441489979 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
#define for_(i,a,b) for(int i=(a);i<(b);++i)
int main() {
int N, K;
cin >> N >> K;
vector< int > A(N);
for_(i,0,N) cin >> A[i];
sort(A[i]);
int g = A[0];
for_(i,1,N) g = __gcd(g, A[i]);
puts(K <= A[N-1] && K % g == 0 ? "POSSIBLE" : "IMPOSSIBLE");
} | a.cc: In function 'int main()':
a.cc:12:16: error: 'i' was not declared in this scope
12 | sort(A[i]);
| ^
|
s825977184 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std; // スペル注意
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define pb push_back
// make_pair など各自で
int N;
int K;
int A[114514];
bool check(){
rep(i,N)if(A[i] % A[0])return false;
return true;
}
void c(){
rep(i,N)if(A[i] == K)return true;
return false;
}
int main(){
cin >> N >> K;
rep(i, N)cin >> A[i];
sort(A, A + N);
bool flag;
if(A[N - 1] < K)flag = false;
else if(N == 1 && A[0] != K)flag = false;
else if(c())flag = true;
else if(A[0] == 1)flag = true;
else if(check() && K % A[0]){
flag = false;
}
else flag = true;
cout << (flag ? "POSSIBLE" : "IMPOSSIBLE") << endl;
} | a.cc: In function 'void c()':
a.cc:16:37: error: return-statement with a value, in function returning 'void' [-fpermissive]
16 | rep(i,N)if(A[i] == K)return true;
| ^~~~
a.cc:17:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
17 | return false;
| ^~~~~
a.cc: In function 'int main()':
a.cc:26:18: error: could not convert 'c()' from 'void' to 'bool'
26 | else if(c())flag = true;
| ~^~
| |
| void
|
s263532321 | p03651 | Java | import java.util.Scanner;
public class TaskA {
public static void main(String[] argv) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int max = 0;
int gcd = 0;
for (int i= 0; i < n; i++) {
int m = sc.nextInt();
max = Math.max(max, m);
gcd = findGcd(gcd, m);
}
if (k <= max && k % gcd == 0) {
System.out.println("POSSIBLE");
} else {
System.out.println("IMPOSSIBLE");
}
}
private static int findGcd(int a, int b) {
while (b > 0) {
int t = a % b;
a = b;
b = t;
}
return a;
}
} | Main.java:3: error: class TaskA is public, should be declared in a file named TaskA.java
public class TaskA {
^
1 error
|
s798795788 | p03651 | C++ | #define TEST_MODE true
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a; \
c > 0 ? i < b : i > b; \
i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long
#ifdef LOCAL_ENV
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << endl
#else
const bool test = false;
#define dump(x)
#endif
#else
const bool test = false;
#define dump(x)
#endif
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
//.....................
const int MAX = (int)2e5 + 5;
vector<string> split(const string &str, char sep)
{
vector<string> v;
stringstream ss(str);
string buffer;
while (getline(ss, buffer, sep))
{
v.push_back(buffer);
}
return v;
}
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
return accumulate(begin, end, 0ll);
}
template<typename T>
T gcd(T a, T b)
{
T c;
while (a != 0) {
c = a; a = b%a; b = c;
}
return b;
}
void solve();
class Solver {
public:
int N, K;
int A[MAX];
vector<int> B;
bool ok() {
rep(i, N) {
if (A[i] == K) {
return true;
}
}
if (K > max_element(A, A + N)) return false;
rep(i, 2000000) {
int v1 = A[rand() % N];
int v2 = A[rand() % N];
if (v1 < v2) swap(v1, v2);
if (v1 % v2 == 1 or gcd(v1, v2) == 1) {
return true;
}
if (v1 % v2 != 0 && K % (v1 % v2) == 0) return true;
if (K % gcd(v1, v2) == 0) {
return true;
}
}
return false;
}
void solve() {
cin >> N >> K;
rep(i, N) cin >> A[i];
cout << (ok() ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
};
signed main()
{
cout << fixed << setprecision(20);
auto ptr = new Solver();
ptr->solve();
delete ptr;
// while (true) {
// auto ptr = new Solver();
// ptr->solve();
// delete ptr;
// }
return 0;
}
// class Mycin {
// bool flag = true;
// public:
// Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// operator bool() {return flag;}
// } mycin;
// class Mycout {
// public:
// Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// Mycout& operator << (const char c) {printf("%c", c); return *this;}
// Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
// #define cin mycin
// #define cout mycout
// #define endl '\n'
| a.cc: In member function 'bool Solver::ok()':
a.cc:95:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
95 | if (K > max_element(A, A + N)) return false;
| ~~^~~~~~~~~~~~~~~~~~~~~~~
|
s185004481 | p03651 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
//最大公約数を計算する
int gcd(int m,int n){
if(n==0 || m == 0) return 0;
while(m != n){
if(m > n) m -= n;
else n -= m;
}
return m;
}
int gcd2(int a,int b){
if(a<b) swap(a,b);
while((int r=a%b)){
a=b;
b=r;
}
return b;
}
int main(){
int n,k;
cin >> n >> k;
vector<int> a(n,0);
int max = 0;
rep(i,n){
cin >> a[i];
if(a[i] > max) max = a[i];
}
if(max < k){
cout << "IMPOSSIBLE" << endl;
return 0;
}
int tmp = gcd2(a[0],a[1]);
int tmp2;
rep(i,n-1){
tmp2 = gcd2(tmp,a[i+1]);
//cout << a[i+1] << "|"<<tmp <<"," << tmp2 << endl;
if(tmp > tmp2){
tmp = tmp2;
}
}
// cout << tmp << endl;
if(tmp == 1){
cout << "POSSIBLE" << endl;
}else{
if(k % tmp == 0 ){
cout << "POSSIBLE" << endl;
}else{
cout << "IMPOSSIBLE" << endl;
}
}
return 0;
}
| a.cc: In function 'int gcd2(int, int)':
a.cc:22:10: error: expected primary-expression before 'int'
22 | while((int r=a%b)){
| ^~~
a.cc:22:10: error: expected ')' before 'int'
22 | while((int r=a%b)){
| ~^~~
| )
a.cc:25:4: error: expected ')' before 'return'
25 | }
| ^
| )
26 | return b;
| ~~~~~~
a.cc:22:8: note: to match this '('
22 | while((int r=a%b)){
| ^
a.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
27 | }
| ^
|
s423356623 | p03651 | C | #include <cstdio>
#include <algorithm>
using namespace std;
int n, k, r, a, maxa;
int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
int main(void) {
scanf("%d%d%d", &n, &k, &r);
maxa = r;
for (int i = 1; i < n; i++) {
scanf("%d", &a);
r = gcd(r, a);
maxa = max(maxa, a);
}
if (!(k % r) && k <= maxa)
printf("POSSIBLE");
else
printf("IMPOSSIBLE");
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s671204257 | p03651 | C++ | from math import gcd
N,K = map(int,input().split())
A = list(map(int,input().split()))
if K > max(A):
print('IMPOSSIBLE')
exit()
d = A[0]
for a in A:
d = gcd(d,a)
if K % d == 0:
print('POSSIBLE')
else:
print('IMPOSSIBLE') | a.cc:7:9: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
7 | print('IMPOSSIBLE')
| ^~~~~~~~~~~~
a.cc:15:9: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
15 | print('POSSIBLE')
| ^~~~~~~~~~
a.cc:17:9: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
17 | print('IMPOSSIBLE')
| ^~~~~~~~~~~~
a.cc:1:1: error: 'from' does not name a type
1 | from math import gcd
| ^~~~
|
s280917868 | p03651 | C | #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<random>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<stdlib.h>
#include<unordered_map>
#include<time.h>
#define rep(i,a,n) for (int (i)=(a);(i)<(n);(i)++)
#define int long long
using namespace std;
typedef long long ll;
typedef long double ld;
const int inf = 999999999999999999;
using namespace std;
int gcm(int a, int b) {
if (a > b) swap(a, b);
if (a == 0) return b;
return gcm(b%a, a);
}
int n, a[100000], k, ma = 0;
signed main() {
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
ma = max(a[i], ma);
if (a[i] == k) {
cout << "POSSIBLE\n";
goto stop;
}
}
if (ma < k) {
cout << "IMPOSSIBLE\n";
goto stop;
}
for (int i = n - 1; i >= 0; i--) {
for (int j = i - 1; j >= 0; j--) {
if (k%gcm(a[i], a[j]) == 0) {
cout << "POSSIBLE\n";
goto stop;
}
}
}
cout << "IMPOSSIBLE\n";
stop:;
getchar(); getchar();
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s655192730 | p03651 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
int main()
{
int n, k;
scanf("%d %d\n", &n, &k);
int tmp;
int i = 0;
queue<int> queues;
map<int, bool> maps;
bool find = false;
while (i++ < n && scanf("%d", &tmp) != EOF)
{
if (maps[tmp] == false)
{
if (k == tmp)
find = true;
queues.push(tmp);
maps[tmp] = true;
}
}
while (!find && !queues.empty())
{
int a1 = queues.front();
queues.pop();
queue<int> t_queue;
for (auto iter : maps)
{
int a2 = iter.first;
int diff = abs(a2 - a1);
t_queue.push(diff);
}
while (!t_queue.empty())
{
int val = t_queue.front();
t_queue.pop();
if (maps[val] == false)
{
if (val == k)
{
find = true;
break;
}
else
{
queues.push(val);
maps[val] = true;
}
}
}
}
if (find == true)
printf("POSSIBLE");
else
printf("IMPOSSIBLE");
} | a.cc:13:1: error: extended character is not valid in an identifier
13 |
| ^
a.cc:13:1: error: '\U000000a0' does not name a type
13 |
| ^
|
s338887389 | p03651 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
int main()
{
int n, k;
scanf_s("%d %d\n", &n, &k);
int tmp;
int i = 0;
queue<int> queues;
map<int, bool> maps;
bool find = false;
while (i++ < n && scanf_s("%d", &tmp) != EOF)
{
if (maps[tmp] == false)
{
if (k == tmp)
find = true;
queues.push(tmp);
maps[tmp] = true;
}
}
while (!find && !queues.empty())
{
int a1 = queues.front();
queues.pop();
queue<int> t_queue;
for (auto iter : maps)
{
int a2 = iter.first;
int diff = abs(a2 - a1);
t_queue.push(diff);
}
while (!t_queue.empty())
{
int val = t_queue.front();
t_queue.pop();
if (maps[val] == false)
{
if (val == k)
{
find = true;
break;
}
else
{
queues.push(val);
maps[val] = true;
}
}
}
}
if (find == true)
printf_s("POSSIBLE");
else
printf_s("IMPOSSIBLE");
} | a.cc: In function 'int main()':
a.cc:17:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
17 | scanf_s("%d %d\n", &n, &k);
| ^~~~~~~
| scanf
a.cc:64:17: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
64 | printf_s("POSSIBLE");
| ^~~~~~~~
| printf
a.cc:66:17: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
66 | printf_s("IMPOSSIBLE");
| ^~~~~~~~
| printf
|
s320519588 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
for(int i = 0; i < n; i++) cin >> a[i];
int gcd = a[0], maxi = a[0];
for(int i = 1; i < n; i++) maxi = max(maxi, a[i]), gcd = __gcd(gcd, a[i]);
if(k <= maxi && k % gcd == 0) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
} | a.cc: In function 'int main()':
a.cc:6:39: error: 'a' was not declared in this scope
6 | for(int i = 0; i < n; i++) cin >> a[i];
| ^
a.cc:7:15: error: 'a' was not declared in this scope
7 | int gcd = a[0], maxi = a[0];
| ^
a.cc:8:32: error: 'maxi' was not declared in this scope
8 | for(int i = 1; i < n; i++) maxi = max(maxi, a[i]), gcd = __gcd(gcd, a[i]);
| ^~~~
a.cc:9:13: error: 'maxi' was not declared in this scope
9 | if(k <= maxi && k % gcd == 0) cout << "POSSIBLE" << endl;
| ^~~~
|
s197409759 | p03651 | C++ | #include <iostream>
#include <set>
#include <vector>
using namespace std;
/* A - Getting Difference */
static int const MAX = 10000;
int main()
{
int N, K;
cin >> N >> K; // N個, 整数Kを作りたい
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int flag = 1, set_size = 0;
while ( flag ) {
int n = A.size();
sort(A.begin(), A.end(), greater<int>()); // 降順
int to_set[MAX] = {}; to_set[n - 1] = A[n - 1];
int check, add = 0;
for ( int i = 0; i < n; i++ ) {
to_set[i] = A[i];
for ( int j = i + 1;j < n; j++ ) {
check = A[i] - A[j];
if (check == K) { // 終了条件1. Kと一致が得られる
cout << "POSSIBLE" << endl;
j = n;
i = n;
flag = 0;
}
A.push_back(check); // 終了じゃない場合は追加
to_set[++add] = check;
}
}
set<int> s(to_set, end(to_set));
// 終了条件 setが同じor Kをつくれた
if(set_size == s.size() && flag == 1) {
cout << "IMPOSSIBLE" << endl;
break;
}
set_size = s.size();
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
24 | sort(A.begin(), A.end(), greater<int>()); // 降順
| ^~~~
| short
|
s293042544 | p03651 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int gcd(int x, int y) {
if (x == 0) return y;
if (y == 0) return x;
int mod = x % y;
if (mod == 0) return y;
return gcd(y, mod);
}
int main(){
int N, K;
cin >> N >> K;
int G = 0;
int M = 0;
for (int i = 0; i < N; i++) {
int x;
cin >> x;
G = ((x > G) ? gcd(x, G) : gcd(G, x));
M = max(M, x);
}
if (K <= M && (K % G == 0)) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int gcd(int x, int y) {
if (x == 0) return y;
if (y == 0) return x;
int mod = x % y;
if (mod == 0) return y;
return gcd(y, mod);
}
int main(){
int N, K;
cin >> N >> K;
int G = 0;
int M = 0;
for (int i = 0; i < N; i++) {
int x;
cin >> x;
G = ((x > G) ? gcd(x, G) : gcd(G, x));
M = max(M, x);
}
if (K <= M && (K % G == 0)) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc:29:2: error: stray '#' in program
29 | }#include <iostream>
| ^
a.cc:29:3: error: 'include' does not name a type
29 | }#include <iostream>
| ^~~~~~~
a.cc:34:5: error: redefinition of 'int gcd(int, int)'
34 | int gcd(int x, int y) {
| ^~~
a.cc:6:5: note: 'int gcd(int, int)' previously defined here
6 | int gcd(int x, int y) {
| ^~~
a.cc:42:5: error: redefinition of 'int main()'
42 | int main(){
| ^~~~
a.cc:14:5: note: 'int main()' previously defined here
14 | int main(){
| ^~~~
|
s880383302 | p03651 | C++ | /// a.cpp
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < decltype(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
# define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
#ifdef CF
freopen("input","r",stdin);
#endif // CF
srand(time(0));
fo << fixed << setprecision(7);
cerr << fixed << setprecision(7);
int n,k;
fi>>n>>k;
int g = 0;
int mx = 0;
while (n --)
{
int v;
fi>>v;
g = __gcd(g,v);
smax(mx,v);
}
if (k % g && mx >= k)
puts("POSSIBLE")
else
puts("IMPOSSIBLE");
cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
return 0;
}
| a.cc: In function 'int main()':
a.cc:52:25: error: expected ';' before 'else'
52 | puts("POSSIBLE")
| ^
| ;
53 | else
| ~~~~
|
s160500038 | p03651 | C++ | #include<iostream>
#include<stdio.h>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int gcd(int a, int b)
{
int temp;
if (a < b) { temp = a; a = b; b = temp; }//大的在前
if (a%b == 0)return b;
gcd(b, a%b);
}
int main()
{
int n, k,i;
while (scanf_s("%d%d", &n, &k) == 2) { //scanf的返回值为输入的个数
vector<int>a(n);
for (i = 0; i < n; i++)scanf_s("%d", &a[i]);
sort(a.begin(), a.end());
int g = a[0];
for (int i = 1; i < n; i++)g = gcd(g, a[i]);
bool f = k%g == 0 && a[n - 1] >= k;
string ans = f ? "POSSIBLE" : "IMPOSSIBLE";
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
18 | while (scanf_s("%d%d", &n, &k) == 2) { //scanf的返回值为输入的个数
| ^~~~~~~
| scanf
a.cc: In function 'int gcd(int, int)':
a.cc:12:12: warning: control reaches end of non-void function [-Wreturn-type]
12 | gcd(b, a%b);
| ~~~^~~~~~~~
|
s118221050 | p03651 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <bitset>
#include <set>
#include <list>
#include <deque>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = 4.0*atan(1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f;
const int NINF = -INF -1;
const int N=510;
int gcd(int a,int b)
{
return (!b)?a:gcd(b,a%b);
}
int main()
{
int n,k;
scanf("%d%d",&n,&k);
int tem=0;
int g;
bool fla=0;
int maxn=0;
for(int i=0;i<n;i++)
{
scanf("%d",&g);
if(g==k)
fla=1;
if(g>maxn)
maxn=g;
g=gcd(g,tem);
tem=g;
}
if(maxn>k)
printf("IMPOSSIBLE\n");
else if(g==1 || fla=1)
printf("POSSIBLE\n");
else
printf("IMPOSSIBLE\n");
return 0;
}
| a.cc: In function 'int main()':
a.cc:47:18: error: lvalue required as left operand of assignment
47 | else if(g==1 || fla=1)
| ~~~~~^~~~~~
|
s749447179 | p03651 | C++ | #include<iostream>#include<stdio.h>#include<algorithm>#include<math.h>#include<string.h>using namespace std;int gcd(int x,int y){ if(x<y) { int t=x; x=y; y=t; } if(x%y==0) return y; else return gcd(y,x%y);}int main(){ int n,k,i,maxm,y,a[100005]; while(scanf("%d%d",&n,&k)!=EOF) { maxm=-1; for(i=1;i<=n;i++) { scanf("%d",&a[i]); maxm=max(a[i],maxm); } y=a[1]; for(i=2;i<=n;i++) y=gcd(a[i],y); if(k<=maxm&&k%y==0) printf("POSSIBLE\n"); else printf("IMPOSSIBLE\n"); } return 0;} | a.cc:1:19: warning: extra tokens at end of #include directive
1 | #include<iostream>#include<stdio.h>#include<algorithm>#include<math.h>#include<string.h>using namespace std;int gcd(int x,int y){ if(x<y) { int t=x; x=y; y=t; } if(x%y==0) return y; else return gcd(y,x%y);}int main(){ int n,k,i,maxm,y,a[100005]; while(scanf("%d%d",&n,&k)!=EOF) { maxm=-1; for(i=1;i<=n;i++) { scanf("%d",&a[i]); maxm=max(a[i],maxm); } y=a[1]; for(i=2;i<=n;i++) y=gcd(a[i],y); if(k<=maxm&&k%y==0) printf("POSSIBLE\n"); else printf("IMPOSSIBLE\n"); } return 0;}
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s286853619 | p03651 | C++ | #include<iostream>#include<stdio.h>#include<algorithm>#include<math.h>#include<string.h>using namespace std;int gcd(int x,int y){ if(x<y) { int t=x; x=y; y=t; } if(x%y==0) return y; else return gcd(y,x%y);}int main(){ int n,k,i,maxm,y,a[100005]; while(scanf("%d%d",&n,&k)!=EOF) { maxm=-1; for(i=1;i<=n;i++) { scanf("%d",&a[i]); maxm=max(a[i],maxm); } y=a[1]; for(i=2;i<=n;i++) y=gcd(a[i],y); if(k<=maxm&&k%y==0) printf("POSSIBLE\n"); else printf("IMPOSSIBLE\n"); } return 0;} | a.cc:1:19: warning: extra tokens at end of #include directive
1 | #include<iostream>#include<stdio.h>#include<algorithm>#include<math.h>#include<string.h>using namespace std;int gcd(int x,int y){ if(x<y) { int t=x; x=y; y=t; } if(x%y==0) return y; else return gcd(y,x%y);}int main(){ int n,k,i,maxm,y,a[100005]; while(scanf("%d%d",&n,&k)!=EOF) { maxm=-1; for(i=1;i<=n;i++) { scanf("%d",&a[i]); maxm=max(a[i],maxm); } y=a[1]; for(i=2;i<=n;i++) y=gcd(a[i],y); if(k<=maxm&&k%y==0) printf("POSSIBLE\n"); else printf("IMPOSSIBLE\n"); } return 0;}
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s189134710 | p03651 | C++ |
#include <iostream>
using namespace std;
int gcd(int a,int b){
if(a>b){
if(a%b!=0){
gcd(b,a%b);
}else{
return b;
}
}else if(a<b){
if(b%a!=0){
gcd(a,b%a);
}else{
return a;
}
}else{
return a;
}
}
int main(){
int n,k;
int a[100010];
int max=0,tmp;
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]>max)max=a[i];
}
tmp=a[1];
for(int i=1;i<=n-1;i++){
tmp=gcd(tmp,a[i]);
}
if(k<=max&&k%tmp==0){
cout<<”POSSIBLE”<<endl;
}else{
cout<<”IMPOSSIBLE”<<endl;
}
return 0;
}
| a.cc:61:7: error: extended character ” is not valid in an identifier
61 | cout<<”POSSIBLE”<<endl;
| ^
a.cc:61:7: error: extended character ” is not valid in an identifier
a.cc:65:7: error: extended character ” is not valid in an identifier
65 | cout<<”IMPOSSIBLE”<<endl;
| ^
a.cc:65:7: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:61:7: error: '\U0000201dPOSSIBLE\U0000201d' was not declared in this scope
61 | cout<<”POSSIBLE”<<endl;
| ^~~~~~~~~~
a.cc:65:7: error: '\U0000201dIMPOSSIBLE\U0000201d' was not declared in this scope
65 | cout<<”IMPOSSIBLE”<<endl;
| ^~~~~~~~~~~~
a.cc: In function 'int gcd(int, int)':
a.cc:37:1: warning: control reaches end of non-void function [-Wreturn-type]
37 | }
| ^
|
s770263913 | p03651 | C++ | あっとこーだー
#include <iostream>
using namespace std;
int gcd(int a,int b){
if(a>b){
if(a%b!=0){
gcd(b,a%b);
}else{
return b;
}
}else if(a<b){
if(b%a!=0){
gcd(a,b%a);
}else{
return a;
}
}else{
return a;
}
}
int main(){
int n,k;
int a[100010];
int max=0,tmp;
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]>max)max=a[i];
}
tmp=a[1];
for(int i=1;i<=n-1;i++){
tmp=gcd(tmp,a[i]);
}
if(k<=max&&k%tmp==0){
cout<<”POSSIBLE”<<endl;
}else{
cout<<”IMPOSSIBLE”<<endl;
}
return 0;
}
| a.cc:61:7: error: extended character ” is not valid in an identifier
61 | cout<<”POSSIBLE”<<endl;
| ^
a.cc:61:7: error: extended character ” is not valid in an identifier
a.cc:65:7: error: extended character ” is not valid in an identifier
65 | cout<<”IMPOSSIBLE”<<endl;
| ^
a.cc:65:7: error: extended character ” is not valid in an identifier
a.cc:1:1: error: '\U00003042\U00003063\U00003068\U00003053\U000030fc\U00003060\U000030fc' does not name a type
1 | あっとこーだー
| ^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/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)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/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]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/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:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/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:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/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:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/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:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/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:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/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:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been dec |
s253261428 | p03651 | C++ | #include <bits/stdc++.h>
#define fr first
#define sc second
#define mk make_pair
using namespace std;
int n, ar[1000001], k;
int main()
{
int mx = 0;
cin >> n >> k;
for(int i = 1; i <= n; i++)
scanf("%d", &ar[i]), mx = max(mx, ar[i]);
sort(ar + 1, ar + n + 1);
if(n == 1 && ar[1] == k)
{
cout << "POSSIBLE";
}else
if(mx < k || (n == 1 && ar[1] != k))
{
cout << "IMPOSSIBLE";
}else
{
int mn = 1e9;
for(int i = 2; i <= n; i++)
mn = min(ar[i] - ar[i - 1]);
int t = 1;
for(int i = 2; i <= n; i++)
if((ar[i] - ar[i - 1]) % mn != 0)
t = 0;
if(t)
cout << "IMPOSSIBLE";
else
cout << "POSSIBLE";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:31:21: error: no matching function for call to 'min(int)'
31 | mn = min(ar[i] - ar[i - 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed:
a.cc:31:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
31 | mn = min(ar[i] - ar[i - 1]);
| ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
|
s577322214 | p03651 | C++ | #include <bits/stdc++.h>
#define fr first
#define sc second
#define mk make_pair
using namespace std;
int n, ar[1000001], k;
int main()
{
int mx = 0;
cin >> n >> k;
for(int i = 1; i <= n; i++)
scanf("%d", &ar[i]), mx = max(mx, ar[i]);
sort(ar + 1, ar + n + 1);
if(n == 1 && ar[1] == k)
{
cout << "POSSIBLE";
}else
if(mx < k || (n == 1 && ar[1] != k))
{
cout << "IMPOSSIBLE";
}else
{
int mn = 1e9;
for(int i = 2; i <= n; i++)
mn = min(ar[i] - ar[i - 1]);
int t = 1;
for(int i = 2; i <= n; i++)
if((ar[i] - ar[i - 1]) % mn != 0)
t = 0;
if(t)
cout << "IMPOSSIBLE";
else
cout << "POSSIBLE";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:31:21: error: no matching function for call to 'min(int)'
31 | mn = min(ar[i] - ar[i - 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed:
a.cc:31:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
31 | mn = min(ar[i] - ar[i - 1]);
| ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
|
s612388287 | p03651 | C++ | #include<iostream>
#include<algorithm>
int N, K;
int A[100000],ma,gcd;
int main() {
std::cin >> N >> K;
for (int i = 0; i < N; i++) {
std::cin >> A[i];
}
std::sort(A[0], A[N - 1]);
if (A[N-1]< K) {
std::cout << "IMPOSSIBLE" << "\n";
}
else if (A[N-1] == K) {
std::cout << "POSSIBLE" << "\n";
}
else {
for (int j = 1; j <= A[N-1]-A[N-2]; j++) {
for (int s = 0; s < N; s++) {
if (A[s] % j != 0) {
break;
}
else if (s + 1 == N) {
gcd = j;
}
}
}
if (K%gcd == 0) {
std::cout << "POSSIBLE" << "\n";
}
else {
std::cout << "IMPOSSIBLE" << "\n";
}
}
system("pause");
return 0;
}
| In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:11: required from here
10 | std::sort(A[0], A[N - 1]);
| ~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int')
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int')
1782 | *__first = _GLIBCXX_MOVE(__val);
| ^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
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:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]':
/usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1777 | if (__comp(__i, __first))
| ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:11: required from here
10 | std::sort(A[0], A[N - 1]);
| ~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int')
45 | { return *__it1 < *__it2; }
| ^~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int')
45 | { return *__it1 < *__it2; }
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algo.h:61:
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1593 | std::__make_heap(__first, __middle, __comp);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:11: required from here
10 | std::sort(A[0], A[N - 1]);
| ~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
344 | _ValueType;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
346 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1596 | std::__pop_heap(__first, __middle, __i, __comp);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:11: required from here
10 | std::sort(A[0], A[N - 1]);
| ~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
258 | _ValueType;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:260:9: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
260 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:262:28 |
s688743846 | p03651 | C++ | import java.util.Scanner;
public class Main {
static int gcd(int x,int y)
{
return y>0?gcd(y,x%y):x;
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int max=0;
int g=0;
for (int i = 0; i < n; i++) {
int x=sc.nextInt();
g=gcd(g, x);
max=Math.max(max, x);
}
if(k%g==0 &&max>=k)
System.out.println("POSSIBLE");
else
System.out.println("IMPOSSIBLE");
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s151051755 | p03651 | C++ |
public class Main {
static int gcd(int x,int y)
{
return y>0?gcd(y,x%y):x;
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int max=0;
int g=0;
for (int i = 0; i < n; i++) {
int x=sc.nextInt();
g=gcd(g, x);
max=Math.max(max, x);
}
if(k%g==0 &&max>=k)
System.out.println("POSSIBLE");
else
System.out.println("IMPOSSIBLE");
}
}
| a.cc:2:1: error: expected unqualified-id before 'public'
2 | public class Main {
| ^~~~~~
|
s406534840 | p03651 | C++ | N,K,*A=(dd).split.map &:to_i;puts"#{:IM if K%A.reduce(:gcd)>0||K>A.max}POSSIBLE" | a.cc:1:1: error: 'N' does not name a type
1 | N,K,*A=(dd).split.map &:to_i;puts"#{:IM if K%A.reduce(:gcd)>0||K>A.max}POSSIBLE"
| ^
a.cc:1:30: error: 'puts' does not name a type
1 | N,K,*A=(dd).split.map &:to_i;puts"#{:IM if K%A.reduce(:gcd)>0||K>A.max}POSSIBLE"
| ^~~~
|
s987212871 | p03651 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,x;
scanf("%d%d",&n,&k);
int g = 0,maxn = 0;
for(int i = 1;i <= n;i++)
scanf("%d",&x),g = __gcd(g,x),maxn = max(maxn,x);
if(k <= maxn && k % g == 0)
printf("POSSIBLE\n");
else
printf("IMPOSSIBLE\n");
return 0;
| a.cc: In function 'int main()':
a.cc:15:14: error: expected '}' at end of input
15 | return 0;
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s855785820 | p03651 | C++ | #define all(x) x.begin(),x.end()
#define INF INT_MAX / 3
using namespace std;
set<int> A;
void hoge(set<int>::iterator i){
if(i == A.end()) return;
for(auto x : A)
A.insert(max(*i,x) - min(*i,x));
i++;
hoge(i);
}
int main(){
int N,K;
scanf("%d%d",&N,&K);
getchar();
string s,tmp;
getline(cin,s);
istringstream ss(s);
while(getline(ss,tmp,' ')){
int tmp2 = atoi(tmp.c_str());
A.insert(tmp2);
if(tmp2 == K){
printf("POSSIBLE\n");
return 0;
}
}
int size = A.size();
int pointer = 0;
hoge(A.begin());
bool found = false;
if(A.find(K) != A.end()) printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
return 0;
} | a.cc:5:1: error: 'set' does not name a type
5 | set<int> A;
| ^~~
a.cc:7:6: error: variable or field 'hoge' declared void
7 | void hoge(set<int>::iterator i){
| ^~~~
a.cc:7:11: error: 'set' was not declared in this scope
7 | void hoge(set<int>::iterator i){
| ^~~
a.cc:1:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
+++ |+#include <set>
1 | #define all(x) x.begin(),x.end()
a.cc:7:15: error: expected primary-expression before 'int'
7 | void hoge(set<int>::iterator i){
| ^~~
a.cc: In function 'int main()':
a.cc:19:2: error: 'scanf' was not declared in this scope
19 | scanf("%d%d",&N,&K);
| ^~~~~
a.cc:20:2: error: 'getchar' was not declared in this scope
20 | getchar();
| ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #define all(x) x.begin(),x.end()
a.cc:22:2: error: 'string' was not declared in this scope
22 | string s,tmp;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | #define all(x) x.begin(),x.end()
a.cc:23:10: error: 'cin' was not declared in this scope
23 | getline(cin,s);
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #define all(x) x.begin(),x.end()
a.cc:23:14: error: 's' was not declared in this scope
23 | getline(cin,s);
| ^
a.cc:23:2: error: 'getline' was not declared in this scope
23 | getline(cin,s);
| ^~~~~~~
a.cc:24:2: error: 'istringstream' was not declared in this scope
24 | istringstream ss(s);
| ^~~~~~~~~~~~~
a.cc:1:1: note: 'std::istringstream' is defined in header '<sstream>'; this is probably fixable by adding '#include <sstream>'
+++ |+#include <sstream>
1 | #define all(x) x.begin(),x.end()
a.cc:25:16: error: 'ss' was not declared in this scope
25 | while(getline(ss,tmp,' ')){
| ^~
a.cc:25:19: error: 'tmp' was not declared in this scope
25 | while(getline(ss,tmp,' ')){
| ^~~
a.cc:26:15: error: 'atoi' was not declared in this scope
26 | int tmp2 = atoi(tmp.c_str());
| ^~~~
a.cc:27:4: error: 'A' was not declared in this scope
27 | A.insert(tmp2);
| ^
a.cc:29:6: error: 'printf' was not declared in this scope
29 | printf("POSSIBLE\n");
| ^~~~~~
a.cc:29:6: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:33:13: error: 'A' was not declared in this scope
33 | int size = A.size();
| ^
a.cc:36:2: error: 'hoge' was not declared in this scope
36 | hoge(A.begin());
| ^~~~
a.cc:40:27: error: 'printf' was not declared in this scope
40 | if(A.find(K) != A.end()) printf("POSSIBLE\n");
| ^~~~~~
a.cc:40:27: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:41:7: error: 'printf' was not declared in this scope
41 | else printf("IMPOSSIBLE\n");
| ^~~~~~
a.cc:41:7: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
|
s430851049 | p03651 | C++ | #include <iostream>
#include <set>
#include <vector>
using namespace std;
/* A - Getting Difference */
static int const MAX = 10000;
int main()
{
int N, K;
cin >> N >> K; // N個, 整数Kを作りたい
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int flag = 1, set_size = 0;
while ( flag ) {
int n = A.size();
sort(A.begin(), A.end(), greater<int>()); // 降順
int to_set[MAX] = {}; to_set[n - 1] = A[n - 1];
int check, add = 0;
for ( int i = 0; i < n; i++ ) {
to_set[i] = A[i];
for ( int j = i + 1;j < n; j++ ) {
check = A[i] - A[j];
if (check == K) { // 終了条件1. Kと一致が得られる
cout << "POSSIBLE" << endl;
j = n;
i = n;
flag = 0;
}
A.push_back(check); // 終了じゃない場合は追加
to_set[++add] = check;
}
}
set<int> s(to_set, end(to_set));
// 終了条件 setが同じor Kをつくれた
if(set_size == s.size() && flag == 1) {
cout << "IMPOSSIBLE" << endl;
break;
}
set_size = s.size();
}
// set<int>::iterator it;
// for (it = s.begin(); it != s.end(); it++) {
// cout << *it << ' ';
// } cout << endl;
// }
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
24 | sort(A.begin(), A.end(), greater<int>()); // 降順
| ^~~~
| short
|
s455922747 | p03651 | C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#define ll long long
#define MAX 20000000000
#define MOD 1000000007
int main(void){
ll int N,K;
int A[100001]={0};
scanf("%lld%lld",&N,&K);
int i,flag=1;
ll int min=MAX,min2=MAX;
for(i=0;i<N;i++){
scanf("%d",&A[i]);
if(K==A[i]) { printf("POSSIBLE\n"); exit(0);}
if(A[i]>K) flag=0;
if(min>A[i]) {min2=min; min=A[i];}
else if(min2>A[i]) min2=A[i];
}
if(flag==1){ printf("IMPOSSIBLE\n"); exit(0);}
int lc;
for(i=2;i<=min;i++) if(min%i==0) {lc=i; break;}
flag=1;
int ppp=0;
for(i=0;i<N;i++){
if(A[i]%lc) { flag=0; break;}
if(i==N-1) ppp=1;
}
if(min==1) flag=0;
if(K%lc==0) flag=0;
if(ppp==1){
for(i=0;i<N;i++){
if(min!=A[i]) break;
if(i==N-1) flag=1;
}
for(i=0;i<N;i++){
if(A[i]%min) break;
if(i==N-1&&min!=lc) flag=1;}
if(K<min2-min) flag=1;
else flag=0;
if(K%)
}
if(flag==1) printf("IMPOSSIBLE\n");
else printf("POSSIBLE\n");
return 0;
} | main.c: In function 'main':
main.c:49:8: error: expected expression before ')' token
49 | if(K%)
| ^
|
s538911058 | p03651 | C++ | #include <iostream>
using namespace std;
long long int N, K;
long long int B;
long long int largest = 0;
unsigned long A[1000000000] = {};
bool flag[1000000001] = {};
long long int c=1;
long long int c2 = 1;
bool flag2 = false;
bool flag3 = false;
int main() {
cin >> N >> K;
for (int i = 1; i <= N; i++) {
cin >> B;
if (!flag[B]) {
A[c] = B;
if (largest < A[c])largest = A[c];
c++;
}
flag[B] = true;
if (B == K) {
cout << "POSSIBLE" << endl;
return 0;
}
}
if (c > largest / 2 && largest % 2 == 0) {
cout << "POSSIBLE" << endl;
return 0;
}
if (c > largest / 2 + 1 && largest % 2 == 1) {
cout << "POSSIBLE" << endl;
return 0;
}
if (K >= largest) {
cout << "IMPOSSIBLE" << endl;
return 0;
}
while (1) {
flag2 = true;
flag3 = false;
for (int i = c2+1; i <= c; i++) {
if (flag2)c2 = c;
for (int j = i + 1; j <= c; j++) {
if (!flag[abs((int)A[j] - (int)A[i])]) {
A[c + 1] = abs((int)A[j] - (int)A[i]);
for (int l = 1; l <= c; l++) {
if (l > K && (l - K) % (abs((int)A[j] - (int)A[i])) == 0) {
cout << "POSSIBLE" << endl;
return 0;
}
}
if (abs((int)A[j] - (int)A[i]) == K) {
cout << "POSSIBLE" << endl;
return 0;
}
flag[abs((int)A[j] - (int)A[i])] = true;
c++;
flag3 = true;
}
}
}
if (!flag3) {
cout << "IMPOSSIBLE" << endl;
return 0;
}
}
} | /tmp/ccHpY9f7.o: in function `main':
a.cc:(.text+0x65): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccHpY9f7.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccHpY9f7.o
a.cc:(.text+0x293): relocation truncated to fit: R_X86_64_PC32 against symbol `flag2' defined in .bss section in /tmp/ccHpY9f7.o
a.cc:(.text+0x29a): relocation truncated to fit: R_X86_64_PC32 against symbol `flag3' defined in .bss section in /tmp/ccHpY9f7.o
a.cc:(.text+0x2b4): relocation truncated to fit: R_X86_64_PC32 against symbol `flag2' defined in .bss section in /tmp/ccHpY9f7.o
a.cc:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccHpY9f7.o
a.cc:(.text+0x52e): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccHpY9f7.o
a.cc:(.text+0x54a): relocation truncated to fit: R_X86_64_PC32 against symbol `flag3' defined in .bss section in /tmp/ccHpY9f7.o
a.cc:(.text+0x586): relocation truncated to fit: R_X86_64_PC32 against symbol `flag3' defined in .bss section in /tmp/ccHpY9f7.o
collect2: error: ld returned 1 exit status
|
s633406896 | p03651 | C++ | #include<stdlib.h>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<queue>
#include<cmath>
#include<cstring>
using namespace std;
int n,k;
vector<int> a;
int use[100010];
int main()
{
cin>>n>>k;
for(int i=0;i<n;i++)
{
int s;
cin>>s;
if(s==k){
cout<<"POSSIBLE"<<endl;
return 0;
}
(use[s]==0||use[s]==1)a.push_back(s);
use[s]++;
}
use[0]==1;
for(int i=0;i<a.size();i++)
{
for(int j=0;j<a.size();j++)
{
int check=abs(a[i]-a[j]);
if(check==k){
//cout<<check;
cout<<"POSSIBLE"<<endl;
return 0;
}
if(use[check]==0||use[check]==1) a.push_back(check),use[check]++;
}
}
cout<<"IMPOSSIBLE"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:31:39: error: expected ';' before 'a'
31 | (use[s]==0||use[s]==1)a.push_back(s);
| ^
| ;
|
s468181917 | p03651 | C++ | #include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define s second
#define f first
#define mk make_pair
using namespace std;
main(){
int a,b,c,a1,b1,c1,x,y,z;
cin>>a>>b>>c>>x>>y>>z;
long int dp[2][a+3][b+3][c+3][100000000];
memset(dp,0,sizeof(dp));
vector<pair<int,pair<int,int> > >v[2];
while(1)v[0].push_back(mk(0,mk(0,0)));
if(a)dp[0][1][0][0]=x,v[0].push_back(mk(1,mk(0,0)));
if(b)dp[0][0][1][0]=y,v[0].push_back(mk(0,mk(1,0)));
if(c)dp[0][0][0][1]=z,v[0].push_back(mk(0,mk(0,1)));
for(int i=1;i<a+b+c;i++){
cin>>x>>y>>z;
set<pair<int,pair<int,int> > >se;//cout<<v[(i+1)%2].size()<<endl;
for(int j=0;j<v[(i+1)%2].size();j++){
//pair<int,pair<int,int> >p=v[(i+1)%2][j];
//a1=p.f,b1=p.s.f,c1=p.s.s;//cout<<a1<<b1<<c1<<endl;
// if(a1<a)dp[i%2][a1+1][b1][c1]=max(dp[i%2][a1+1][b1][c1],dp[(i+1)%2][a1][b1][c1]+x);
//if(b1<b)dp[i%2][a1][b1+1][c1]=max(dp[i%2][a1][b1+1][c1],dp[(i+1)%2][a1][b1][c1]+y);
//if(c1<c)dp[i%2][a1][b1][c1+1]=max(dp[i%2][a1][b1][c1+1],dp[(i+1)%2][a1][b1][c1]+z);
// p=mk(a1+1,mk(b1,c1));//if(a1<a)v[i%2].push_back(p);
//if(!se.count(p)&&a1<a)v[i%2].push_back(p),se.insert(p);
//p=mk(a1,mk(b1+1,c1));//if(b1<b)v[i%2].push_back(p);
//if(!se.count(p)&&b1<b)v[i%2].push_back(p),se.insert(p);
//p=mk(a1,mk(b1,c1+1));//if(c1<c)v[i%2].push_back(p);
//if(!se.count(p)&&c1<c)v[i%2].push_back(p),se.insert(p);
}
v[(i+1)%2].clear();
}
long int ans=0;
r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
cout<<ans<<endl;
return 0;
} | a.cc:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:14:22: error: incompatible types in assignment of 'int' to 'long int [100000000]'
14 | if(a)dp[0][1][0][0]=x,v[0].push_back(mk(1,mk(0,0)));
| ~~~~~~~~~~~~~~^~
a.cc:15:22: error: incompatible types in assignment of 'int' to 'long int [100000000]'
15 | if(b)dp[0][0][1][0]=y,v[0].push_back(mk(0,mk(1,0)));
| ~~~~~~~~~~~~~~^~
a.cc:16:22: error: incompatible types in assignment of 'int' to 'long int [100000000]'
16 | if(c)dp[0][0][0][1]=z,v[0].push_back(mk(0,mk(0,1)));
| ~~~~~~~~~~~~~~^~
a.cc:36:28: error: no matching function for call to 'max(long int&, long int [100000000])'
36 | r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:36:28: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long int [100000000]')
36 | r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:36:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
36 | r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s488670886 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 100010;
int a[maxN];
int main()
{
int n,k;
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
sort(a+1,a+1+n);
if(k > a[n])
{
printf("IMPOSSIBLE\n");
return 0;
}
int ans = _gcd(a[1],a[2]);
for(int i=1;i<n;i++)
{
int tmp = _gcd(a[i],a[i+1]);
ans = _gcd(ans,tmp);
}
if(k%ans == 0)
{
printf("POSSIBLE\n");
return 0;
}
for(int i=1;i<=n;i++)
a[i] = a[i]/ans;
k/=ans;
if(k > a[n])
{
printf("IMPOSSIBLE\n");
return 0;
}
if(ans ==1 || ans== k)
printf("POSSIBLE\n");
else
printf("IMPOSSIBLE\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:24:19: error: '_gcd' was not declared in this scope
24 | int ans = _gcd(a[1],a[2]);
| ^~~~
|
s704899393 | p03651 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
/*
int ceshi(int x,int y)
{
}
*/
int a[100005];
int main(int argc, char *argv[])
{
int n,k,t,i,maxs=0;
vector<int> x;
scanf("%d %d",&n,&k);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]==k){printf("POSSIBLE\n");exit(0);}
if(maxs<a[i])maxs=a[i];
x.push_back(a[i]);
}
if(k>maxs){printf("IMPOSSIBLE\n");exit(0);}
sort(a,a+n);
for(i=1;i<n;i++)
{
if(a[i]!=(a[i-1]+a[1]-a[0]))break;
}
if(i==n)
{
if(k%(a[1]-a[0])!=0){printf("IMPOSSIBLE\n");exit(0);}
else {printf("POSSIBLE\n");exit(0);}
}
int j=0,f,t,count=0;
while(1)
{
count++;
vector<int> ::iterator it1=x.begin(),it2=x.end();
int y,z,cha;
y=*it1;z=*it2;
cha=fabs(y-z);
if(cha==k){printf("POSSIBLE\n");exit(0);}
a[j][0]=y;a[j][1]=z;
//f=ceshi(a[j][0],a[j][1]);
x.push_back(y);x.push_back(z);
x.push_back(cha);
if(count>10000000){printf("IMPOSSIBLE\n");exit(0);}
}
return 0;
}
| a.cc: In function 'int main(int, char**)':
a.cc:43:19: error: redeclaration of 'int t'
43 | int j=0,f,t,count=0;
| ^
a.cc:18:17: note: 'int t' previously declared here
18 | int n,k,t,i,maxs=0;
| ^
a.cc:54:21: error: invalid types 'int[int]' for array subscript
54 | a[j][0]=y;a[j][1]=z;
| ^
a.cc:54:31: error: invalid types 'int[int]' for array subscript
54 | a[j][0]=y;a[j][1]=z;
| ^
|
s115136083 | p03651 | C | #include<stdio.h>
#include<stdlib.h>
int compare_int(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int main() {
int n, k;
int a[100010];
int i;
int flag = 1;
scanf("%d %d", &n, &k);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
if (a[i] == k) {
flag += 100;
}
}
mergesort(a, n, sizeof(int), compare_int);
int min = 1000000010;
for (i = 0; i < n-1; i++) {
if (min >= a[i+1] - a[i] && a[i+1] != a[i]) {
min = a[i+1] - a[i];
}
}
int min_a = a[0];
/*printf("%d\n", min_a);*/
int max_a = a[n-1];
/*printf("%d\n", max_a);*/
if (max_a < k) {
flag -= 100;
}
if ((k - min_a) % min == 0) {
flag += 10;
} else {
flag -= 10;
}
if (flag > 0) {
printf("POSSIBLE\n");
} else {
printf("IMPOSSIBLE\n");
}
return 0;
}
| main.c: In function 'main':
main.c:20:3: error: implicit declaration of function 'mergesort' [-Wimplicit-function-declaration]
20 | mergesort(a, n, sizeof(int), compare_int);
| ^~~~~~~~~
|
s529857119 | p03651 | C | #include<stdio.h>
#include<stdlib.h>
int compare_int(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int main() {
int n, k;
int a[100010];
int i;
int flag = 1;
scanf("%d %d", &n, &k);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
if (a[i] == k) {
flag += 100;
}
}
mergesort(a, n, sizeof(int), compare_int);
int min = 1000000010;
for (i = 0; i < n-1; i++) {
if (min >= a[i+1] - a[i] && a[i+1] != a[i]) {
min = a[i+1] - a[i];
}
}
int min_a = a[0];
/*printf("%d\n", min_a);*/
int max_a = a[n-1];
/*printf("%d\n", max_a);*/
if (max_a < k) {
flag -= 100;
}
if ((k - min_a) % min == 0) {
flag += 10;
} else {
flag -= 10;
}
if (flag > 0) {
printf("POSSIBLE\n");
} else {
printf("IMPOSSIBLE\n");
}
return 0;
}
| main.c: In function 'main':
main.c:20:3: error: implicit declaration of function 'mergesort' [-Wimplicit-function-declaration]
20 | mergesort(a, n, sizeof(int), compare_int);
| ^~~~~~~~~
|
s117603691 | p03651 | C++ | //#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
auto main() -> signed {
int n, k;
cin >> n >> k;
vector<int> v(n);
for(int i=0; i<n; ++i) cin >> v[i];
sort(v.begin(), v.end());
if(v[v.size()-1] < k) {
cout << "IMPOSSIBLE" << endl;
return 0;
}
set<int> st;
int f = 0;
for(int i=0; i<n; ++i) {
if(v[i]==k || v[i]==1) {
cout << "POSSIBLE" << endl;
return 0;
}
if(v[i]%2!=0) f++;
st.insert(v[i]);
}
if(f==0&&k%2!=0) {
cout << "IMPOSSIBLE" << endl;
return 0;
}
int c = 0;
set<int> st2 = st;
while(true) {
int m = v.size() - 1;
if(c==2000) {
if(k%2!==0)
cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}
st2 = st;
for(int i=0; i<m; ++i) {
int u = abs(v[i]-v[i+1]);
if(u==1 || u==k) {
cout << "POSSIBLE" << endl;
return 0;
}
if(st.find(u) == st.end()) {
v.push_back(u);
st.insert(u);
}
}
c++;
if(st2.size() == st.size()) {
cout << "IMPOSSIBLE" << endl;
return 0;
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:39:21: error: expected primary-expression before '=' token
39 | if(k%2!==0)
| ^
|
s345531318 | p03651 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long long getgcd(long long n, long long m)
{
while ((r = m % n) != 0) {
m = n;
n = r;
}
return n;
}
int main(){
long long N,K;
cin >> N >> K;
long long a;
vector <long long> b;
for(int i = 0;i<N;i++){
cin >> a;
b.push_back(a);
}
sort(b.begin(),b.end());
long long gcd = 0,k = 2;
gcd = getgcd(b[0],b[1]);
while(gcd != 1){
if(k >= b.size())
break;
gcd = getgcd(gcd,b[k]);
k++;
}
if(gcd == 1 ||(b.size() == 1 && b[0] == K))
cout << "POSSIBLE" << endl;
else if(K%gcd == 0 && b[b.size()-1] >= K){
cout << "POSSIBLE" << endl;
}
else
cout << "IMPOSSIBLE" << endl;
}
| a.cc: In function 'long long int getgcd(long long int, long long int)':
a.cc:9:11: error: 'r' was not declared in this scope
9 | while ((r = m % n) != 0) {
| ^
|
s074704227 | p03651 | C++ | #include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>
#include<cassert>
int main() {
int N, K;
std::cin >> N >> K;
std::vector<long long> A(N);
bool ok = false;
for (int i = 0; i < N; i++) {
std::cin >> A[i];
if (K <= A[i])
ok = true;
}
if (!ok) {
std::cout << "IMPOSSIBLE" << std::endl;
return;
}
std::sort(A.begin(), A.end());
bool flag = A[0] == 1 ? true : false;
unsigned int old_size = A.size() + 1;
while (old_size != A.size()) {
if (std::find(A.begin(), A.end(), K) != A.end()) { //見つかった
flag = true;
break;
}
//サイズを記録
old_size = A.size();
std::vector<long long> diff(old_size);
for (int i = 1; i < old_size; i++) {
diff[i] = A[i] % A[0];
}
for (int i = 1; i < old_size; i++) {
if (diff[i] == 1) {
flag = true;
break;
}
if (diff[i] != 0 && std::find(A.begin(), A.end(), diff[i]) == A.end()) { //まだ無いものだったら追加
A.push_back(diff[i]);
}
}
if (flag) break;
std::sort(A.begin(), A.end());
//for (int i = 0; i < A.size(); i++)
// std::cout << A[i] << " ";
//std::cout << std::endl;
}
if (flag)
std::cout << "POSSIBLE" << std::endl;
else
std::cout << "IMPOSSIBLE" << std::endl;
} | a.cc: In function 'int main()':
a.cc:26:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
26 | return;
| ^~~~~~
|
s235357735 | p03651 | C++ | #include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#include<math.h>
#include<memory>
#include<vector>
#include<bitset>
#include<fstream>
#include<stdio.h>
#include<utility>
#include<sstream>
#include<string.h>
#include<iostream>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define int long long
int x[100005],y[100005],z[100005];
struct edge
{
int y;
edge * next;
};
edge * li[100005];
edge * new_edge()
{
static edge a[200005];
static int top=0;
return &a[top++];
}
void inserts(int x,int y)
{
edge * t=new_edge();
t->y=y;
t->next=li[x];
li[x]=t;
}
void insert_edge(int x,int y)
{
inserts(x,y);
inserts(y,x);
}
int size[100005];
bool vis[100005];
void dfs(int x)
{
edge * t;
size[x]=1;
vis[x]=true;
for (t=li[x];t!=0;t=t->next)
{
if (vis[t->y]) continue;
dfs(t->y);
size[x]+=size[t->y];
}
}
int sizes(int x,int y)
{
if (size[x]>size[y]) swap(x,y);
return min(size[x],size[0]-size[x]);
}
bool size2(int x,int y)
{
if (size[x]>size[y]) swap(x,y);
return (size[x])==(size[0]-size[x]);
}
int main()
{
#ifdef absi2011
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
memset(li,0,sizeof(li));
int n;
scanf("%d",&n);
int i;
for (i=1;i<n;i++)
{
scanf("%d%d%d",&x[i],&y[i],&z[i]);
x[i]--;
y[i]--;
insert_edge(x[i],y[i]);
}
memset(vis,0,sizeof(vis));
dfs(0);
long long ans=0;
for (i=1;i<n;i++)
{
ans+=2*sizes(x[i],y[i])*(long long)z[i];
}
int mini=999999999;
long long lost=0;
for (i=1;i<n;i++)
{
if (size2(x[i],y[i])) lost+=z[i];
mini=min(mini,z[i]);
}
if (lost!=0) cout<<ans-lost<<endl; else cout<<ans-mini<<endl;
return 0;
}
| a.cc: In function 'void dfs(long long int)':
a.cc:52:5: error: reference to 'size' is ambiguous
52 | size[x]=1;
| ^~~~
In file included from /usr/include/c++/14/set:65,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:58:9: error: reference to 'size' is ambiguous
58 | size[x]+=size[t->y];
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:58:18: error: reference to 'size' is ambiguous
58 | size[x]+=size[t->y];
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc: In function 'long long int sizes(long long int, long long int)':
a.cc:63:9: error: reference to 'size' is ambiguous
63 | if (size[x]>size[y]) swap(x,y);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:63:17: error: reference to 'size' is ambiguous
63 | if (size[x]>size[y]) swap(x,y);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:64:16: error: reference to 'size' is ambiguous
64 | return min(size[x],size[0]-size[x]);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:64:24: error: reference to 'size' is ambiguous
64 | return min(size[x],size[0]-size[x]);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:64:32: error: reference to 'size' is ambiguous
64 | return min(size[x],size[0]-size[x]);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc: In function 'bool size2(long long int, long long int)':
a.cc:68:9: error: reference to 'size' is ambiguous
68 | if (size[x]>size[y]) swap(x,y);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:68:17: error: reference to 'size' is ambiguous
68 | if (size[x]>size[y]) swap(x,y);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:69:13: error: reference to 'size' is ambiguous
69 | return (size[x])==(size[0]-size[x]);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:69:24: error: reference to 'size' is ambiguous
69 | return (size[x])==(size[0]-size[x]);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
a.cc:69:32: error: reference to 'size' is ambiguous
69 | return (size[x])==(size[0]-size[x]);
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:47:5: note: 'long long int size [100005]'
47 | int size[100005];
| ^~~~
At global scope:
cc1plus: error: '::main' must return 'int'
|
s599408883 | p03651 | C++ | #include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;
int N, K;
int A[101010];
signed main()
{
cin >> N >> K;
bool odd = false, even = false;
bool baisu = true;
set<int> S;
REP(i,N) {
cin >> A[i];
S.insert(A[i]);
}
sort(A, A + N);
REP(i,N) {
if (A[i] % 2 == 0) {
even = true;
} else {
odd = true;
}
if (A[i] % A[0] != 0) baisu = false;
}
if (N == 1) {
if (A[0] == K) {
cout << "POSSIBLE" << endl;
} else {
cout << "IMPOSSIBLE" << endl;
}
return 0;
}
if (A[N-1] < K) {
cout << "IMPOSSIBLE" << endl;
return 0;
}
if (baisu) {
if (K % A[0] == 0) {
cout << "POSSIBLE" << endl;
} else {
cout << "IMPOSSIBLE" << endl;
}
return 0;
}
if (odd && !even) {
cout << "POSSIBLE" << endl;
} else if (odd && even) {
//cout << "POSSIBLE" << endl;
int minSa = 1e9 + 500;
FOR(i,1,N) {
minSa = min(A[i] - A[i-1]);
}
if (abs(A[N-1] - K) % minSa == 0) {
cout << "POSSIBLE" << endl;
} else {
cout << "IMPOSSIBLE" << endl;
}
} else if (!odd && even) {
if (K % 2 == 0) {
cout << "POSSIBLE" << endl;
} else {
cout << "IMPOSSIBLE" << endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:65:24: error: no matching function for call to 'min(int)'
65 | minSa = min(A[i] - A[i-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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed:
a.cc:65:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
65 | minSa = min(A[i] - A[i-1]);
| ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
|
s563351301 | p03651 | C++ | #include<stdlib.h>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<queue>
#include<cmath>
#include<cstring>
using namespace std;
int n,k;
vector<int> a;
int use[100010];
int main()
{
cin>>n>>k;
for(int i=0;i<n;i++)
{
int s;
cin>>s;
if(s==k){
cout<<"POSSIBLE"<<endl;
return 0;
}
use[s]++;
a.push_back(s);
}
for(int i=0;i<a.size();i++)
{
for(int j=0;j<a.size();j++)
{
int check=abs(a[i]-a[j]);
if(check==k){
cout<<"POSSIBLE"<<endl;
return 0;
}
if(use[check]==0||use[ckeck]==1) a.push_back(check),use[check]=1;
}
}
cout<<"IMPOSSIBLE"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:44:47: error: 'ckeck' was not declared in this scope; did you mean 'check'?
44 | if(use[check]==0||use[ckeck]==1) a.push_back(check),use[check]=1;
| ^~~~~
| check
|
s992329855 | p03651 | C++ | #include<iostream>
using namespace std;
__int64 ball[100010];
int main()
{
int n, k, i, flag = 0;
__int64 min = 1000000000, max = 0;
while (cin >> n >> k) {
flag = 0;
for (i = 1; i <= n; i++) {
cin >> ball[i];
if (ball[i] < min)min = ball[i];
if (ball[i] > max)max = ball[i];
if (ball[i] == k) { cout << "POSSIBLE" << endl; flag = 1; }
}
if (flag)continue;
if (k > max) { cout << "IMPOSSIBLE" << endl; continue; }
for (i = 1; i <= n; i++) {
if (ball[i] % min != 0) {
cout << "POSSIBLE" << endl;
flag = 1;
break;
}
}
if (flag)continue;
else { cout << "IMPOSSIBLE" << endl; }
}
return 0;
} | a.cc:3:1: error: '__int64' does not name a type; did you mean '__int64_t'?
3 | __int64 ball[100010];
| ^~~~~~~
| __int64_t
a.cc: In function 'int main()':
a.cc:7:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
7 | __int64 min = 1000000000, max = 0;
| ^~~~~~~
| __int64_t
a.cc:11:32: error: 'ball' was not declared in this scope
11 | cin >> ball[i];
| ^~~~
a.cc:17:23: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
17 | if (k > max) { cout << "IMPOSSIBLE" << endl; continue; }
| ~~^~~~~
a.cc:19:29: error: 'ball' was not declared in this scope
19 | if (ball[i] % min != 0) {
| ^~~~
|
s648993956 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k; cin >> n >> k;
set <int> a;
for (int i = 0; i < n; ++i)
{
int p;
scanf("%d", &p);
a.insert(p);
}
for (auto it = a.begin(); it != a.end(); ++it)
for (auto j = it; j != a.end(); ++j)
if (j != it) a.insert(abs(*it - *j));
for (set<int>::iterator it = a.begin(); it != a.end(); ++it)
{
if (*it == k) {
cout << "POSSIBLE" << endl;
return 0;
}
else if (*it > k)
{
for (set<int>::iterator it1 = a.begin(); it1 != a.end(); ++it1)
{
if (*it1 > (*it - k) / 2) break;
else if ((*it - k) % *it1 == 0) {
cout << "POSSIBLE" << endl;
return 0;
}
}
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc:2:1: error: extended character is not valid in an identifier
2 |
| ^
a.cc:4:1: error: extended character is not valid in an identifier
4 |
| ^
a.cc:8:1: error: extended character is not valid in an identifier
8 |
| ^
a.cc:15:1: error: extended character is not valid in an identifier
15 |
| ^
a.cc:19:1: error: extended character is not valid in an identifier
19 |
| ^
a.cc:39:1: error: extended character is not valid in an identifier
39 |
| ^
a.cc:2:1: error: '\U000000a0' does not name a type
2 |
| ^
a.cc:4:1: error: '\U000000a0' does not name a type
4 |
| ^
|
s072064335 | p03651 | C | #include<stdio.h>
int main()
{
long n,k,x,y,z,m;
long i, j;
scanf("%ld %ld", &n,&k);
for (i = 0; i < n; i++) {
if (i == 0) {
scanf("%ld", &y);
m = y;
continue;
}
scanf_s("%ld",&x);
if (x>m) {
m = x;
}
if (x < y) {
z = y;
y = x;
x = z;
}
while (x%y != 0) {
z = y;
y = x%y;
x = z;
}
}
if (k%y == 0&&k<=m) {
printf("POSSIBLE");
}else{
printf("IMPOSSIBLE");
}
return 0;
} | main.c: In function 'main':
main.c:16:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
16 | scanf_s("%ld",&x);
| ^~~~~~~
| scanf
|
s837459637 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k; cin >> n >> k;
set <int> a;
for (int i = 0; i < n; ++i)
{
int p;
scanf("%d", &p);
a.insert(p);
}
for (auto it = a.begin(); it != a.end(); ++it)
for (auto j = it + 1; j != a.end(); ++j)
a.insert(abs(*it - *j));
for (set<int>::iterator it = a.begin(); it != a.end(); ++it)
{
if (*it == k) {
cout << "POSSIBLE" << endl;
return 0;
}
else if (*it > k)
{
for (set<int>::iterator it1 = a.begin(); it1 != a.end(); ++it1)
{
if (*it1 > (*it - k) / 2) break;
else if ((*it - k) % *it1 == 0) {
cout << "POSSIBLE" << endl;
return 0;
}
}
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc:2:1: error: extended character is not valid in an identifier
2 |
| ^
a.cc:4:1: error: extended character is not valid in an identifier
4 |
| ^
a.cc:8:1: error: extended character is not valid in an identifier
8 |
| ^
a.cc:15:1: error: extended character is not valid in an identifier
15 |
| ^
a.cc:19:1: error: extended character is not valid in an identifier
19 |
| ^
a.cc:39:1: error: extended character is not valid in an identifier
39 |
| ^
a.cc:2:1: error: '\U000000a0' does not name a type
2 |
| ^
a.cc:4:1: error: '\U000000a0' does not name a type
4 |
| ^
|
s402857385 | p03651 | C++ | #include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>*/
#define pb push_back
#define mp make_pair
#define sz(s) ((int)(s.size()))
#define all(s) s.begin(), s.end()
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define per(i, n, a) for (int i = n; i >= a; --i)
#define onlycin ios_base::sync_with_stdio(false); cin.tie(0)
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
/*typedef tree<
pair < int, int >,
null_type,
less< pair < int, int > >,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
// find_by_order() order_of_key()
const int MAXN = (int)5e5+228;
const char nxtl = '\n';
const int mod = (int)1e9+7;
const double eps = (double)1e-7;
template<typename T> inline bool updmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<typename T> inline bool updmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}
int n, k, a[MAXN];
int main() {
#ifdef accepted
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
onlycin;
cin >> n >> k;
int g = 0;
rep(i, 1, n) {
cin >> a[i];
g = __gcd(g, a[i]);
if(a[i] == k) {
cout << "POSSIBLE";
return 0;
}
}
if(k > *max_element(a + 1, a + 1+ n)) {
cout << "IMPOSSIBLE\n";
return 0;
}
rep(i, 1, n) {
if(a[i] > k && (a[i] - k) % g == 0) {
cout << "POSSIBLE\n";
return 0;
}
}
else cout << "IMPOSSIBLE\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:60:9: error: 'else' without a previous 'if'
60 | else cout << "IMPOSSIBLE\n";
| ^~~~
|
s458624200 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k; cin >> n >> k;
set <int> a;
for (int i = 0; i < n; ++i)
{
int p;
scanf("%d", &p);
a.insert(p);
}
for (auto it = a.begin(); it != a.end() - 1; ++it)
for (auto j = it + 1; j != a.end(); ++j)
a.insert(abs(*it - *j));
for (set<int>::iterator it = a.begin(); it != a.end(); ++it)
{
if (*it == k) {
cout << "POSSIBLE" << endl;
return 0;
}
else if (*it > k)
{
for (set<int>::iterator it1 = a.begin(); it1 != a.end(); ++it1)
{
if (*it1 > (*it - k) / 2) break;
else if ((*it - k) % *it1 == 0) {
cout << "POSSIBLE" << endl;
return 0;
}
}
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:41: error: no match for 'operator-' (operand types are 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} and 'int')
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ~~~~~~~ ^ ~
| | |
| | int
| std::set<int>::iterator {aka std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator}
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::reverse_iterator<_Iterator>'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::move_iterator<_IteratorL>'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::complex<_Tp>'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
379 | operator-(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::complex<_Tp>'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: mismatched types 'const std::complex<_Tp>' and 'int'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:16:43: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:16:43: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::valarray<_Tp>'
16 | for (auto it = a.begin(); it != a.end() - 1; ++it)
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/val |
s133578105 | p03651 | C++ | #include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};
ll gcd(ll a, ll b){
if(b == 0) return a;
else return gcd(b, a%b);
}
signed main(){
int n,k;
cin >> n >> k;
vector<ll> a(n);
rep(n){
cin >> a[i];
if(a[i] == k){
cout << "POSSIBLE";
return 0;
}
}
if(*max_element(all(a)) < k){
cout << "IMPOSSIBLE";
return 0;
}
if(n == 1){
if(a[0] == k){
cout << "POSSIBLE";
}else{
cout << "IMPOSSIBLE";
}
return 0;
}
sort(all(a));
bool flag = false;
reppp(i, 2, n-1){
ll tmp = abs(a[i] - a[i-1]);
a.pb(tmp);
ll g = gcd(tmp, a[0])
if(g == 1 || g == k || tmp == k){
flag = true;
break;
}
}
if(flag){
cout << "POSSIBLE";
}else{
reppp(i, 1, n-1){
ll g = gcd(a[i], a[0]);
if(g == 1 || g == k){
cout << "POSSIBLE";
return 0;
}
}
cout << "IMPOSSIBLE";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:66:9: error: expected ',' or ';' before 'if'
66 | if(g == 1 || g == k || tmp == k){
| ^~
|
s178648979 | p03651 | C++ | #include<bits/stdc++.h>
using namespace std;
long long arr[1000000+5];
bool f(long long a[],long long n,long long m)
{
for(int i=0;i<n;i++)
if(a[i]==m)
return 0;
return 1;
}
bool yushu(long long a[],long long n)
{
for(long long i=1;i<n;i++)
{
if(a[i]%a[0]!=0)
return 0;
}
return 1;
}
int main()
{
long long N,K;
scanf("%lld%lld",&N,&K);
for(int i=0;i<N;i++)
{
scanf("%lld",&arr[i]);
if(K==arr[i])
{
printf("POSSIBLE\n");
return 0;
}
}
sort(arr,arr+N);
if(K>arr[N-1])
{
printf("IMPOSSIBLE\n");
return 0;
}
if(yushu(arr,N)&&K%a[0]!=0)
{
printf("IMPOSSIBLE\n");
return 0;
}
int i;
for(i=0;i<N;i++)
{
int j;
for(j=0;j<N;j++)
{
if(arr[j]!=arr[i])
if(f(arr,N,fabs(arr[i]-arr[j])))
{
printf("POSSIBLE\n");
return 0;
}
}
}
printf("IMPOSSIBLE\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:39:28: error: 'a' was not declared in this scope
39 | if(yushu(arr,N)&&K%a[0]!=0)
| ^
|
s221140872 | p03651 | C++ | #include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
int n,i,j,k,f,ff,g;f=0;
int a[100050];
a[0]=0;
scanf("%d%d",&n,&k);
g=n;
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
sort(a+1,a+n+1);
if(k>a[n])
printf("IMPOSSIBLE");
else
{
for(i=1;i<=n;i++)
a[++g]=a[n]-a[i];
sort(a+1;a+g+1);
for(i=1;i<=n;i++)
if(a[i]==k)
{
f=1;
break;
}
for(i=n;i>=1;i--)
if(a[i]==a[i-1]+1)
{
f=1;
break;
}
for(i=n;i>=1;i--)
if(a[i]==a[i-1]+2)
{
f=2;
break;
}
if(f==2)
{
for(i=1;i<=n;i++)
if(a[i]%2==1)
break;
if(i==n+1&&k%2==1)
f=0;
else
f=1;
}
if(f==1)
printf("POSSIBLE");
else
printf("IMPOSSIBLE");
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:17: error: expected ')' before ';' token
24 | sort(a+1;a+g+1);
| ~ ^
| )
a.cc:24:23: error: expected ';' before ')' token
24 | sort(a+1;a+g+1);
| ^
| ;
|
s499930165 | p03651 | C++ | #include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;
int main ()
{ int n,k,A[100000],l=0,m=0;
cin>>n>>k;
for (int i=0;i<n;i++)
{
cin>>A[i];
if (A[i]<k)
l++;
}
if (A[i]==k)
{
m++;
}
}
if (l==n)
{
cout<<"IMPOSSIBLE"<<endl;
}
else
{
cout<<"POSSIBLE"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:14: error: 'i' was not declared in this scope
18 | if (A[i]==k)
| ^
a.cc: At global scope:
a.cc:23:1: error: expected unqualified-id before 'if'
23 | if (l==n)
| ^~
a.cc:27:1: error: expected unqualified-id before 'else'
27 | else
| ^~~~
a.cc:32:1: error: expected unqualified-id before 'return'
32 | return 0;
| ^~~~~~
a.cc:33:1: error: expected declaration before '}' token
33 | }
| ^
|
s478483739 | p03651 | C++ | #include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr \
if (true) \
cerr
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;
// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
istringstream is(s);
T res;
is >> res;
return res;
}
template <class T> string to_s(const T &a) {
ostringstream os;
os << a;
return os.str();
}
void solve(long long N, long long K, vector<long long> A) {
sort(ALL(A));
reverse(ALL(A));
unordered_map<ll, bool> M;
if (A.back() > K) {
cout << "IMPOSSIBLE" << endl;
return;
}
bool odd = false, even = false;
REP(i, N) { M[A[i]] = true; }
ll size = M.size();
ll buf = size;
REP(i, N - 1) {
if (A[i] == K) {
cout << "POSSIBLE" << endl;
return;
}
for (int j = i + 1; j < N; ++j) {
if(!M[abs(a[i] - a[j]))
buf++;
}
}
if (size == buf) {
cout << "IMPOSSIBLE" << endl;
} else {
cout << "POSSIBLE" << endl;
}
}
int main() {
ios::sync_with_stdio(false);
long long K;
long long N;
cin >> N;
vector<long long> A(N - 1 + 1);
cin >> K;
for (int i = 0; i <= N - 1; i++) {
cin >> A[i];
}
solve(N, K, A);
return 0;
}
| a.cc: In function 'void solve(long long int, long long int, std::vector<long long int>)':
a.cc:71:17: error: 'a' was not declared in this scope
71 | if(!M[abs(a[i] - a[j]))
| ^
a.cc:71:29: error: expected ']' before ')' token
71 | if(!M[abs(a[i] - a[j]))
| ^
| ]
|
s336401631 | p03651 | C++ | #include <algorithm>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
# ifdef __GNUC__
# if __cplusplus > 199711L
# include <unordered_set>
# include <unordered_map>
# else
# include <tr1/unordered_map>
# include <tr1/unordered_set>
using namespace tr1;
# endif
# else
# include <unordered_map>
# include <unordered_set>
# endif
using namespace std;
#define fi first
#define se second
#define FO(x, n) for (int x = 0; x < n; ++x)
#define FOR(x, a, b) for (int x = a; x < b; ++x)
#define RFO(x, n) for (int x = n - 1; x >= 0; --x)
#define RFOR(x, a, b) for (int x = b - 1; x >= a; --x)
typedef unsigned char byte;
typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<llong, llong> pll;
inline bool feq(const double& a, const double& b) { return fabs(a - b) < 1e-10; }
const int MAXN = 100100;
int N, K;
int main()
{
while (cin >> N >> K)
{
set<int> vals;
FO (i, N)
{
int val;
cin >> val;
vals.insert(val);
}
if (vals.count(K))
{
cout << "POSSIBLE" << endl;
continue;
}
int mi = *(vals.begin());
int ma = *(--vals.end());
while (vals.size() > 1)
{
set<int> nxt;
for (auto it1 = vals.begin(), it2 = next(it1); it2 != vals.end(); it1 = it2++)
{
if (*it1 == 0)
continue;
nxt.insert(*it2 % *it1);
}
swap(vals, nxt);
if (*(vals.begin() != 0))
mi = min(mi, *(vals.begin()));
}
if (ma > K && (ma - K) % mi == 0)
cout << "POSSIBLE" << endl;
else
cout << "IMPOSSIBLE" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:78:32: error: no match for 'operator!=' (operand types are 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} and 'int')
78 | if (*(vals.begin() != 0))
| ~~~~~~~~~~~~ ^~ ~
| | |
| | int
| std::set<int>::iterator {aka std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator}
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::pair<_T1, _T2>'
78 | if (*(vals.begin() != 0))
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::reverse_iterator<_Iterator>'
78 | if (*(vals.begin() != 0))
| ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::reverse_iterator<_Iterator>'
78 | if (*(vals.begin() != 0))
| ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::move_iterator<_IteratorL>'
78 | if (*(vals.begin() != 0))
| ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::move_iterator<_IteratorL>'
78 | if (*(vals.begin() != 0))
| ^
In file included from /usr/include/c++/14/deque:63,
from a.cc:6:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_Tp1>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::allocator<_Tp1>'
78 | if (*(vals.begin() != 0))
| ^
In file included from /usr/include/c++/14/deque:66:
/usr/include/c++/14/bits/stl_deque.h:2342:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator!=(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2342 | operator!=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2342:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::deque<_Tp, _Alloc>'
78 | if (*(vals.begin() != 0))
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/deque:81:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2613 | operator!=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::tuple<_UTypes ...>'
78 | if (*(vals.begin() != 0))
| ^
In file included from /usr/include/c++/14/functional:59,
from a.cc:7:
/usr/include/c++/14/bits/std_function.h:761:5: note: candidate: 'template<class _Res, class ... _Args> bool std::operator!=(const function<_Res(_ArgTypes ...)>&, nullptr_t)'
761 | operator!=(const function<_Res(_Args...)>& __f, nullptr_t) noexcept
| ^~~~~~~~
/usr/include/c++/14/bits/std_function.h:761:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::function<_Res(_ArgTypes ...)>'
78 | if (*(vals.begin() != 0))
| ^
/usr/include/c++/14/bits/std_function.h:767:5: note: candidate: 'template<class _Res, class ... _Args> bool std::operator!=(nullptr_t, const function<_Res(_ArgTypes ...)>&)'
767 | operator!=(nullptr_t, const function<_Res(_Args...)>& __f) noexcept
| ^~~~~~~~
/usr/include/c++/14/bits/std_function.h:767:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: mismatched types 'const std::function<_Res(_ArgTypes ...)>' and 'int'
78 | if (*(vals.begin() != 0))
| ^
In file included from /usr/include/c++/14/unordered_map:41,
from /usr/include/c++/14/functional:63:
/usr/include/c++/14/bits/unordered_map.h:2151:5: note: candidate: 'template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> bool std::operator!=(const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&)'
2151 | operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/unordered_map.h:2151:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>'
78 | if (*(vals.begin() != 0))
| ^
/usr/include/c++/14/bits/unordered_map.h:2165:5: note: candidate: 'template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> bool std::operator!=(const unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, const unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&)'
2165 | operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/unordered_map.h:2165:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>'
78 | if (*(vals.begin() != 0))
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64:
/usr/include/c++/14/bits/stl_vector.h:2096:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator!=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2096 | operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2096:5: note: template argument deduction/substitution failed:
a.cc:78:35: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived f |
s627969925 | p03651 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 100100;
int n;
ll k;
ll arr[N];
int main() {
cin>>n>>k;
if(n < 100) {
while(true) {
seq--;
if(seq < 0) seq++;
}
}
ll maxm = 0;
int even = 0;
int odd = 0;
ll minm = 1ll<<50;
map<ll, int >counter;
bool check = false;
for(int i=0;i<n;i++) {
cin>>arr[i];
if(arr[i]%2==0) {
even++;
}
else {
odd++;
}
counter[arr[i]] ++ ;
maxm = max(maxm, arr[i]);
minm = min(minm, arr[i]);
if(arr[i] == k) {
check = true;
cout<<"POSSIBLE\n";
return 0;
}
}
if(maxm < k) {
cout<<"IMPOSSIBLE\n";
return 0;
}
ll diff = minm;
ll last = minm;
ll seq = 0;
for(auto x = counter.begin();x!=counter.end();x++) {
ll c = x->first;
if(c==last) continue;
if(c - last == diff) seq++;
last = c;
}
if(seq == counter.size()-1 ) {
for(int i=0;i<n;i++) {
if(arr[i] > k) {
if((arr[i] - k) % diff == 0) {
cout<<"POSSIBLE\n";
return 0;
}
}
}
cout<<"IMPOSSIBLE\n";
}
else {
if(even == n) {
if(k % 2 == 0) {
cout<<"POSSIBLE\n";
}
else {
cout<<"IMPOSSIBLE\n";
}
}
else if(odd == n) {
cout<<"POSSIBLE\n";
}
else if(even + odd == n && even!=n && odd!=n) {
cout<<"POSSIBLE\n";
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:13: error: 'seq' was not declared in this scope; did you mean '__pstl::execution::v1::seq'?
15 | seq--;
| ^~~
| __pstl::execution::v1::seq
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/pstl/execution_defs.h:42:46: note: '__pstl::execution::v1::seq' declared here
42 | _GLIBCXX17_INLINE constexpr sequenced_policy seq{};
| ^~~
|
s060270492 | p03651 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int gcd(int a, int b){
while(b){
int tmp = b;
b = a % b;
a = tmp;
}
return a;
}
int main(){
int n, k;
cin >> n >> k;
int a[n];
for(int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
if(a[n - 1] < k){
cout << "IMPOSSIBLE" << endl;
return 0;
}
int g = accumulate(a, a + n, a[0], [](int a, int b){return gcd(a, b);});
cout << (g == 1 ? "POSSIBLE" : "IMPOSSIBLE") << endl;
} | a.cc: In function 'int main()':
a.cc:24:17: error: 'accumulate' was not declared in this scope
24 | int g = accumulate(a, a + n, a[0], [](int a, int b){return gcd(a, b);});
| ^~~~~~~~~~
|
s694728281 | p03651 | C++ | #include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define upperlimit 1000100
#define INF 1000000100
#define INFL 1000000000000000100
#define eps 1e-8
#define endl '\n'
#define sd(n) scanf("%d",&n)
#define slld(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define plld(n) printf("%lld",n)
#define pds(n) printf("%d ",n)
#define pllds(n) printf("%lld ",n)
#define pdn(n) printf("%d\n",n)
#define plldn(n) printf("%lld\n",n)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define pb emplace_back
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define F first
#define S second
#define clr(a) memset(a,0,sizeof(a))
using namespace std;
ll gcd(ll n1,ll n2){
if(!n1)return n2;
if(!n2)return n1;
if(n1%n2==0)return n2;
return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent){
base%=mod;
ll ans=1;
while(exponent){
if(exponent&1)ans=(ans*base)%mod;
base=(base*base)%mod;
exponent/=2;
}
ans%=mod;
return ans;
}
int arr[upperlimit+1];
int main()
{
int n,i,j,k;
sd(n);sd(k);
int g=0;
ll sum=0;
for(i=1;i<=n;i++){
sd(arr[i]);
sum=max(sum,arr[i]);
g=gcd(g,arr[i]);
}
if(k%g==0 && k<=sum)printf("POSSIBLE");
else printf("IMPOSSIBLE");
return 0;
} | a.cc: In function 'int main()':
a.cc:59:16: error: no matching function for call to 'max(long long int&, int&)'
59 | sum=max(sum,arr[i]);
| ~~~^~~~~~~~~~~~
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:59:16: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
59 | sum=max(sum,arr[i]);
| ~~~^~~~~~~~~~~~
/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:59:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
59 | sum=max(sum,arr[i]);
| ~~~^~~~~~~~~~~~
|
s646846537 | p03651 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int n;
int k,a[100005];
cin>>n>>k;
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
int p=0,l=0;
if(k>a[n-1])
printf("IMPOSSIBLE");
else
{
for(int i=0;i<n;i++)
if(a[i]==k)
{
p=1;
l=1
printf("POSSIBLE");
break;
}
if(!p)
{
for(int j=n-1;j>=1;j--)
{
for(int i=n-2;i>=0;i--)
{
int m=a[j]-a[i];
for(int o=n-1;o>=0;o++)
if(k+m==a[o])
{
p=1;
break;
}
}
}
}
p&&!l?printf("POSSIBLE"):printf("IMPOSSIBLE");
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:20: error: expected ';' before 'printf'
24 | l=1
| ^
| ;
25 | printf("POSSIBLE");
| ~~~~~~
|
s170367443 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n , k ;
cin >> n >> k ;
set<int> s ;
int g ;
cin >> g;
for(int i = 1 ; i<n ; i++){
int a;
cin >> a;
g = __gcd(g,a);
s.insert(a);
}
if(k> *(--s.end())){
cout << "IMPOSSIBLE";
return 0 ;
}
if(s.count(k)){
cout << "POSSIBLE";
return 0 ;
}
if(g__gcd(g,k) != g) {
cout << "IMPOSSIBLE";
}
else cout << "POSSIBLE";
for(set<int>::iterator it2 = s.begin() , it1 = it2++ ; it2 != s.end(); it1++ ,it2++){
int d = *it2 - *it1;
if(!s.count(d)){
cout << "POSSIBLE";
return 0 ;
}
}
cout << "IMPOSSIBLE";
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:8: error: 'g__gcd' was not declared in this scope
26 | if(g__gcd(g,k) != g) {
| ^~~~~~
|
s762431594 | p03651 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
cin>>N>>K;
vector<int> num(N);
for(int i=0;i<N;i++)
cin>>num[i];
sort(num.begin(),num.end(),greater<int>());
bool flag=true;
int nn=num[1]-num[0];
for(int i=2;i<N;i++){
if(num[i]-num[i-1]!=nn)
flag=false;
}
if(num[num.size()-1]%nn!=0)
flag=false;
for(int i=0;i<N;i++){
if(num[i]==K)
flag=false;
}
if((num[0]<K||flag==true)&&){
cout<<"IMPOSSIBLE"<<endl;
}else{
cout<<"POSSIBLE"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:22:30: error: expected primary-expression before ')' token
22 | if((num[0]<K||flag==true)&&){
| ^
|
s936483022 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
typedef long long ll;
typedef pair<int, int> point;
set<int> s;
int main() {
int n, m; cin >> n >> m;
REP(i, n) {
int x; cin >> x;
s.insert(x);
}
vector<int> v;
for(auto x: s)
v.push_back(x);
v.push_back(-1);
v.push_back(-1);
v.push_back(-1);
if(v[2] == m || v[1] == m || v[0] == m) {
cout << "POSSIBLE";
return 0;
}
if(s.size() > 3 && *(--s.end()) >= m) {
cout << "POSSIBLE";
return 0;
}
if(s.size() < 3 && v[0] != m && v[1] != m) {
cout << "IMPOSSIBLE";
return 0;
}
if(s.size() == 3 && v[2] - v[1] = v[0]) {
cout << "IMPOSSIBLE";
return 0;
}
if(s.size() == 3 && *(--s.end()) >= m) {
cout << "POSSIBLE";
return 0;
}
cout << "IMPOSSIBLE";
}
| a.cc: In function 'int main()':
a.cc:45:20: error: lvalue required as left operand of assignment
45 | if(s.size() == 3 && v[2] - v[1] = v[0]) {
|
s122996798 | p03651 | C++ | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int hako[111111];
int main(void){
long long int n,k;
cin>>n>>k;
int i;
vector<long long int> a;
long long int maxt,mint;
maxt=0;
mint=11111111111;
int gu,ki;
gu=0;
for(i=0;i<n;i++){
int t;
cin>>t;
maxt=max(maxt,t);
mint=min(mint,t);
a.push_back(t);
if(t==k) gu=1;
}
if(maxt<k){
cout<<"IMPOSSIBLE"<<endl;
return 0;
}
if(gu==1){
cout<<"POSSIBLE"<<endl;
return 0;
}
bool flag=true;
for(i=0;i<n;i++){
if(a[i]%mint!=0) {
flag=false;
break;
}
}
if(flag) cout<<"IMPOSSIBLE"<<endl;
else cout<<"POSSIBLE"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:22:13: error: no matching function for call to 'max(long long int&, int&)'
22 | maxt=max(maxt,t);
| ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
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:22:13: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
22 | maxt=max(maxt,t);
| ~~~^~~~~~~~
/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:22:13: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
22 | maxt=max(maxt,t);
| ~~~^~~~~~~~
a.cc:23:13: error: no matching function for call to 'min(long long int&, int&)'
23 | mint=min(mint,t);
| ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:23:13: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
23 | mint=min(mint,t);
| ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:23:13: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
23 | mint=min(mint,t);
| ~~~^~~~~~~~
|
s710033239 | p03651 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
int a[100000+5];
int b[100000+5];
int coun1=0,coun2=0,m=0,flag=0;
int main()
{
int i,j,n,k;
cin>>n>>k;
memset(b,0,sizeof(b));
for(i=0;i<n;i++)
{
cin>>a[i];
b[a[i]]=1;
coun1++;
m=a[i]>m?a[i]:m;
if(a[i]==k) flag=1;
}
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
{
b[a[i]-a[j]]=1;
}
for(i=0;i<m+1;i++)
if(b[i]) coun2++;
if(m<k) printf("IMPOSSIBLE\n");
else if(coun1<coun2||flag) printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
} | a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
12 | memset(b,0,sizeof(b));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<iostream>
+++ |+#include <cstring>
3 | using namespace std;
|
s154791206 | p03651 | C++ | //coded by dsingh_24
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<long long,long long>
#define vll vector<long long>
#define all(a) (a).begin(),(a).end()
#define F first
#define S second
#define sz(x) (long long)x.size()
#define hell 1000000007
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
ios
ll n,k,i,j,x;
cin>>n>>k;
ll gcd;
for(i=0;i<n;i++)
{
cin>>x;
if(i==0)gcd=x;
else
gcd=__gcd(gcd,x);
if(x==k)
{
cout<<"POSSIBLE";return 0;
}
mx=max(mx,x);
}
if(mx<k)
{
cout<<"IMPOSSIBLE";
}else
if(k%gcd==0)cout<<"POSSIBLE\n";
else
cout<<"IMPOSSIBLE\n";
return 0;
}
| a.cc: In function 'int main()':
a.cc:34:17: error: 'mx' was not declared in this scope; did you mean 'x'?
34 | mx=max(mx,x);
| ^~
| x
a.cc:36:12: error: 'mx' was not declared in this scope; did you mean 'x'?
36 | if(mx<k)
| ^~
| x
|
s430876998 | p03651 | C++ | #include <iostream>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;
ll N, K, A[100000];
int main(void) {
cin >> N >> K;
REP(i, 0, N) cin >> A[i];
sort(A, A + N);
if(A[N - 1] < K) {
cout << "IMPOSSIBLE" << endl;
} else {
bool f = 0;
REP(i, 0, N) f = f || A[i] == K;
REP(i, 0, N - 1) f = f || (A[i + 1] - A[i] != A[0]);
cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
}
| a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(A, A + N);
| ^~~~
| short
|
s972786095 | p03651 | C++ | import sequtils,strutils,math
var
N,K : int
g : int
(N,K) = stdin.readline.split.map(parseInt)
var
A = stdin.readline.split.map(parseInt)
maxA = A[0]
g = A[0]
for a in A[1..A.high]:
maxA = max(maxA,a)
g = gcd(a,g)
if K > maxA or K mod g != 0:
echo "IMPOSSIBLE"
else:
echo "POSSIBLE" | a.cc:11:12: error: too many decimal points in number
11 | for a in A[1..A.high]:
| ^~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
1 | import sequtils,strutils,math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s698216913 | p03651 | C++ | #include "Select.h"
#if defined(A_CPP)
#include<iostream>
#include<cstdio>
#define _USE_MATH_DEFINES
#include<math.h>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<map>
#include<unordered_map>
#include<set>
#include <algorithm>
#include <utility>
using std::cin;
using std::cout;
using std::endl;
using std::string;
typedef unsigned long long ull;
#define Prime1 1000000007
#define Prime2 9999973
int i, j, k, l, m, n;
int H, W, N,K, M, Q;
int a, b, c;
//ユークリッドの互除法
int gcd(int a, int b) {
return b != 0 ? gcd(b, a % b) : a;
}
int main()
{
cin >> N >> K;
int Max = 0;
int GCD;
std::vector<int> A(N);
for (i = 0; i < N; i++)
{
cin >> A[i];
if (Max < A[i])Max = A[i];
}
if (Max < K)
{
cout << "IMPOSSIBLE\n";
return 0;
}
std::sort(A.begin(), A.end());
GCD = A[0];
for (i = 1; i < N; i++)
{
GCD = gcd(GCD, A[i]);
if (K%GCD == 0)
{
cout << "POSSIBLE\n";
return 0;
}
}
cout << "IMPOSSIBLE\n";
return 0;
}
#endif | a.cc:1:10: fatal error: Select.h: No such file or directory
1 | #include "Select.h"
| ^~~~~~~~~~
compilation terminated.
|
s279574663 | p03651 | C++ | def gcd(a,b)
while b:
a,b=b,a%b
return a
n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
if k in a:
print "POSSIBLE"
else:
while n!=1:
b=a.pop()
a[0]=gcd(a[0],b)
print "POSSIBLE" if k%a[0]==0 and (max(a)-min(a))>=k-1 else "IMPOSSIBLE" | a.cc:1:1: error: 'def' does not name a type
1 | def gcd(a,b)
| ^~~
|
s194755021 | p03651 | C++ | #include <iostream>
using namespace std;
int N, K;
int A[100000+5];
// int diff[100000+5];
bool solve()
{
sort(A, A+N);
int min_v = A[0];
int max_v = A[N-1];
if (K > max_v) {
return false;
}
for (int i = 1; i < N; ++i) {
if (A[i] == K)
return true;
if (A[i] - A[i-1] == 1)
return true;
}
return false;
}
int main()
{
cin.sync_with_stdio(false);
cin >> N >> K;
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
cout << (solve() ? "POSSIBLE" : "IMPOSSIBLE") << endl;
return 0;
} | a.cc: In function 'bool solve()':
a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
10 | sort(A, A+N);
| ^~~~
| short
|
s954444252 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define mod
#define maxm
#define maxn
int a[100010];
int main()
{
int n, m;
scanf("%d%d", &n, &m);
int fg = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
if (a[i] == m) fg = 1;
}
sort(a, a + n);
if (a[n - 1] < m) {
puts("IMPOSSIBLE");
} else if (fg) {
puts("POSSIBLE");
} else {
int x = a[0];
fg = 0;
for (int i = 1; i < n; i++) {
if (a[i] % x) {
fg = 1;
break;
}
}
if (fg || !fg && m % a[i] == 0) puts("POSSIBLE");
else puts("IMPOSSIBLE");
}
} | a.cc: In function 'int main()':
a.cc:33:40: error: 'i' was not declared in this scope
33 | if (fg || !fg && m % a[i] == 0) puts("POSSIBLE");
| ^
|
s015236357 | p03651 | C++ | import java.io.*;
import java.util.*;
import java.math.*;
class Main{
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
Integer[] nk = Arrays.stream(in.readLine().split(" ")).map(Integer::parseInt).toArray(Integer[]::new);
BigInteger[] values = Arrays.stream(in.readLine().split(" ")).map(s -> new BigInteger(s)).toArray(BigInteger[]::new);
for(int j=1;j<nk[0];j++){
if(values[0].gcd(values[j]).equals(BigInteger.ONE)){
System.out.println("POSSIBLE");
return;
}
}
System.out.println("IMPOSSIBLE");
return;
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.util.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.math.*;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:9: error: expected ':' before 'static'
8 | public static void main(String[] args) throws IOException {
| ^~~~~~~
| :
a.cc:8:27: error: 'String' has not been declared
8 | public static void main(String[] args) throws IOException {
| ^~~~~~
a.cc:8:36: error: expected ',' or '...' before 'args'
8 | public static void main(String[] args) throws IOException {
| ^~~~
a.cc:8:40: error: expected ';' at end of member declaration
8 | public static void main(String[] args) throws IOException {
| ^
| ;
a.cc:8:42: error: 'throws' does not name a type
8 | public static void main(String[] args) throws IOException {
| ^~~~~~
a.cc:21:2: error: expected ';' after class definition
21 | }
| ^
| ;
|
s171796138 | p03651 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)
ll Euclid(ll A, ll B){
if(A<B) swap(A, B);
ull C = B;
while(C != 0){
C = A%B;
A = B;
B = C;
}
return A;
}
int main(){
ll N, K;
cin >> N >> K;
ll A[N];
REP(i, N) cin >> A[i];
sort(A.begin(), A.end());
ll gcd = A[0];
REP(i, N) gcd = Euclid(gcd, A[i]);
cout << gcd << endl;
if(K%gcd==0 && K<=A[N-1]){
cout << "POSSIBLE" << endl;
}else{
cout << "IMPOSSIBLE" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:12: error: request for member 'begin' in 'A', which is of non-class type 'll [N]' {aka 'long long int [N]'}
28 | sort(A.begin(), A.end());
| ^~~~~
a.cc:28:23: error: request for member 'end' in 'A', which is of non-class type 'll [N]' {aka 'long long int [N]'}
28 | sort(A.begin(), A.end());
| ^~~
|
s352245538 | p03651 | C++ | #include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <complex>
#include <bitset>
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double ld;
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
int g = a[0];
int maxx = a[0];
for (int i = 1; i < n; ++i) {
g = __gcd(g, a[i]);`
maxx = max(maxx, a[i]);
}
if (k % g == 0 && k <= maxx) {
cout << "POSSIBLE\n";
} else {
cout << "IMPOSSIBLE\n";
}
} | a.cc:49:28: error: stray '`' in program
49 | g = __gcd(g, a[i]);`
| ^
|
s318948784 | p03651 | C++ | #include<bits/stdc++.h>
using namespace std; | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s703415656 | p03652 | C++ | #include <bits/stdc++.h>
#include <atcoder/mincostflow>
using namespace atcoder;
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;
ll LINF = 1e18;
int main(){
int n,m;cin >> n >> m;
int table[305][305];
rep(i,n)rep(j,m) cin >> table[i][j];
vector<int> ind(n,0);
map<int,int> exp;
int ans = n;
rep(i,m){
vector<int> cnt(m+1,0);
rep(j,n) {
int num = table[j][ind[j]];
cnt[num]++;
}
int id = 0,num = 0;
for(int j = 1;j <= m;j++) {
if(num < cnt[j]) {
id = j;
num = cnt[j];
}
}
//printf("%d %d\n",id,num);
ans = min(ans,num);
exp[id] = 1;
rep(j,n) {
while(exp[table[j][ind[j]]]) ind[j]++;
}
}
cout << ans << endl;
} | a.cc:2:10: fatal error: atcoder/mincostflow: No such file or directory
2 | #include <atcoder/mincostflow>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s268188760 | p03652 | C++ | #include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
int n,m;
cin >> n>> m;
mat a(n,vec(m));
rep(i,n) rep(j,m) cin >> a[i][j];a[i][j]--;
vector<bool> stop(M,false);
vec id(n,0),memo(m,0);//id:iのid[i]ばんめの競技について・memo:競技の人数
ll ans=n;
rep(roop,m){
rep(i,n){
while(stop[a[i][id[i]]])++id[i];//次の競技はどうか考える
++memo[a[i][id[i]]];//競技参加者
}
auto ite = max_element(ALL(memo));//最大要素をさす最初のいてれーた
ans = min(ans,*ite);
stop[ite-memo.begin()]=true;//ite-memo.begin()の競技が排除
rep(i,m)memo[i]=0;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:38:40: error: 'i' was not declared in this scope
38 | rep(i,n) rep(j,m) cin >> a[i][j];a[i][j]--;
| ^
a.cc:38:43: error: 'j' was not declared in this scope
38 | rep(i,n) rep(j,m) cin >> a[i][j];a[i][j]--;
| ^
a.cc:39:23: error: 'M' was not declared in this scope
39 | vector<bool> stop(M,false);
| ^
|
s006293936 | p03652 | C++ | /* in the name of Anton */
/*
Compete against Yourself.
Author - Aryan Choudhary (@aryanc403)
*/
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize ("-ffloat-store")
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n) for(i=0;i<(n);++i)
#define repA(i,j,n) for(i=(j);i<=(n);++i)
#define repD(i,j,n) for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) ((lli)(x).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"
typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;
const auto start_time = std::chrono::high_resolution_clock::now();
void aryanc403()
{
#ifdef ARYANC403
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = end_time-start_time;
cerr<<"Time Taken : "<<diff.count()<<"\n";
#endif
}
#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
#define dbg(args...)
#endif
const lli INF = 0xFFFFFFFFFFFFFFFL;
lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}
class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{ return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y )); }};
void add( map<lli,lli> &m, lli x,lli cnt=1)
{
auto jt=m.find(x);
if(jt==m.end()) m.insert({x,cnt});
else jt->Y+=cnt;
}
void del( map<lli,lli> &m, lli x,lli cnt=1)
{
auto jt=m.find(x);
if(jt->Y<=cnt) m.erase(jt);
else jt->Y-=cnt;
}
bool cmp(const ii &a,const ii &b)
{
return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}
const lli mod = 1000000007L;
// const lli maxN = 1000000007L;
lli T,n,i,j,k,in,cnt,u,v,x,y;
lli m;
string s;
vector<vi> a;
//priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .
bool chk(lli mm,vector<vi> a)
{
map<lli,vi> m;
dbg(mm,a)
fo(i,n)
m[a[i].back()].pb(i);
set<lli> rmv;
while(true)
{
vi rm,rmd;
for(auto &v:m)
{
if(sz(v.Y)<=mm)
continue;
for(auto y:v.Y)
rm.pb(y);
rmv.insert(v.X);
rmd.pb(v.X);
}
dbg(mm,rmd,m)
for(auto x:rmd)
m.erase(m.find(x));
if(rm.empty())
return true;
for(auto y:rm)
{
while(true)
{
if(a[y].empty())
return false;
auto jj=a[y].back();
if(rmv.find(jj)!=rmv.end())
{
a[y].pop_back();
continue;
}
break;
}
auto jj=a[y].back();
m[jj].pb(y);
}
}
return true;
}
int main(void) {
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
// freopen("txt.in", "r", stdin);
// freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{
cin>>n>>m;
a.resize(n,vi(m,0));
fo(i,n) fo(j,m)
cin>>a[i][m-1-j];
for(auto v:a)
dbg(v)
lli l=-1,r=n+2;
while(r-l>1)
{
lli mm=(l+r)/2;
if(chk(mm,a))
r=mm;
else
l=mm;
}
cout<<r<<endl;
} aryanc403();
return 0;
}
| a.cc: In function 'int main()':
a.cc:151:11: error: 'r' was not declared in this scope
151 | while(r-l>1)
| ^
a.cc:151:13: error: 'l' was not declared in this scope
151 | while(r-l>1)
| ^
a.cc:159:11: error: 'r' was not declared in this scope
159 | cout<<r<<endl;
| ^
|
s946368358 | p03652 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a) (a).begin(),(a).end()
#define elif else if
int low(V<int> &a,int b){
auto c=lower_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
int upp(V<int> &a,int b){
auto c=upper_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
template<class T>
void cou(vector<vector<T>> a){
int b=a.size();
int c=a[0].size();
fo(i,b){
fo(j,c){
cout<<a[i][j];
if(j==c-1)
cout<<endl;
else
cout<<' ';
}
}
}
int wari(int a,int b) {
if(a%b==0)
return a/b;
else
return a/b+1;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int souwa(int a){
return a*(a+1)/2;
}
int gcm(int a,int b){
if(a%b==0)
return b;
return gcm(b,a%b);
}
bool prime(int a){
if(a<2)
return false;
else if(a==2)
return true;
else if(a%2==0)
return false;
for(int i=3;i<=sqrt(a)+1;i+=2){
if (a%i==0)
return false;
}
return true;
}
struct Union{
vector<int> par;
Union(int a){
par=vector<int>(a,-1);
}
int find(int a){
if(par[a]<0)
return a;
else
return par[a]=find(par[a]);
}
bool same(int a,int b){
return find(a)==find(b);
}
int Size(int a){
return -par[find(a)];
}
void unite(int a,int b){
a=find(a);
b=find(b);
if(a==b)
return;
if(Size(b)>Size(a))
swap<int>(a,b);
par[a]+=par[b];
par[b]=a;
}
};
int ketas(int a){
string b=to_string(a);
int c=0;
fo(i,keta(a)){
c+=b[i]-'0';
}
return c;
}
bool fe(int a,int b){
a%=10;
b%=10;
if(a==0)
a=10;
if(b==0)
b=10;
if(a>b)
return true;
else
return false;
}
int INF=1000000007;
struct edge{int s,t,d; };
V<int> mojisyu(string a){
V<int> b(26,0);
fo(i,a.sz){
b[a[i]-'a']++;
}
return b;
}
int wa2(int a){
if(a%2==1)
return a/2;
return a/2-1;
}
/*signed main(){
int a,b,c;
cin>>a>>b>>c;
V<V<edge>> d(a);
fo(i,b){
edge e;
cin>>e.s>>e.t>>e.d;
d[e.s].pb(e);
}
V<int> e(a,INF);
e[c]=0;
priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f;
f.push({0,c});
int h=INF;
while(!f.empty()){
P<int,int> g;
g=f.top();
f.pop();
int v = g.second, i = g.first;
for(edge l : d[v]){
if(e[l.t] > i + l.d){
e[l.t] = i + l.d;
f.push({i+l.d , l.t});
}
}
}
fo(i,a){
if(e[i]==INF)
cout<<"INF"<<endl;
else
cout<<e[i]<<endl;
}
}
?*/
int nCr(int n,int r){
int a=1;
r=min(r,n-r);
for(int i=n;i>n-r;i--){
a*=i;
a/=n-i+1;
}
return a;
}
/*void sea(int x,int y){
if(x<0||a<=x||y<0||b<=y||c[x][y]=='#')
return;
if(d[x][y])
return;
d[x][y]++;
sea(x+1,y);
sea(x-1,y);
sea(x,y+1);
sea(x,y-1);
}*/
int kaijou(int a){
int b=1;
fo(i,a)
b*=i+1;
return b;
}
int nPr(int a,int b){
if(a<b)
return 0;
if(b==0)
return 1;
int c=1;
for(int i=a;i>a-b;i--){
c*=i;
c%=INF;
}
return c;
}
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
return modpow(a, mod - 2, mod);
}
int lcm(int a,int b){
int c=modinv(gcm(a,b),INF);
return ((a*c)%INF)*(b%INF)%INF;
}
int MOD=INF;
int fac[1000010], finv[1000010], inv[1000010];
// テーブルを作る前処理
//先にCOMinit()で前処理をする
//ABC145D
void COMinit() {
fac[0]=fac[1]=1;
finv[0]=finv[1]=1;
inv[1]=1;
for(int i=2;i<1000010;i++){
fac[i]=fac[i-1]*i%MOD;
inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
finv[i]=finv[i-1]*inv[i]%MOD;
}
}
// 二項係数計算
int COM(int n,int k){
if(n<k)
return 0;
if(n<0||k<0)
return 0;
return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
bool naka(int a,int b,V<V<char>> c){
return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz);
}
V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}};
int inf=1000000000000000007;
V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}};
//最短経路の表 a(全部INFで初期化)
//縦横 x,y
//迷路 f
//スタートsx,sy
//ゴールgx,gy
//文字はgから使おうね
/*int bfs_haba(){
Q<P<int,int>> b;
a[sx][sy]=0;
b.push({sx,sy});
while(!b.empty()){
P<int,int> c=b.front();
b.pop();
if(c.fi==gx&&c.se==gy){
break;
}
fo(i,4){
int d=c.fi+mawari4[i].fi;
int e=c.se+mawari4[i].se;
if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){
b.push({d,e});
a[d][e]=1+a[c.fi][c.se];
}
}
}
return a[gx][gy];
}*/
V<int> onajibubun(string a){
V<int> b(a.sz);
for(int i=1,j=0;i<a.sz;i++){
if(i+b[i-j]<j+b[j])
b[i]=b[i-j];
else{
int c=max<int>(0,j+b[j]-i);
while(i+c<a.sz&&a[c]==a[i+c])
c++;
b[i]=c;
j=i;
}
}
b[0]=a.sz;
return b;
}
//各頂点ごとにどこに辺が出てるかの表がc
//各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する
//aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ
V<int> color(200005);
bool nibu_hantei(int a,int b,V<V<int>> c){
color[a]=b;
fo(i,c[a].sz){
if(b==color[c[a][i]])
return false;
if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c))
return false;
}
return true;
}
//aは頂点数
//nibu_hanteiの上にcolorを用意する
//各頂点ごとにどこに辺が出てるかの表がc
bool renketujanai_nibu_hantei(int a,V<V<int>> c){
fo(i,a){
if(color[i]==0){
if(!nibu_hantei(i,1,c))
return false;
}
}
return true;
}
struct segmin{
vector<int> seg;
int b;
segmin(V<int> a){
b=1;
while(b<a.sz)
b*=2;
seg=vector<int>(2*b-1,inf);
fo(i,a.sz){
seg[i+b-1]=a[i];
}
for(int i=b-2;i>=0;i--){
seg[i]=min(seg[2*i+1],seg[2*i+2]);
}
}
void update(int i,int a){
i+=b-1;
seg[i]=a;
while(i){
i=(i-1)/2;
seg[i]=min(seg[2*i+1],seg[2*i+2]);
}
}
//最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで
//l,rは探すところ
int getmin(int x,int y,int a,int l,int r){
if(r==INF)
r=b;
if(r<=x||y<=l)
return INF;
if(x<=l&&r<=y)
return seg[a];
int a1=getmin(x,y,2*a+1,l,(l+r)/2);
int a2=getmin(x,y,2*a+2,(l+r)/2,r);
return min(a1,a2);
}
};
struct segadd{
vector<int> seg;
int b;
segadd(V<int> a){
b=1;
while(b<a.sz)
b*=2;
seg=vector<int>(2*b-1,0);
fo(i,a.sz){
seg[i+b-1]=a[i];
}
for(int i=b-2;i>=0;i--){
seg[i]=seg[2*i+1]+seg[2*i+2];
}
}
void update(int i,int a){
i+=b-1;
seg[i]=a;
while(i){
i=(i-1)/2;
seg[i]=seg[2*i+1]+seg[2*i+2];
}
}
//最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで
//l,rは探すところ
int getadd(int x,int y,int a,int l,int r){
if(r==INF)
r=b;
if(r<=x||y<=l)
return 0;
if(x<=l&&r<=y)
return seg[a];
int a1=getadd(x,y,2*a+1,l,(l+r)/2);
int a2=getadd(x,y,2*a+2,(l+r)/2,r);
return a1+a2;
}
};
struct sege{
vector<P<int,V<int>>> seg;
int b;
sege(string a){
b=1;
while(b<a.sz)
b*=2;
seg=vector<P<int,V<int>>>(2*b-1);
fo(i,a.sz){
seg[i+b-1].fi=1;
seg[i+b-1].se.pb(a[i]-'a');
}
for(int i=b-2;i>=0;i--){
V<int> d=seg[2*i+1].se;
fo(j,seg[2*i+2].se.sz){
d.pb(seg[2*i+2].se[j]);
}
Sort(d);
uni(d);
seg[i].se=d;
seg[i].fi=d.sz;
}
}
V<int> mu;
void update(int i,char a){
i+=b-1;
seg[i].se=mu;
seg[i].se.pb(a-'a');
seg[i].fi=1;
while(i){
i=(i-1)/2;
V<int> d=seg[2*i+1].se;
fo(j,seg[2*i+2].se.sz){
d.pb(seg[2*i+2].se[j]);
}
Sort(d);
uni(d);
seg[i].se=d;
seg[i].fi=d.sz;
}
}
void unko(){
fo(i,2*b-1)
cout<<seg[i].fi<<' ';
}
//最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで
//l,rは探すところ
P<int,V<int>> gete(int x,int y,int a,int l,int r){
if(r==INF)
r=b;
if(r<=x||y<=l)
return {0,mu};
if(x<=l&&r<=y)
return seg[a];
P<int,V<int>> a1=gete(x,y,2*a+1,l,(l+r)/2);
P<int,V<int>> a2=gete(x,y,2*a+2,(l+r)/2,r);
fo(i,a2.se.sz)
a1.se.pb(a2.se[i]);
Sort(a1.se);
uni(a1.se);
return {a1.se.sz,a1.se};
}
};/*
signed main(){
int a,b,c;
cin>>a>>b>>c;
V<V<edge>> d(a);
fo(i,b){
edge e;
cin>>e.s>>e.t>>e.d;
d[e.s].pb(e);
}
V<int> e(a,INF);
e[c]=0;
priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f;
f.push({0,c});
int h=INF;
while(!f.empty()){
P<int,int> g;
g=f.top();
f.pop();
int v = g.second, i = g.first;
for(edge l : d[v]){
if(e[l.t] > i + l.d){
e[l.t] = i + l.d;
f.push({i+l.d , l.t});
}
}
}
fo(i,a){
if(e[i]==INF)
cout<<"INF"<<endl;
else
cout<<e[i]<<endl;
}
}*/
//aのb乗mod c
int kurikaesijijou(int a,int b,int c){
a%=c;
b%=c;
if(b==0)
return 1;
if(b%2==0){
int d=kurikaesijijou(a,b/2,c);
d%=c;
return d*d%c;
}
return a*kurikaesijijou(a,b-1,c)%c;
}
signed main(){
int a,b;
cin>>a>>b;
V<Q<int>> c(a);
fo(i,a){
fo(j,b){
int d;
cin>>d;
c[i].push(d-1);
}
}
V<int> d(a);
int f=inf;
fo(i,b){
V<P<int,int>> e(b);
fo(j,b)
e[j].fi=j;
fo(j,a){
while(d[c[j].front()])
c[j].pop();
e[c[j].front].se++;
}
Sort(e);
rev(e);
d[e[0].fi]++;
f=min(f,e[0].se);
}
cout<<f<<endl;
} | a.cc: In function 'int main()':
a.cc:542:8: error: no match for 'operator[]' (operand types are 'std::vector<std::pair<long long int, long long int> >' and '<unresolved overloaded function type>')
542 | e[c[j].front].se++;
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; reference = std::pair<long long int, long long int>&; size_type = long unsigned int]'
1128 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'}
1128 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; const_reference = const std::pair<long long int, long long int>&; size_type = long unsigned int]'
1147 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'}
1147 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
|
s791828069 | p03652 | C++ | a | a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s365120701 | p03652 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> table(N, vector<int>(M));
for (int i =0; i < N; i++) for (int j = 0; j < M; j++) cin >> table[i][j];
for (int i = 0; i < N; i++) {
vector<int> buffer(M);
for (int j = 0;j < M;j++) {
buffer[table[i][j]-1] = j+1;
}
for (int j = 0; j < M;j++) table[i][j] = buffer[j];
}
int ans = N;
vector<bool> avail(M, true);
for (int q = 0; q < M; q++) {
vector<int> sums(M, 0);
for (int i =0; i < N; i++) {
int ma = M+1;
int ma_idx = -1;
for (int j = 0; j < M; j++) {
if (!avail[j]) continue;
if (table[i][j] < ma) {
ma = table[i][j];
ma_idx = j;
}
}
sums[ma_idx]++;
}
int mx = -1;
int mx_idx = -1;
for (int j = 0; j < M; j++) {
if (sums[j] > mx) {
mx = sums[j];
mx_idx = j;
}
}
avail[mx_idx] = false;
ans = min(ans, mx);
}
cout << ans << endl;
| a.cc: In function 'int main()':
a.cc:49:23: error: expected '}' at end of input
49 | cout << ans << endl;
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s003722218 | p03652 | C++ | #include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
int main() {
int in(N); int in(M);
int N, M; cin >> N >> M;
vector<queue<int>> A(N, queue<int>());
rep(i, N) rep(j, M) {
int a; cin >> a;
A[i].push(a);
}
set<int> used;
int ans = N;
rep(i, M) {
map<int, int> count;
rep(j, N) {
while (!A[j].empty() && used.find(A[j].front()) != used.end())
A[j].pop();
++count[A[j].front()];
}
int max_count = 0, max_num;
for (const auto& e : count) {
int num = e.first, count = e.second;
if (chmax(max_count, count))
max_num = num;
}
chmin(ans, max_count);
used.insert(max_num);
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:10: error: 'N' was not declared in this scope
13 | int in(N); int in(M);
| ^
a.cc:13:18: error: redeclaration of 'int in'
13 | int in(N); int in(M);
| ^~
a.cc:13:7: note: 'int in' previously declared here
13 | int in(N); int in(M);
| ^~
a.cc:13:21: error: 'M' was not declared in this scope
13 | int in(N); int in(M);
| ^
|
s706550260 | p03652 | C++ | ////////////////////////////////////////////
/// ///
/// Template ver. 1.2. rapel ///
/// Fear is Temporary, Regret is Forever ///
/// Must Try and Get AC ///
/// ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <math.h>
#include <complex>
#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define endl '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void desperate_optimization(int precision){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(precision);
}
const int N = 300;
int arr[N + 5][N + 5];
int idx[N + 5];
int mark[N + 5];
int occ[N + 5];
vector<int> who[N + 5];
priority_queue<pair<int,int> > pq;
void hora(int tc) {
int n, m;
cin>>n>>m;
for(int i = 1;i <= n;i++) {
for(int j = 1;j <= m;j++) cin>>arr[i][j];
idx[i] = 2;
occ[arr[i][1]]++;
who[arr[i][1]].pb(i);
}
int result = 0;
for(int i = 1;i <= m;i++) {
pq.push({occ[i], i});
result = max(result, occ[i]);
}
while(!pq.empty()) {
while(!pq.empty() && (mark[pq.top().S ]== 1 || occ[pq.top().S] != pq.top().F)) pq.pop();
if(!pq.empty()) {
int idx = pq.top().S;
pq.pop();
mark[idx] = 1;
for(auto x: who[idx]) {
for( ; idx[x] <= m; ) {
int val = arr[x][idx[x]];
idx[x]++;
if(mark[val] == 1) continue;
who[val].pb(x);
occ[val]++;
pq.push({occ[val], val});
break;
}
}
while(!pq.empty() && (mark[pq.top().S ]== 1 || occ[pq.top().S] != pq.top().F)) pq.pop();
if(pq.empty()) break;
result = min(result, pq.top().F);
}
}
cout<<result<<endl;
}
int main(){
desperate_optimization(10);
int ntc = 1;
//cin>>ntc;
for(int tc = 1;tc <= ntc;tc++) hora(tc);
return 0;
}
| a.cc: In function 'void hora(int)':
a.cc:88:43: error: invalid types 'int[int]' for array subscript
88 | for( ; idx[x] <= m; ) {
| ^
a.cc:89:61: error: invalid types 'int[int]' for array subscript
89 | int val = arr[x][idx[x]];
| ^
a.cc:90:44: error: invalid types 'int[int]' for array subscript
90 | idx[x]++;
| ^
|
s386437351 | p03652 | C++ | ////////////////////////////////////////////
/// ///
/// Template ver. 1.2. rapel ///
/// Fear is Temporary, Regret is Forever ///
/// Must Try and Get AC ///
/// ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <math.h>
#include <complex>
#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define endl '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void desperate_optimization(int precision){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(precision);
}
const int N = 300;
int arr[N + 5][N + 5];
int index[N + 5];
int mark[N + 5];
int occ[N + 5];
vector<int> who[N + 5];
priority_queue<pair<int,int> > pq;
void hora(int tc) {
int n, m;
cin>>n>>m;
for(int i = 1;i <= n;i++) {
for(int j = 1;j <= m;j++) cin>>arr[i][j];
index[i] = 2;
occ[arr[i][1]]++;
who[arr[i][1]].pb(i);
}
int result = 0;
for(int i = 1;i <= m;i++) {
pq.push({occ[i], i});
result = max(result, occ[i]);
}
while(!pq.empty()) {
while(!pq.empty() && (mark[pq.top().S ]== 1 || occ[pq.top().S] != pq.top().F)) pq.pop();
if(!pq.empty()) {
int idx = pq.top().S;
pq.pop();
mark[idx] = 1;
for(auto x: who[idx]) {
for( ; index[x] <= m; ) {
int val = arr[x][index[x]];
index[x]++;
if(mark[val] == 1) continue;
who[val].pb(x);
occ[val]++;
pq.push({occ[val], val});
break;
}
}
while(!pq.empty() && (mark[pq.top().S ]== 1 || occ[pq.top().S] != pq.top().F)) pq.pop();
if(pq.empty()) break;
result = min(result, pq.top().F);
}
}
cout<<result<<endl;
}
int main(){
desperate_optimization(10);
int ntc = 1;
//cin>>ntc;
for(int tc = 1;tc <= ntc;tc++) hora(tc);
return 0;
}
| a.cc:60:16: error: 'int index [305]' redeclared as different kind of entity
60 | int index[N + 5];
| ^
In file included from /usr/include/string.h:462,
from a.cc:15:
/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 'void hora(int)':
a.cc:72:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
72 | index[i] = 2;
| ^
a.cc:88:45: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
88 | for( ; index[x] <= m; ) {
| ^
a.cc:89:63: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
89 | int val = arr[x][index[x]];
| ^
a.cc:90:46: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
90 | index[x]++;
| ^
|
s319045796 | p03652 | C++ | ok | a.cc:1:1: error: 'ok' does not name a type
1 | ok
| ^~
|
s336471450 | p03652 | C++ | int N, M, res, A[300][300], c[300];
bool b[300];
int main() {
cin >> N >> M;
res = 0xE869120;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M; ++j) {
cin >> A[i][j];
}
}
for (int i = 0; i < M; ++i) {
b[i] = true;
}
for (int i = 0; i < M; ++i) {
for (int j = 0; j < M; ++j) {
c[j] = 0;
}
for (int j = 0; j < N; ++j) {
pair<int, int>p = mkp(-1, -1);
for (int k = 0; k < M; ++k) {
if (b[k]) {
p = max(p, mkp(A[j][k], k));
}
}
++c[p.second];
}
pair<int, int> MAX = mkp(-1, -1);
for (int j = 0; j < M; ++j) {
MAX = max(MAX, mkp(c[j], j));
}
res = min(res, MAX.first);
b[MAX.second] = false;
}
cout << res << endl;
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
6 | cin >> N >> M;
| ^~~
a.cc:21:25: error: 'pair' was not declared in this scope
21 | pair<int, int>p = mkp(-1, -1);
| ^~~~
a.cc:21:30: error: expected primary-expression before 'int'
21 | pair<int, int>p = mkp(-1, -1);
| ^~~
a.cc:24:41: error: 'p' was not declared in this scope
24 | p = max(p, mkp(A[j][k], k));
| ^
a.cc:24:52: error: 'mkp' was not declared in this scope
24 | p = max(p, mkp(A[j][k], k));
| ^~~
a.cc:24:45: error: 'max' was not declared in this scope
24 | p = max(p, mkp(A[j][k], k));
| ^~~
a.cc:27:29: error: 'p' was not declared in this scope
27 | ++c[p.second];
| ^
a.cc:29:17: error: 'pair' was not declared in this scope
29 | pair<int, int> MAX = mkp(-1, -1);
| ^~~~
a.cc:29:22: error: expected primary-expression before 'int'
29 | pair<int, int> MAX = mkp(-1, -1);
| ^~~
a.cc:31:25: error: 'MAX' was not declared in this scope
31 | MAX = max(MAX, mkp(c[j], j));
| ^~~
a.cc:31:40: error: 'mkp' was not declared in this scope
31 | MAX = max(MAX, mkp(c[j], j));
| ^~~
a.cc:31:31: error: 'max' was not declared in this scope
31 | MAX = max(MAX, mkp(c[j], j));
| ^~~
a.cc:33:32: error: 'MAX' was not declared in this scope
33 | res = min(res, MAX.first);
| ^~~
a.cc:33:23: error: 'min' was not declared in this scope; did you mean 'main'?
33 | res = min(res, MAX.first);
| ^~~
| main
a.cc:36:9: error: 'cout' was not declared in this scope
36 | cout << res << endl;
| ^~~~
a.cc:36:24: error: 'endl' was not declared in this scope
36 | cout << res << endl;
| ^~~~
|
s118840679 | p03652 | C++ | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUGGING
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
namespace __init {
struct InitIO {
InitIO() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(30);
}
} init_io;
}
#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#endif
template <typename T>
T make_v(T init) { return init; }
template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
return V<decltype(rec)>(s, rec);
#undef rec
}
int main() {
ll N, M;
cin >> N >> M;
auto A = make_v(0, N, M);
for(auto &v : A) for(auto &e : v) {
cin >> e;
e--;
}
for(ll ans = 1; ans <= N; ans++) {
V<bool> ok(N, true);
V<ll> idxv(N, 0);
bool suc = true;
while(true) {
V<ll> cnt(M, 0);
V<bool> ng(M, false);
for(ll i = 0; i < N; i++) {
ll idx = idxv[i];
cnt[A[i][idx]]++;
}
for(ll i = 0; i < M; i++) ng[i] = (cnt[i] > ans);
bool bflag = false;
bool check = true;
for(ll i = 0; i < N; i++) {
ll &idx = idxv[i];
if(!ok[A[i][idx]] || ng[A[i][idx]]) {
check = false;
idx++;
if(idx >= M) {
bflag = true;
break;
}
}
}
if(check) break;
if(bflag) {
suc = false;
break;
}
}
if(suc) {
cout << ans << endl;
return 0;
}
}
assert(false);
}
| a.cc:34:10: fatal error: ../debug.cpp: No such file or directory
34 | #include "../debug.cpp"
| ^~~~~~~~~~~~~~
compilation terminated.
|
s225131800 | p03652 | C++ | #include<bits/stdc++.h>#define ff(x,a,b) for(int x=a;x<=b;x++)using namespace std;int n,m,a[505][505],mark[505],ans,sum,s[505],t[505],tt[505];int main(){ cin>>n>>m; ff(i,1,n) ff(j,1,m) cin>>a[i][j]; ans=n;ff(i,1,n) t[i]=a[i][1];ff(i,1,n) tt[i]=1;sum=m; while(sum>0) { ff(i,1,m) s[i]=0; ff(i,1,n) s[t[i]]++; int k=1; ff(i,2,m) if(s[k]<s[i]) k=i; ans=min(ans,s[k]); mark[k]=1;sum--; ff(i,1,n) while(mark[t[i]]==1) t[i]=a[i][++tt[i]]; } cout<<ans;} | a.cc:1:24: warning: extra tokens at end of #include directive
1 | #include<bits/stdc++.h>#define ff(x,a,b) for(int x=a;x<=b;x++)using namespace std;int n,m,a[505][505],mark[505],ans,sum,s[505],t[505],tt[505];int main(){ cin>>n>>m; ff(i,1,n) ff(j,1,m) cin>>a[i][j]; ans=n;ff(i,1,n) t[i]=a[i][1];ff(i,1,n) tt[i]=1;sum=m; while(sum>0) { ff(i,1,m) s[i]=0; ff(i,1,n) s[t[i]]++; int k=1; ff(i,2,m) if(s[k]<s[i]) k=i; ans=min(ans,s[k]); mark[k]=1;sum--; ff(i,1,n) while(mark[t[i]]==1) t[i]=a[i][++tt[i]]; } cout<<ans;}
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s706679221 | p03652 | C++ | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const int inf = 1e9 + 7;
const int mnx = 5e2 + 9;
int a[mnx][mnx];
bool del[mnx];
int ptr[mnx];
int cnt[mnx];
int n, m;
bool check(int lim){
for(int i = 1; i <= n; i++){
ptr[i] = 1;
}
for(int i = 1; i <= m; i++){
del[i] = 0;
}
while(true){
for(int i = 1; i <= m; i++){
cnt[i] = 0;
}
for(int i = 1; i <= n; i++){
cnt[a[i][ptr[i]]]++;
}
bool found = 0;
for(int i = 1; i <= m; i++){
if (cnt[i] > lim) {
del[i] = 1;
found = 1;
}
}
if(!found){
break;
}
for(int i = 1; i <= n; i++){
while(ptr[i] <= m && del[a[i][ptr[i]]]) {
ptr[i]++;
}
if (ptr[i] > m) {
return 0;
}
}
}
return 1;
}
int main(){
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> a[i][j]);
}
}
int l = 1, r = n, ans = 0;
while(l <= r){
int mid = (l + r) >> 1;
if(check(mid)){ r = mid - 1; ans = mid; }
else{ l = mid + 1; }
}
cout << ans << '\n';
return 0;
}
| a.cc: In function 'int main()':
a.cc:56:23: error: expected ';' before ')' token
56 | cin >> a[i][j]);
| ^
| ;
|
s014130151 | p03652 | C | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <iostream>
#include <queue>
#define ll long long
#define ri register int
using std::min;
using std::max;
template <class T>inline void read(T &x){
x=0;int ne=0;char c;
while(!isdigit(c=getchar()))ne=c=='-';
x=c-48;
while(isdigit(c=getchar()))x=(x<<3)+(x<<1)+c-48;
x=ne?-x:x;return ;
}
const int maxn=305;
const int inf=0x7fffffff;
int a[maxn][maxn];
int n,m;
bool ok[maxn];
int cnt[maxn],ans=inf;
int main(){
int mx,p;
read(n),read(m);
for(ri i=1;i<=n;i++){
for(ri j=1;j<=m;j++){
read(a[i][j]);
}
}
for(ri k=1;k<=m;k++){
memset(cnt,0,sizeof(cnt));
for(ri i=1;i<=n;i++){
for(ri j=1;j<=m;j++){
if(!ok[a[i][j]]){
cnt[a[i][j]]++;
break;
}
}
}
mx=0,p=0;
for(ri i=1;i<=m;i++){
if(cnt[i]>mx)mx=cnt[i],p=i;
}
ok[p]=1;
ans=min(ans,mx);
}
printf("%d\n",ans);
return 0;
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s769134502 | p03652 | C++ | /*input
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
out<<'('<<P.F<<','<<P.S<<')';
return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;
ll mypow(ll a,ll b){
ll res=1LL;
while(b){
if(b&1) res=res*a%MOD;
a=a*a%MOD;
b>>=1;
}
return res;
}
int main()
{
auto i=time();
int n,m;
cin>>n>>m;
int tmp=n*100+m;
while((double)(time()-i)/CLOCKS_PER_SEC*1000<tmp){
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:58:14: error: too few arguments to function 'time_t time(time_t*)'
58 | auto i=time();
| ~~~~^~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
from a.cc:3:
/usr/include/time.h:76:15: note: declared here
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc:62:22: error: too few arguments to function 'time_t time(time_t*)'
62 | while((double)(time()-i)/CLOCKS_PER_SEC*1000<tmp){
| ~~~~^~
/usr/include/time.h:76:15: note: declared here
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
|
s423848088 | p03652 | C++ | /*input
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
out<<'('<<P.F<<','<<P.S<<')';
return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;
ll mypow(ll a,ll b){
ll res=1LL;
while(b){
if(b&1) res=res*a%MOD;
a=a*a%MOD;
b>>=1;
}
return res;
}
int main()
{
return 0;
}
/*input
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
out<<'('<<P.F<<','<<P.S<<')';
return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;
ll mypow(ll a,ll b){
ll res=1LL;
while(b){
if(b&1) res=res*a%MOD;
a=a*a%MOD;
b>>=1;
}
return res;
}
int main()
{
auto i=time();
int n,m;
cin>>n>>m;
int tmp=n*100+m;
while((double)(time()-i)/CLOCKS_PER_SEC*1000<tmp){
}
return 0;
}
| a.cc:92:10: error: attribute value 'tune=native' was already specified in 'target' attribute
92 | ostream& operator<<(ostream& out,pair<T1,T2> P){
| ^~~~~~~~
a.cc:92:10: error: redefinition of 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)'
a.cc:32:10: note: 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)' previously declared here
32 | ostream& operator<<(ostream& out,pair<T1,T2> P){
| ^~~~~~~~
a.cc:97:10: error: redefinition of 'const ll maxn'
97 | const ll maxn=300005;
| ^~~~
a.cc:37:10: note: 'const ll maxn' previously defined here
37 | const ll maxn=300005;
| ^~~~
a.cc:98:10: error: redefinition of 'const ll maxlg'
98 | const ll maxlg=__lg(maxn)+2;
| ^~~~~
a.cc:38:10: note: 'const ll maxlg' previously defined here
38 | const ll maxlg=__lg(maxn)+2;
| ^~~~~
a.cc:99:10: error: redefinition of 'const ll INF64'
99 | const ll INF64=8000000000000000000LL;
| ^~~~~
a.cc:39:10: note: 'const ll INF64' previously defined here
39 | const ll INF64=8000000000000000000LL;
| ^~~~~
a.cc:100:11: error: redefinition of 'const int INF'
100 | const int INF=0x3f3f3f3f;
| ^~~
a.cc:40:11: note: 'const int INF' previously defined here
40 | const int INF=0x3f3f3f3f;
| ^~~
a.cc:101:10: error: redefinition of 'const ll MOD'
101 | const ll MOD=ll(1e9+7);
| ^~~
a.cc:41:10: note: 'const ll MOD' previously defined here
41 | const ll MOD=ll(1e9+7);
| ^~~
a.cc:102:14: error: redefinition of 'const double PI'
102 | const double PI=acos(-1);
| ^~
a.cc:42:14: note: 'const double PI' previously defined here
42 | const double PI=acos(-1);
| ^~
a.cc:106:4: error: attribute value 'tune=native' was already specified in 'target' attribute
106 | ll mypow(ll a,ll b){
| ^~~~~
a.cc:106:4: error: redefinition of 'll mypow(ll, ll)'
a.cc:46:4: note: 'll mypow(ll, ll)' previously defined here
46 | ll mypow(ll a,ll b){
| ^~~~~
a.cc:116:5: error: attribute value 'tune=native' was already specified in 'target' attribute
116 | int main()
| ^~~~
a.cc:116:5: error: redefinition of 'int main()'
a.cc:56:5: note: 'int main()' previously defined here
56 | int main()
| ^~~~
a.cc: In function 'int main()':
a.cc:118:14: error: too few arguments to function 'time_t time(time_t*)'
118 | auto i=time();
| ~~~~^~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
from a.cc:3:
/usr/include/time.h:76:15: note: declared here
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc:122:22: error: too few arguments to function 'time_t time(time_t*)'
122 | while((double)(time()-i)/CLOCKS_PER_SEC*1000<tmp){
| ~~~~^~
/usr/include/time.h:76:15: note: declared here
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
|
s358293829 | p03652 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct newdata
{
int label,cnt;
};
int n,m;
int a[301][301];
newdata rank[301];
bool used[301];
bool cmp(newdata i,newdata j)
{
return (i.cnt>j.cnt);
}
int main()
{
scanf("%d%d",&n,&m);
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
{
scanf("%d",&a[i][j]);
if (j==1) rank[a[i][j]].cnt++;
}
int now=0;
for (int i=1;i<=m;i++)
rank[i].label=i;
int ans=2147483647;
while (now<m)
{
sort(rank+1,rank+m+1,cmp);
ans=min(ans,rank[1].cnt);
used[rank[1].label]=true;
memset(rank,0,sizeof(rank));
for (int i=1;i<=m;i++)
rank[i].label=i;
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
if (!used[a[i][j]])
{
rank[a[i][j]].cnt++;
break;
}
now++;
}
printf("%d",ans);
} | a.cc: In function 'int main()':
a.cc:24:23: error: reference to 'rank' is ambiguous
24 | if (j==1) rank[a[i][j]].cnt++;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:28:9: error: reference to 'rank' is ambiguous
28 | rank[i].label=i;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:32:14: error: reference to 'rank' is ambiguous
32 | sort(rank+1,rank+m+1,cmp);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:32:21: error: reference to 'rank' is ambiguous
32 | sort(rank+1,rank+m+1,cmp);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:33:21: error: reference to 'rank' is ambiguous
33 | ans=min(ans,rank[1].cnt);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:34:14: error: reference to 'rank' is ambiguous
34 | used[rank[1].label]=true;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:35:16: error: reference to 'rank' is ambiguous
35 | memset(rank,0,sizeof(rank));
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:35:30: error: reference to 'rank' is ambiguous
35 | memset(rank,0,sizeof(rank));
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:37:13: error: reference to 'rank' is ambiguous
37 | rank[i].label=i;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:42:41: error: reference to 'rank' is ambiguous
42 | rank[a[i][j]].cnt++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
|
s936642688 | p03652 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct newdata
{
int label,cnt;
};
int n,m;
int a[301][301];
newdata rank[301];
bool used[301];
bool cmp(newdata i,newdata j)
{
return (i.cnt>j.cnt);
}
int main()
{
scanf("%d%d",&n,&m);
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
{
scanf("%d",&a[i][j]);
if (j==1) rank[a[i][j]].cnt++;
}
int now=0;
for (int i=1;i<=m;i++)
rank[i].label=i;
int ans=2147483647;
while (now<m)
{
sort(rank+1,rank+m+1,cmp);
ans=min(ans,rank[1].cnt);
used[rank[1].label]=true;
memset(rank,0,sizeof(rank));
for (int i=1;i<=m;i++)
rank[i].label=i;
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
if (!used[a[i][j]])
{
rank[a[i][j]].cnt++;
break;
}
now++;
}
printf("%d",ans);
} | a.cc: In function 'int main()':
a.cc:24:23: error: reference to 'rank' is ambiguous
24 | if (j==1) rank[a[i][j]].cnt++;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:28:9: error: reference to 'rank' is ambiguous
28 | rank[i].label=i;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:32:14: error: reference to 'rank' is ambiguous
32 | sort(rank+1,rank+m+1,cmp);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:32:21: error: reference to 'rank' is ambiguous
32 | sort(rank+1,rank+m+1,cmp);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:33:21: error: reference to 'rank' is ambiguous
33 | ans=min(ans,rank[1].cnt);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:34:14: error: reference to 'rank' is ambiguous
34 | used[rank[1].label]=true;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:35:16: error: reference to 'rank' is ambiguous
35 | memset(rank,0,sizeof(rank));
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:35:30: error: reference to 'rank' is ambiguous
35 | memset(rank,0,sizeof(rank));
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:37:13: error: reference to 'rank' is ambiguous
37 | rank[i].label=i;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
a.cc:42:41: error: reference to 'rank' is ambiguous
42 | rank[a[i][j]].cnt++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:11:13: note: 'newdata rank [301]'
11 | newdata rank[301];
| ^~~~
|
s949745781 | p03652 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
inline int read()
{
int x=0,f=1;char c=getchar();
while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=x*10+c-'0';c=getchar();}
return x*f;
}
const int maxn = 305;
int n , m , a[maxn][maxn] , cnt[maxn];
bool vis[maxn];
int main()
{
n = read() , m = read();
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
a[i][j] = read();
int ans = 2147483647;
for(int i = 1; i <= m; i ++) vis[i] = 1;
for(int t = 1; t < m; t ++)
{
memset(cnt , 0 , sizeof(cnt));
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
{
if(vis[j])
{
++ cnt[i];
break;
}
}
int mx = 0 , pos = 0;
for(int i = 1; i <= m; i ++) if(vis[i])
{
if(mx <= cnt[i]) mx = cnt[i] , pos = i;
}
ans = min(ans , mx); vis[pos] = 0;
}
printf("%d\n" , ans);
return 0;
}
| a.cc: In function 'int read()':
a.cc:8:16: error: 'isdigit' was not declared in this scope
8 | while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
| ^~~~~~~
a.cc:9:15: error: 'isdigit' was not declared in this scope
9 | while(isdigit(c)){x=x*10+c-'0';c=getchar();}
| ^~~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.