submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s885635605 | p03638 | C++ | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#include <set>
using namespace std;
int a[105][105],b[10050];
int main ()
{
int h,w;
while(scanf("%d %d",&h,&w)!=EOF)
{
int i,j,t,k=0;
cin>>t;
for(i=0;i<t;i++)
cin>>b[i];
for(i=0;i<h;i++)
{
if(i%2==0)
for(j=0;j<w;j++)
{
a[i][j]=k+1;
b[k]--;
if(b[k]==0)
k++;
}
if(i%2==1)
for(j=w-1;j>=0;j--)
{
a[i][j]=k+1;
b[k]--;
if(b[k]==0)
k++;
}
}
for(i=0;i<h;i++)
{
for(j=0;j<w-1;j++)
cout<<a[i][j];
cout<<a[i][w-1]<<endl;
}
}
} | a.cc: In function 'int main()':
a.cc:17:9: error: 'cin' was not declared in this scope
17 | cin>>t;
| ^~~
a.cc:9:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
8 | #include <set>
+++ |+#include <iostream>
9 | using namespace std;
a.cc:42:17: error: 'cout' was not declared in this scope
42 | cout<<a[i][j];
| ^~~~
a.cc:42:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:43:13: error: 'cout' was not declared in this scope
43 | cout<<a[i][w-1]<<endl;
| ^~~~
a.cc:43:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:43:30: error: 'endl' was not declared in this scope
43 | cout<<a[i][w-1]<<endl;
| ^~~~
a.cc:9:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
8 | #include <set>
+++ |+#include <ostream>
9 | using namespace std;
|
s259408999 | p03638 | C++ | #include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
int h,w;cin>>h>>w;
int n;cin>>n;
int ans[h][w];
bool muki=true;
int cnt=0;
for(int i=0;i<h;i++)ans[i]="";
for(int i=0;i<n;i++){
int num;cin>>num;
for(int j=0;j<num;j++){
char c='0'+i+1;
if(muki){
ans[gyou][cnt]=i+1;
cnt++;
if(cnt==w){
muki=false;
cnt=0;
gyou++;
}
}else{
ans[gyou][w-cnt-1]=i+1;
cnt++;
if(cnt==w){
muki=true;
cnt=0;
gyou++;
}
}
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cout<<ans[i][j];
if(j!=w-1)
cout<<" ";
}
cout<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:29: error: incompatible types in assignment of 'const char [1]' to 'int [w]'
18 | for(int i=0;i<h;i++)ans[i]="";
| ~~~~~~^~~
a.cc:24:13: error: 'gyou' was not declared in this scope
24 | ans[gyou][cnt]=i+1;
| ^~~~
a.cc:32:13: error: 'gyou' was not declared in this scope
32 | ans[gyou][w-cnt-1]=i+1;
| ^~~~
|
s329196949 | p03638 | C++ | #include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
int h,w;cin>>h>>w;
int n;cin>>n;
string ans[h];
bool muki=true;
int cnt=0;
int gyou=0;
for(int i=0;i<h;i++)ans[i]="";
for(int i=0;i<n;i++){
int num;cin>>num;
for(int j=0;j<num;j++){
if(muki){
ans[gyou]=ans[gyou]+(char)('0'+i+1);
cnt++;
if(cnt==w){
muki=false;
cnt=0;
gyou++;
}
}else{
ans[gyou]=(char)('0'+i+1)+ans[gyou];
cnt++;
if(cnt==w){
muki=true;
cnt=0;
gyou++;
}
}
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cout<ans[i][j];
if(j!=w-1)
cout<<" ";
}
cout<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:44:11: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
44 | cout<ans[i][j];
a.cc:44:11: note: candidate: 'operator<(int, int)' (built-in)
a.cc:44:11: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
44 | cout<ans[i][j];
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>'
44 | cout<ans[i][j];
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
44 | cout<ans[i][j];
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:44:20: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
44 | cout<ans[i][j];
| ^
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduct |
s406410695 | p03638 | C++ | #include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
//#define ll __int64
#define ll long long
const int INF=1000000007;
int h,w,n;
int t[111][111];
int c[111];
int main(){
cin>>h>>w>>n;
rep(i,n)cin>>c[i];
int pos=0;
int cnt=0;
rep(i,h){
rep(j,w){
if((i+1)%2)t[i][j]=pos+1;
else t[i][w-1-j]=pos+1;
cnt++;
if(cnt>=c[pos])cnt=0,pos++;
}
}
rep(i,h){
rep(j,w){
cout<<t[i][j];
if(j!=w-1)cout<<" ";
if(t[i][j]==0)t[200]=t[300]+t[400];
}
cout<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:44:52: error: invalid operands of types 'int [111]' and 'int [111]' to binary 'operator+'
44 | if(t[i][j]==0)t[200]=t[300]+t[400];
| ~~~~~~^~~~~~~
| | |
| | int [111]
| int [111]
|
s770343524 | p03638 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main(){
int h, w, n, ind_x=0, ind_y=0, to=0;
cin >> h >> w >> n;
vector<vector<int>> vv(h, vector<int>(w, 0));
for(int i=1;i<=n;i++){
int a;
cin >> a;
if (to == 0){
for(int j=0;j<a;j++){
if (ind_x == w-1){
vv[ind_x][ind_y] = i;
ind_x--, ind_y++;
to = 1;
}else if (ind_y != 0 && ind_x == 0){
vv[ind_x][ind_y] = i;
ind_x++; ind_y++;
to = 0;
}else{
if (to == 0){
vv[ind_x][ind_y] = i;
ind_x++;
}else{
vv[ind_x][ind_y] = i;
ind_x--;
}
}
}
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w-1;j++){
cout << vv[i][j] << " ";
}
cout << v[i][j] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:13: error: 'v' was not declared in this scope
39 | cout << v[i][j] << endl;
| ^
a.cc:39:18: error: 'j' was not declared in this scope
39 | cout << v[i][j] << endl;
| ^
|
s193168637 | p03638 | C++ | H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
i = 0
for x in range(H):
c = []
for y in range(W):
c.append(i + 1)
a[i] -= 1
if a[i] == 0:
i += 1
if x % 2 == 0:
print(*c)
else:
print(*c[::-1]) | a.cc:1:1: error: 'H' does not name a type
1 | H, W = map(int, input().split())
| ^
|
s668143919 | p03638 | Java | package CompeteProgramming;
import java.util.Scanner;
public class ABC069D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int h = scan.nextInt();
int w = scan.nextInt();
int n = scan.nextInt();
int a[] = new int[n];
for(int i = 0;i < n;i++){
a[i] = scan.nextInt();
}
int map[][] = new int[h][w];
int num = 1;
boolean dir = true;
for(int i = 0;i < h;i++){
for(int j = 0;j < w;j++){
if(dir) {
map[i][j] = num;
}else{
map[i][w-j-1] = num;
}
a[num-1]--;
if(a[num-1] == 0)num++;
}
dir = !dir;
}
for(int i = 0;i < h;i++){
for(int j = 0;j < w;j++){
System.out.print(map[i][j]+" ");
}
System.out.println();
}
}
}
| Main.java:5: error: class ABC069D is public, should be declared in a file named ABC069D.java
public class ABC069D {
^
1 error
|
s179919120 | p03638 | C++ | #include<stdio.h>
int main()
{
long h,w,n,i,k,ck,cy;
long s = 0;
long j = 0;
long a[10000];
long m[10000];
scanf_s("%ld %ld", &h,&w);
scanf_s("%ld", &n);
for (i = 0; i < n; i++) {
scanf_s("%ld", &a[i]);
}
ck = a[0];
cy = 1;
for (i = 0; i < h; i++) {
printf("\n");
if (i % 2 == 0) {
for (k = 0; k < w; k++) {
if (ck == 0) {
ck = a[cy];
cy++;
}
printf("%ld", cy);
ck--;
}
}
else {
for (k = 0; k < w; k++) {
if (ck == 0) {
ck = a[cy];
cy++;
}
m[s] = cy;
s++;
ck--;
if (s == w - 1) {
for (s = w-1; s =0; s--) {
printf("%ld", m[s]);
m[s] = 0;
}
}
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
11 | scanf_s("%ld %ld", &h,&w);
| ^~~~~~~
| scanf
|
s428691046 | p03638 | C++ | #include<iostream>
#include<vector>
usinga namespace std;
int main(){
int h,w,n,current=0;
cin >>h >>w >>n ;
int a;
vector<vector<int>>c(h,vector<int>(w,0));
for(int i=0;i<n;i++){
cin >>a ;
for(int j=0;j<a;j++){
if((current/w)%2==0) c[current/w][current%w]=i+1;
else c[current/w][w-(current%w)-1]=i+1;
current++;
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(j==w-1) cout<<c[i][j]<<endl;
else cout<<c[i][j]<<" ";
}
}
return 0;
}
| a.cc:3:1: error: 'usinga' does not name a type
3 | usinga namespace std;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >>h >>w >>n ;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:9:9: error: 'vector' was not declared in this scope
9 | vector<vector<int>>c(h,vector<int>(w,0));
| ^~~~~~
a.cc:9:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:9:23: error: expected primary-expression before 'int'
9 | vector<vector<int>>c(h,vector<int>(w,0));
| ^~~
a.cc:14:46: error: 'c' was not declared in this scope
14 | if((current/w)%2==0) c[current/w][current%w]=i+1;
| ^
a.cc:15:30: error: 'c' was not declared in this scope
15 | else c[current/w][w-(current%w)-1]=i+1;
| ^
a.cc:22:36: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:22:42: error: 'c' was not declared in this scope
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^
a.cc:22:51: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:23:30: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
23 | else cout<<c[i][j]<<" ";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:23:36: error: 'c' was not declared in this scope
23 | else cout<<c[i][j]<<" ";
| ^
|
s165339457 | p03638 | C++ | #include<iostream>
#include<vector>
usinga namespace std;
int main(){
int h,w,n,current=0;
cin >>h >>w >>n ;
int a;
vector<vector<int>>c(h,vector<int>(w));
for(int i=0;i<n;i++){
cin >>a ;
for(int j=0;j<a;j++){
if((current/w)%2==0) c[current/w][current%w]=i+1;
else c[current/w][w-(current%w)-1]=i+1;
current++;
}
}
for(int i=0;i<h;i++){
for(int j=~;j<w;j++){
if(j==w-1) cout<<c[i][j]<<endl;
else cout<<c[i][j]<<" ";
}
}
return 0;
}
| a.cc:3:1: error: 'usinga' does not name a type
3 | usinga namespace std;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >>h >>w >>n ;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:9:9: error: 'vector' was not declared in this scope
9 | vector<vector<int>>c(h,vector<int>(w));
| ^~~~~~
a.cc:9:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:9:23: error: expected primary-expression before 'int'
9 | vector<vector<int>>c(h,vector<int>(w));
| ^~~
a.cc:14:46: error: 'c' was not declared in this scope
14 | if((current/w)%2==0) c[current/w][current%w]=i+1;
| ^
a.cc:15:30: error: 'c' was not declared in this scope
15 | else c[current/w][w-(current%w)-1]=i+1;
| ^
a.cc:21:28: error: expected primary-expression before ';' token
21 | for(int j=~;j<w;j++){
| ^
a.cc:22:36: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:22:42: error: 'c' was not declared in this scope
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^
a.cc:22:51: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:23:30: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
23 | else cout<<c[i][j]<<" ";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:23:36: error: 'c' was not declared in this scope
23 | else cout<<c[i][j]<<" ";
| ^
|
s032390812 | p03638 | C++ | #include<iostream>
#include<vector>
usinga namespace std;
int main(){
int h,w,n,current=0;
cin >>h >>w >>n ;
int a;
vector<vector<int>>c(h,vector<int>w);
for(int i=0;i<n;i++){
cin >>a ;
for(int j=0;j<a;j++){
if((current/w)%2==0) c[current/w][current%w]=i+1;
else c[current/w][w-(current%w)-1]=i+1;
current++;
}
}
for(int i=0;i<h;i++){
for(int j=~;j<w;j++){
if(j==w-1) cout<<c[i][j]<<endl;
else cout<<c[i][j]<<" ";
}
}
return 0;
}
| a.cc:3:1: error: 'usinga' does not name a type
3 | usinga namespace std;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >>h >>w >>n ;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:9:9: error: 'vector' was not declared in this scope
9 | vector<vector<int>>c(h,vector<int>w);
| ^~~~~~
a.cc:9:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:9:23: error: expected primary-expression before 'int'
9 | vector<vector<int>>c(h,vector<int>w);
| ^~~
a.cc:14:46: error: 'c' was not declared in this scope
14 | if((current/w)%2==0) c[current/w][current%w]=i+1;
| ^
a.cc:15:30: error: 'c' was not declared in this scope
15 | else c[current/w][w-(current%w)-1]=i+1;
| ^
a.cc:21:28: error: expected primary-expression before ';' token
21 | for(int j=~;j<w;j++){
| ^
a.cc:22:36: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:22:42: error: 'c' was not declared in this scope
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^
a.cc:22:51: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
22 | if(j==w-1) cout<<c[i][j]<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:23:30: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
23 | else cout<<c[i][j]<<" ";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:23:36: error: 'c' was not declared in this scope
23 | else cout<<c[i][j]<<" ";
| ^
|
s450735567 | p03638 | C++ | include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
int H, W;
cin >> H >> W;
int colorMap [H][W];
int N;
cin >> N;
int _h=0, _w=0;
bool reverse = false;
for(int i=1; i <= N ; i++) {
int A;
cin >> A;
for(int j = 0; j < A ; j++) {
if( _w == W ) {
_h++;
_w = 0;
reverse = !reverse;
}
if( reverse ) {
colorMap[_h][W - 1 - _w ] = i;
} else {
colorMap[_h][_w] = i;
}
_w++;
//反転
}
}
// 出力
for(int i=0; i < H ; i++) {
for(int j=0; j < W ; j++) {
if( j < W-1) {
cout << colorMap[i][j] << " ";
} else {
cout << colorMap[i][j] << endl;
}
}
}
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
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/char_traits.h:50:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/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/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/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/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~
| __n
/usr/include/c++/14/bits/char_traits.h: At global scope:
/usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type
198 | _GLIBCXX14_CONSTEXPR std::size_t
| |
s368528459 | p03638 | C++ | #include <iostream>
#include <vector>
using namespace std;
int H, W, N;
vector<int> B;
int main(void) {
cin >> H >> W >> N;
B.resize(H * W);
int p = 0;
for (int i = 1; i <= N; ++i) {
int a;
cin >> a;
for (int j = 0; j < a; ++j)
B[p++] = i;
}
for (int j = 0; j < H; ++j) {
if (j % 2 == 0) {
for (int i = j * W; i < j * W + W; ++i) {
char c = (i == j * W + W - 1) ? '\n' : ' ';
cout << B[i] << c;
}
}
else {
for (int i = j * W + W - 1; i >= j * W; --i) {
char c = (i == j * W) ? '\n' : ' ';
cout << B[i] << c;
}
}
}
return 0;
} | a.cc:4:1: error: extended character is not valid in an identifier
4 |
| ^
a.cc:7:1: error: extended character is not valid in an identifier
7 |
| ^
a.cc:10:1: error: extended character is not valid in an identifier
10 |
| ^
a.cc:19:1: error: extended character is not valid in an identifier
19 |
| ^
a.cc:34:1: error: extended character is not valid in an identifier
34 |
| ^
a.cc:4:1: error: '\U000000a0' does not name a type
4 |
| ^
a.cc:7:1: error: '\U000000a0' does not name a type
7 |
| ^
|
s203641688 | p03638 | C++ | #include <iostream>
using namespace std;
int main() {
int H, W; cin >> H >> W;
int N; cin >> N;
int a[N+1];
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int color = 1;
int c[H+1][W+1];
for (int i = 1; i <= H; i++) {
if (i % 2 == 1) {
for (int j = 1; j <= W; j++) {
if (a[color] == 0) {
color++;
}
a[color]--;
c[i][j] = color;
}
}
else {
for (int j = W; j >= 1; j--) {
if (a[color] == 0) {
color++;
}
a[color]--;
c[i][j] = color;
}
}
}
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
cout << c[i][j] << " ";
}
cout << 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:12:1: error: extended character is not valid in an identifier
12 |
| ^
a.cc:15:1: error: extended character is not valid in an identifier
15 |
| ^
a.cc:26:1: error: extended character is not valid in an identifier
26 |
| ^
a.cc:37:1: error: extended character is not valid in an identifier
37 |
| ^
a.cc:44:1: error: extended character is not valid in an identifier
44 |
| ^
a.cc:2:1: error: '\U000000a0' does not name a type
2 |
| ^
a.cc:4:1: error: '\U000000a0' does not name a type
4 |
| ^
|
s674420646 | p03638 | C++ | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
int main() {
int H, W; cin >> H >> W;
int N; cin >> N;
int a[N+1];
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int color = 1;
int c[H+1][W+1];
for (int i = 1; i <= H; i++) {
if (i % 2 == 1) {
for (int j = 1; j <= W; j++) {
if (a[color] == 0) {
color++;
}
a[color]--;
c[i][j] = color;
}
}
else {
for (int j = W; j >= 1; j--) {
if (a[color] == 0) {
color++;
}
a[color]--;
c[i][j] = color;
}
}
}
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
cout << c[i][j] << " ";
}
cout << endl;
}
return 0;
} | a.cc:33:1: error: extended character is not valid in an identifier
33 |
| ^
a.cc:36:1: error: extended character is not valid in an identifier
36 |
| ^
a.cc:47:1: error: extended character is not valid in an identifier
47 |
| ^
a.cc:58:1: error: extended character is not valid in an identifier
58 |
| ^
a.cc:65:1: error: extended character is not valid in an identifier
65 |
| ^
a.cc: In function 'int main()':
a.cc:33:1: error: '\U000000a0' was not declared in this scope
33 |
| ^
a.cc:36:2: error: expected ';' before 'for'
36 |
| ^
| ;
37 | for (int i = 1; i <= H; i++) {
| ~~~
a.cc:37:21: error: 'i' was not declared in this scope
37 | for (int i = 1; i <= H; i++) {
| ^
a.cc:58:2: error: expected ';' before 'for'
58 |
| ^
| ;
59 | for (int i = 1; i <= H; i++) {
| ~~~
a.cc:65:2: error: expected ';' before 'return'
65 |
| ^
| ;
66 | return 0;
| ~~~~~~
|
s358279308 | p03638 | C++ | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
using namespace std;
int main() {
int H, W; cin >> H >> W;
int N; cin >> N;
int a[N+1];
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int color = 1;
int c[H+1][W+1];
for (int i = 1; i <= H; i++) {
if (i % 2 == 1) {
for (int j = 1; j <= W; j++) {
if (a[color] == 0) {
color++;
}
a[color]--;
c[i][j] = color;
}
}
else {
for (int j = W; j >= 1; j--) {
if (a[color] == 0) {
color++;
}
a[color]--;
c[i][j] = color;
}
}
}
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
cout << c[i][j] << " ";
}
cout << endl;
}
return 0;
} | a.cc:34:1: error: extended character is not valid in an identifier
34 |
| ^
a.cc:37:1: error: extended character is not valid in an identifier
37 |
| ^
a.cc:48:1: error: extended character is not valid in an identifier
48 |
| ^
a.cc:59:1: error: extended character is not valid in an identifier
59 |
| ^
a.cc:66:1: error: extended character is not valid in an identifier
66 |
| ^
a.cc: In function 'int main()':
a.cc:34:1: error: '\U000000a0' was not declared in this scope
34 |
| ^
a.cc:37:2: error: expected ';' before 'for'
37 |
| ^
| ;
38 | for (int i = 1; i <= H; i++) {
| ~~~
a.cc:38:21: error: 'i' was not declared in this scope
38 | for (int i = 1; i <= H; i++) {
| ^
a.cc:59:2: error: expected ';' before 'for'
59 |
| ^
| ;
60 | for (int i = 1; i <= H; i++) {
| ~~~
a.cc:66:2: error: expected ';' before 'return'
66 |
| ^
| ;
67 | return 0;
| ~~~~~~
|
s645663861 | p03638 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int H, W, N;
cin >> H >> W >> N;
vector<vector<int> > C(H, vector<int>(W));
vector<int> as;
for (int i = 1; i <= N; i++) {
int a;
cin >> a;
for (int j = 0; j < a; j++) {
as.push_back(i);
}
}
sort(as.begin(), as.end());
for (int i = 0; i < H; i++) {
for (int j = W * i; j < W * (i + 1); j++) {
C[i][j - W * i] = as[j];
// cout << "(i, j) = ( " << i << ", " << j << " ) == " << C[i][j]
// << endl;
}
if (i % 2 == 1) reverse(C[i].begin(), C[i].end());
}
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cout << C[i][j] << " ";
}
cout << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'short'?
21 | sort(as.begin(), as.end());
| ^~~~
| short
a.cc:29:25: error: 'reverse' was not declared in this scope
29 | if (i % 2 == 1) reverse(C[i].begin(), C[i].end());
| ^~~~~~~
|
s006240245 | p03638 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main(){
int n, h, w;
cin >> h >> w;
cin >> n;
int a[n], c[h][w] = {0};
for(int i = 0; i < n; i++){
cin >> a[i];
}
int x = 0, y = 0;
for(int i = 0; i < n; i++){
for(int j = x; i < x + a[i]/w; i++){
for(int k = y; j < y + a[i] % w; j++){
c[j][k] == a[i];
}
}
x = j;
y = k;
}
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
cout << c[i][j] << " ";
}
cout << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:21: error: 'j' was not declared in this scope
24 | x = j;
| ^
a.cc:25:21: error: 'k' was not declared in this scope
25 | y = k;
| ^
|
s404919319 | p03638 | C++ | #include<iostream>
using namespace std;
int main(){
int H,W,N,a,b[10050]={},c=0,h=1;
cin>>H;
cin>>W;
cin>>N;
for(int i=0;i<N;i++){
cin>>a;
for(int j=0;j<a;j++){
b[c+j]=h;
}
c += a;
h += 1;
}
for(int k=0;k<H;k++){
for(int l=0;l<W;l++){
if(k%2==0){
cout<<b[W*k+l];
cout<<' ';
}else{
cout<<b[W*(k+1)-l-1)];
cout<<' ';
}
}
cout<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:23:28: error: expected ']' before ')' token
23 | cout<<b[W*(k+1)-l-1)];
| ^
| ]
a.cc:23:28: error: expected ';' before ')' token
23 | cout<<b[W*(k+1)-l-1)];
| ^
| ;
|
s235603219 | p03638 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define int long long
using ll = long long;
const ll mod = LLONG_MAX;
typedef pair<int,int> P;
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};
int h,w;
int N;
int a[10010];
int c[110][110];
void init(){
rep(i,h)rep(j,w){
c[j][i]=-1;
}
}
//hの方が短いとき
P se(int c[110][110]){
rep(i,h){
rep(j,w){
if(c[j][i]==-1)return P(j,i);
}
}
}
signed main(){
cin>>h>>w;
cin>>N;
rep(i,N){
cin>>a[i];
a[i]--;
}
bool mode=0;
if(h<w){
swap(h,w);
mode=1;
}
init();
queue<P> que;
que.push(P(0,0));
c[0][0]=1;
rep(idx,N){
int step=a[idx];
while(!que.empty()){
P n=que.front();que.pop();
rep(i,4){
int nx=n.first+dx[i];
int ny=n.second+dy[i];
//cout<<"nx="<<nx<<" ny="<<ny<<endl;
if(nx>=0&&ny>=0&&nx<=w&&ny<=h && c[nx][ny]==-1 && step>0){
que.push(P(nx,ny));
c[nx][ny]=idx+1;
step--;
}
}
}
P next=se(c);
//cout<<next.first<<" "<<next.second<<endl;
que.push(next);
c[next.first][next.second]=idx+2;
}
if(mode==0){
rep(i,h){
rep(j,w-1){
cout<<c[j][i-1]<<" ";
}
cout<<c[j][w-1];
cout<<endl;
}
}else{
rep(i,w){
rep(j,h-1){
cout<<c[i][j]<<" ";
}
cout<<c[i][h-1];
cout<<endl;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:82:15: error: 'j' was not declared in this scope
82 | cout<<c[j][w-1];
| ^
a.cc: In function 'P se(long long int (*)[110])':
a.cc:34:1: warning: control reaches end of non-void function [-Wreturn-type]
34 | }
| ^
|
s209104487 | p03638 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
#define DEBUG
void disp(int height, int width, int board[][width]){
for(int i = 0; i < height; i++){
for(int j = 0; j < width; j++){
printf("%d ", board[i][j]);
}
printf("\n");
}
return;
}
// 2->fin
// 1->とりあえず今のところは入った
// 0->だめでした
//-1->error
int solve(int h, int w, const int height, const int width, const int n, const int a[], int board[][width], const int used[]){//usedは、中身を変えずにコピーして次へ渡す
for(int col = 0; col < n; col++){
if(used[col] > a[col]){
printf("error 1 color:%d\n", col);
return -1;
}else if(used[col] == a[col]){
break;
}
int res;
if(used[col] == 0){//初めてこの色使うよ
board[h][w] = col;
if(h == height - 1 && w == width - 1){
return 2;
}else if(h == height - 1){
res = solve(0, w+1, height, width, n, a, board, used);
}else{
res = solve(h+1, w, height, width, n, a, board, used);
}
}else{//もう使ったことあるから周りみるよ
if(h > 0 && board[h-1][w] == col){
board[h][w] = col;
res = 1;
}else if(w > 0 && board[h][w-1] == col){
board[h][w] = col;
res = 1;
}else if(h < height - 1 && board[h+1][w] == col){
board[h][w] = col;
res = 1;
}else if(w < width - 1 && board[h][w+1] == col){
board[h][w] = col;
res = 1;
}else{
break;
}
if(h == height - 1 && w == width - 1){
return 2;
}else if(h == height - 1){
res = solve(0, w+1, height, width, n, a, board, used);
}else{
res = solve(h+1, w, height, width, n, a, board, used);
}
}
if(res == 0){
break;
}else if(res == 2){
return 2;
}
}
}
int main(void){
int height, width;
scanf("%d%d", &height, &width);
int n;
scanf("%d", &n);
int a[n];
for(int i = 0; i < n; i++){
scanf("%d", &a[i]);
}
int board[height][width];//盤面の様子、塗られている色が入る
for(int i = 0; i < height; i++){
for(int j = 0; j < width; j++){
board[i][j] = 0;
}
}
int used[n];//色nが今まで何回使われたか
for(int i = 0; i < n; i++){
used[i] = 0;
}
//const int height, const int width, const int n, const int a[], int board[h][w], const int used[], int h, int w)
int ans = solve(0, 0, height, width, n, a, board, used);
printf("%d\n\n\n", ans);
for(int i = 0; i < height; i++){
for(int j = 0; j < width; j++){
printf("%d ", board[i][j]);
}
printf("\n");
}
return 0;
} | a.cc:7:51: error: use of parameter outside function body before ']' token
7 | void disp(int height, int width, int board[][width]){
| ^
a.cc: In function 'void disp(...)':
a.cc:8:28: error: 'height' was not declared in this scope
8 | for(int i = 0; i < height; i++){
| ^~~~~~
a.cc:9:36: error: 'width' was not declared in this scope
9 | for(int j = 0; j < width; j++){
| ^~~~~
a.cc:10:39: error: 'board' was not declared in this scope
10 | printf("%d ", board[i][j]);
| ^~~~~
a.cc: At global scope:
a.cc:20:105: error: use of parameter outside function body before ']' token
20 | int solve(int h, int w, const int height, const int width, const int n, const int a[], int board[][width], const int used[]){//usedは、中身を変えずにコピーして次へ渡す
| ^
a.cc:20:106: error: expected ')' before ',' token
20 | int solve(int h, int w, const int height, const int width, const int n, const int a[], int board[][width], const int used[]){//usedは、中身を変えずにコピーして次へ渡す
| ~ ^
| )
a.cc:20:108: error: expected unqualified-id before 'const'
20 | int solve(int h, int w, const int height, const int width, const int n, const int a[], int board[][width], const int used[]){//usedは、中身を変えずにコピーして次へ渡す
| ^~~~~
|
s118876203 | p03638 | C++ | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskD solver = new TaskD();
solver.solve(1, in, out);
out.close();
}
static class TaskD {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int H = in.nextInt();
int W = in.nextInt();
int N = in.nextInt();
int[] colors = new int[N + 1];
for (int i = 1; i <= N; i++) {
colors[i] = in.nextInt();
}
int[][] ans = new int[H][W];
int i = 0, j = 0;
int incj = 1;
for (int k = 1; k <= N; k++) {
if (colors[k] > 0) {
while (colors[k]-- > 0) {
ans[i][j] = k;
j += incj;
if (j == -1 || j == W) i = (i + 1) % H;
if (j == W) {
j--;
incj = -1;
} else if (j == -1) {
j++;
incj = 1;
}
}
}
}
for (i = 0; i < H; i++) {
for (j = 0; j < W; j++) {
if (j > 0) out.print(" ");
out.print(ans[i][j]);
}
out.println();
}
}
}
static class InputReader {
private int lenbuf = 0;
private int ptrbuf = 0;
private InputStream in;
private byte[] inbuf = new byte[1024];
public InputReader(InputStream in) {
this.in = in;
}
private int readByte() {
if (lenbuf == -1) throw new InputMismatchException();
if (ptrbuf >= lenbuf) {
ptrbuf = 0;
try {
lenbuf = in.read(inbuf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (lenbuf <= 0) return -1;
}
return inbuf[ptrbuf++];
}
public int nextInt() {
int num = 0, b;
boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
if (b == '-') {
minus = true;
b = readByte();
}
while (true) {
if (b >= '0' && b <= '9') {
num = num * 10 + (b - '0');
} else {
return minus ? -num : num;
}
b = readByte();
}
}
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.io.OutputStream;
| ^~~~~~
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.io.IOException;
| ^~~~~~
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.io.InputStream;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.io.PrintWriter;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.InputMismatchException;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.io.IOException;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.io.InputStream;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:13:1: error: expected unqualified-id before 'public'
13 | public class Main {
| ^~~~~~
|
s915027471 | p03638 | C | 3 5
5
1 2 3 4 5 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 3 5
| ^
|
s067930330 | p03638 | C++ | int a[100000];
int c[150][150];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int H,W,N;
cin >> H;
cin >> W;
cin >> N;
for(int i=0;i<N;i++){
cin >> a[i];
}
int count=1,color=1;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(i%2==0){
c[i][j]=color;
}
else{
c[i][W-1-j]=color;
}
if(count==a[color-1]){
count=1;
color++;
}
else{
count++;
}
}
}
for(int i=0;i<H;i++){
cout << c[i][0];
for(int j=1;j<W;j++){
cout << " "<< c[i][j];
}
cout << "\n";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
4 | cin.tie(0);
| ^~~
a.cc:5:9: error: 'ios' has not been declared
5 | ios::sync_with_stdio(false);
| ^~~
a.cc:34:9: error: 'cout' was not declared in this scope; did you mean 'count'?
34 | cout << c[i][0];
| ^~~~
| count
|
s650973780 | p03638 | C++ | import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int h = scan.nextInt();
int w = scan.nextInt();
int n = scan.nextInt();
int[] a = new int[n];
for(int i = 0;i < n;i++){
a[i] = scan.nextInt();
}
int now = 0;
int[][] b = new int[h][w];
for(int i = 0;i < h;i++){
if(i % 2 == 0){
for(int j = 0;j < w;j++){
if(a[now] == 0)
now++;
b[i][j] = now + 1;
if(now < n)
a[now]--;
}
}else{
for(int j = w - 1;j >= 0;j--){
if(a[now] == 0)
now++;
b[i][j] = now + 1;
if(now < n)
a[now]--;
}
}
}
for(int i = 0;i < h;i++){
for(int j = 0;j < w;j++){
System.out.printf("%d ",b[i][j]);
}
System.out.println();
}
}
}
| 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:11: error: expected ':' before 'static'
3 | public static void main(String[] args){
| ^~~~~~~
| :
a.cc:3:29: error: 'String' has not been declared
3 | public static void main(String[] args){
| ^~~~~~
a.cc:3:38: error: expected ',' or '...' before 'args'
3 | public static void main(String[] args){
| ^~~~
a.cc:44:2: error: expected ';' after class definition
44 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:4:9: error: 'Scanner' was not declared in this scope
4 | Scanner scan = new Scanner(System.in);
| ^~~~~~~
a.cc:5:17: error: 'scan' was not declared in this scope
5 | int h = scan.nextInt();
| ^~~~
a.cc:10:12: error: structured binding declaration cannot have type 'int'
10 | int[] a = new int[n];
| ^~
a.cc:10:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:10:12: error: empty structured binding declaration
a.cc:10:15: error: expected initializer before 'a'
10 | int[] a = new int[n];
| ^
a.cc:13:13: error: 'a' was not declared in this scope
13 | a[i] = scan.nextInt();
| ^
a.cc:17:12: error: structured binding declaration cannot have type 'int'
17 | int[][] b = new int[h][w];
| ^~
a.cc:17:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:17:12: error: empty structured binding declaration
a.cc:17:14: error: expected initializer before '[' token
17 | int[][] b = new int[h][w];
| ^
a.cc:21:20: error: 'a' was not declared in this scope
21 | if(a[now] == 0)
| ^
a.cc:23:17: error: 'b' was not declared in this scope
23 | b[i][j] = now + 1;
| ^
a.cc:25:21: error: 'a' was not declared in this scope
25 | a[now]--;
| ^
a.cc:29:24: error: 'a' was not declared in this scope
29 | if(a[now] == 0)
| ^
a.cc:31:21: error: 'b' was not declared in this scope
31 | b[i][j] = now + 1;
| ^
a.cc:33:25: error: 'a' was not declared in this scope
33 | a[now]--;
| ^
a.cc:39:17: error: 'System' was not declared in this scope
39 | System.out.printf("%d ",b[i][j]);
| ^~~~~~
a.cc:39:41: error: 'b' was not declared in this scope
39 | System.out.printf("%d ",b[i][j]);
| ^
a.cc:41:13: error: 'System' was not declared in this scope
41 | System.out.println();
| ^~~~~~
|
s471694296 | p03638 | C++ | #define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = rbegin(arr)+(plus); x != rend(arr); ++x)
#define PRINT(arr) {copy(begin((arr)), end((arr)), ostream_iterator<int>(cout, " "));cout<<'\n';}
#define REE(s_) {cout<<s_<<'\n';exit(0);} //print s_ and terminate program
#define CONT(s_) {cout<<s_<<'\n';continue;} //print s_ and continue;
#define GETCIN(arr) for(auto &i: (arr)) cin>>i
#define GET(arr) for(auto &i: (arr)) sc(i)
#define GETSTR(arr) for(auto &i: (arr)) getstr(i)
#define INF 2139062143 //127 in memset -> memset(arr,127,size)
#define SINF 1061109567 //Safe INF, for graphs or 2d arrays 63 in memset(arr,63,size)
#define LL_INF 7234017283807667300 //100 in memset(arr,100,size) !!!must be LL
#define whatis(x) cerr << #x << " is " << x << endl;
#define e1 first
#define e2 second
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
#define umap unordered_map
#define uset unordered_set
using namespace std;
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }//prnt vec
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }//prnt pair
template<typename T> inline void print_128(T num){ if(!num) return; print_128(num / 10); cout.put((num % 10) + '0'); }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int n,m;
sc(n,m);
int q;
sc(q);
int arr[n][m];
int cur;
pi ls = {0,0};
FORE(i,1,q){
sc(cur);
while(cur--){
arr[ls.e1][ls.e2] = i;
if(++ls.e2 == m){
++ls.e1, ls.e2 = 0;
}
}
/* if(++ls.e2 == m) */
/* ++ls.e1, ls.e2 = 0; */
}
FORR(i,arr){
FOR(x,0,m-1){
cout << i[x] << ' ';
}
cout << i[m-1] << '\n';
}
}
| a.cc:23:14: error: 'pair' in namespace 'std' does not name a template type
23 | typedef std::pair<int,int> pi;
| ^~~~
a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
+++ |+#include <utility>
1 | #define pb push_back
a.cc:24:14: error: 'vector' in namespace 'std' does not name a template type
24 | typedef std::vector<int> vi;
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | #define pb push_back
a.cc:25:14: error: 'vector' in namespace 'std' does not name a template type
25 | typedef std::vector<std::string> vs;
| ^~~~~~
a.cc:25:9: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
25 | typedef std::vector<std::string> vs;
| ^~~
a.cc:34:19: error: 'ostream' does not name a type
34 | template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }//prnt vec
| ^~~~~~~
a.cc:35:28: error: 'ostream' does not name a type
35 | template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }//prnt pair
| ^~~~~~~
a.cc: In function 'void print_128(T)':
a.cc:36:90: error: 'cout' was not declared in this scope
36 | template<typename T> inline void print_128(T num){ if(!num) return; print_128(num / 10); cout.put((num % 10) + '0'); }
| ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #define pb push_back
a.cc: At global scope:
a.cc:37:24: error: 'string' does not name a type
37 | inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
| ^~~~~~
a.cc: In function 'int fstoi(const int&)':
a.cc:37:49: error: request for member 'begin' in 'str', which is of non-class type 'const int'
37 | inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
| ^~~~~
a.cc:37:131: error: request for member 'end' in 'str', which is of non-class type 'const int'
37 | inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
| ^~~
a.cc: In function 'void getch(char&)':
a.cc:38:38: error: 'getchar_unlocked' was not declared in this scope
38 | inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
| ^~~~~~~~~~~~~~~~
a.cc: At global scope:
a.cc:39:13: error: variable or field 'getstr' declared void
39 | inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
| ^~~~~~
a.cc:39:20: error: 'string' was not declared in this scope
39 | inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | #define pb push_back
a.cc:39:28: error: 'str' was not declared in this scope; did you mean 'std'?
39 | inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
| ^~~
| std
a.cc:39:181: error: variable or field 'getstr' declared void
39 | inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
| ^~~~~~
a.cc:39:188: error: 'string' was not declared in this scope
39 | inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
| ^~~~~~
a.cc:39:188: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:39:196: error: 'str' was not declared in this scope; did you mean 'std'?
39 | inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
| ^~~
| std
a.cc:39:206: error: expected primary-expression before '&' token
39 | inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}template<typename ...Args> inline void getstr(string &str, Args &...arg){str.clear();char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}getstr(arg...);}
| ^
a.cc: In function 'bool sc(T&)':
a.cc:40:80: error: there are no arguments to 'getchar_unlocked' that depend on a template parameter, so a declaration of 'getchar_unlocked' must be available [-fpermissive]
40 | template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
| ^~~~~~~~~~~~~~~~
a.cc:40:80: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:40:113: error: 'EOF' was not declared in this scope
40 | template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
| ^~~
a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #define pb push_back
a.cc:40:154: error: there are no arguments to 'getchar_unlocked' that depend on a template parameter, so a declaration of 'getchar_unlocked' must be available [-fpermissive]
40 | template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
| |
s610024828 | p03638 | C++ | 3 5
5
1 2 3 4 5
| a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 3 5
| ^
|
s543832749 | p03638 | C++ | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* Built using CHelper plug-in Actual solution is at the top
*/
public class Main {
public final static double MAX_T = 1000000;
public final static double MIN_T = 0;
public static int s = 0;
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskC solver = new TaskC();
solver.solve(1, in, out);
out.close();
}
static class TaskC {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int h = in.nextInt();
int w = in.nextInt();
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
int[][] m = new int[h][w];
int r = 0, c = 0, s = 1, co = 0;
for (; r < h; r++) {
for (; c < w && c >= 0; c += s) {
while (a[co] == 0) {
co++;
}
m[r][c] = co + 1;
}
s *= -1;
c += s;
}
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
out.print(m[i][j] + " ");
}
out.println();
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextFloat() {
return Double.parseDouble(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.io.OutputStream;
| ^~~~~~
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.io.IOException;
| ^~~~~~
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.io.InputStream;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.io.PrintWriter;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.ArrayList;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.util.Comparator;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.util.Iterator;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import java.util.Random;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
9 | import java.util.StringTokenizer;
| ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
10 | import java.util.TreeSet;
| ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:1: error: 'import' does not name a type
11 | import java.io.BufferedReader;
| ^~~~~~
a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:12:1: error: 'import' does not name a type
12 | import java.io.InputStreamReader;
| ^~~~~~
a.cc:12:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:17:1: error: expected unqualified-id before 'public'
17 | public class Main {
| ^~~~~~
|
s501850020 | p03639 | C++ | #include <bits/stdc++.h>
#pragma GCC diagnostic error "-Wconversion"
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
ll dp[100010];
ll gcd(ll x, ll y){
return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
return x * y / gcd(x, y);
}
ll digits(ll x){
ll length = 0;
while (x > 0){
x /= 10;
length++;
}
return length;
if (x == 0) return 0;
}
map<ll, ll> factor(ll n){
map<ll, ll> ans;
ll a = 2;
while (n >= a * a){
if (n % a == 0){
ans[a]++;
n /= a;
}
else a++;
}
ans[n]++;
return ans;
}
template<class T> inline bool chmin(T& a, T b){
if (a > b){
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b){
if (a < b){
a = b;
return true;
}
return false;
}
int main(){
cout << fixed << setprecision(15);
//int ans = 0;
string ans = "No";
int n; cin >> n;
int odd = 0, four = 0;
rep(i,n){
int x; cin >> x;
if (x % 4 == 0) four++;
if (x % 2 == 1) odd++;
}
if (odd <= 2 && odd <= four) ans = "Yes";
if (n <= 3) if (four >= 1) ans = "Yes";
if (n == 2 && (one == 2 || one == 1 && four == 0)) ans = "No";
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:71:18: error: 'one' was not declared in this scope
71 | if (n == 2 && (one == 2 || one == 1 && four == 0)) ans = "No";
| ^~~
|
s209150741 | p03639 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mxn= 5e4+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
//#define endl '\n'
void rishabh(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int main(){
rishabh();
int n;
cin>>n;
ll arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
int none, four, two;
none=two=four=0;
for(int i=0;i<n;i++){
if(arr[i]%4==0)four++;
else if(arr[i]%2==0)two++;
else none++;
}
if((four*2+(two/2)*2>=n-1)cout<<"Yes";
else cout<<"No";
}
| a.cc: In function 'int main()':
a.cc:30:31: error: expected ';' before 'cout'
30 | if((four*2+(two/2)*2>=n-1)cout<<"Yes";
| ^~~~
| ;
a.cc:31:5: error: expected primary-expression before 'else'
31 | else cout<<"No";
| ^~~~
a.cc:30:43: error: expected ')' before 'else'
30 | if((four*2+(two/2)*2>=n-1)cout<<"Yes";
| ~ ^
| )
31 | else cout<<"No";
| ~~~~
|
s847046514 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N = 0;
cin >> N;
vector<int> A(N,0);
int d = 0, q = 0;
for(int i = 0; i < N; i++) {
cin >> A.at(i);
d += (A.at(i)%2 == 0);
q += (A.at(i)%4 == 0);
}
d -= q;
int o = N - d - q;
o += (d == 1);
if(q + 1 >= o && (q && o) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:30: error: expected ';' before '{' token
19 | if(q + 1 >= o && (q && o) {
| ^~
| ;
a.cc:21:7: error: expected primary-expression before 'else'
21 | } else {
| ^~~~
a.cc:21:6: error: expected ')' before 'else'
21 | } else {
| ^~~~~
| )
a.cc:19:7: note: to match this '('
19 | if(q + 1 >= o && (q && o) {
| ^
|
s612696679 | p03639 | C++ | #include <iostream>
using namespace std;
int n,kelipatan2=0,kelipatan4=0,a[100010],random=0,x,y;
int main() {
cin>>n;
for(int i=1;i<=n;i++) {
cin>>a[i];
if(a[i]%4==0) {
kelipatan4++;
}
else if(a[i]%2==0) {
kelipatan2++;
} else {
random++;
}
}
if(kelipatan2)random++;
if(random-1>kelipatan4) {
cout<<"No"<<endl;
} else {
cout<<"Yes"<<endl;
}
}
| a.cc:3:43: error: 'int random' redeclared as different kind of entity
3 | int n,kelipatan2=0,kelipatan4=0,a[100010],random=0,x,y;
| ^~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:521:17: note: previous declaration 'long int random()'
521 | extern long int random (void) __THROW;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:14:25: warning: ISO C++ forbids incrementing a pointer of type 'long int (*)() noexcept' [-Wpointer-arith]
14 | random++;
| ^~~~~~
a.cc:14:31: error: lvalue required as increment operand
14 | random++;
| ^~
a.cc:17:23: warning: ISO C++ forbids incrementing a pointer of type 'long int (*)() noexcept' [-Wpointer-arith]
17 | if(kelipatan2)random++;
| ^~~~~~
a.cc:17:29: error: lvalue required as increment operand
17 | if(kelipatan2)random++;
| ^~
a.cc:18:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
18 | if(random-1>kelipatan4) {
| ~~~~~~^~
a.cc:18:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
18 | if(random-1>kelipatan4) {
| ~~~~~~~~^~~~~~~~~~~
|
s263973095 | p03639 | C++ | #include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>
ll N;
vll A;
bool flag = false;
map<int, int> mp;
void solve(){
rep(i,N){
mp[A[i]]++;
}
if(2*mp[0] + 1 >= N) {
flag = true;
} else {
N -= 2*mp[0];
if(N % 2 == 1) N--;
if(Xmp[2] == N) flag = true;
}
if(flag){
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
int main(){
cin >> N;
A.resize(N);
rep(i, N) cin >> A[i];
rep(i, N) A[i] %= 4;
solve();
}
| a.cc: In function 'void solve()':
a.cc:36:12: error: 'Xmp' was not declared in this scope; did you mean 'mp'?
36 | if(Xmp[2] == N) flag = true;
| ^~~
| mp
|
s935684789 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin>>n;
ll a[n+5];
ll tuyoi=0;nomal=0,yowa=0;
rep(i,n){
cin>>a[i];
if(a[i]%4==0){
tuyoi++;
}
else if(a[i]%2==0){
nomal++;
}
else{
yowa++;
}
}
if(nomal==0){
if(yowa-1<=tuyoi){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
else{
if(yowa<=tuyoi){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:10:14: error: 'nomal' was not declared in this scope
10 | ll tuyoi=0;nomal=0,yowa=0;
| ^~~~~
a.cc:10:22: error: 'yowa' was not declared in this scope
10 | ll tuyoi=0;nomal=0,yowa=0;
| ^~~~
|
s080945949 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin>>n;
ll a[n+5];
ll tuyoi=0;nomal=0,yowa=0;
rep(i,n){
cin>>a[i];
if(a[i]%4==0){
tuyoi++;
}
else if(a[i]%2==0){
nomal++;
}
else{
yowa++;
}
}
if(nomal==0){
if(yowa-1<=tuyoi){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
else{
if(yowa<=tuyo){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:10:14: error: 'nomal' was not declared in this scope
10 | ll tuyoi=0;nomal=0,yowa=0;
| ^~~~~
a.cc:10:22: error: 'yowa' was not declared in this scope
10 | ll tuyoi=0;nomal=0,yowa=0;
| ^~~~
a.cc:32:14: error: 'tuyo' was not declared in this scope; did you mean 'tuyoi'?
32 | if(yowa<=tuyo){
| ^~~~
| tuyoi
|
s348844237 | p03639 | C++ | #include "bits/stdc++.h"
#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define obit __builtin_popcount
#define pof pop_front
#define For(i,a,n) for(i=a;i<n;i++)
#define all(ar) ar.begin(),ar.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned short int us;
typedef short int ss;
typedef long double ld;
const ll mod = 1000000007;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
/*
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
//*/
int n;
cin>>n;
int m4 = 0, nm4 = 0,i;
For(i,0,n){
int x;
cin>>x;
if(x != 2){
if(x % 4 == 0) m4++;
else nm4++;
}
}
int si, a = m4.size(), b = nm4.size();
si = (a + b)/2;
if(a >= si) cout<<"Yes";
else cout<<"No";
return 0;
} | a.cc: In function 'int main()':
a.cc:46:20: error: request for member 'size' in 'm4', which is of non-class type 'int'
46 | int si, a = m4.size(), b = nm4.size();
| ^~~~
a.cc:47:15: error: 'b' was not declared in this scope
47 | si = (a + b)/2;
| ^
|
s247570461 | p03639 | C++ | #include "bits/stdc++.h"
#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define obit __builtin_popcount
#define pof pop_front
#define For(i,a,n) for(i=a;i<n;i++)
#define all(ar) ar.begin(),ar.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned short int us;
typedef short int ss;
typedef long double ld;
const ll mod = 1000000007;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
/*
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
//*/
int n;
cin>>n;
int m4 = 0, nm4 = 0,i;
For(i,0,n){
int x;
cin>>x;
if(x != 2){
if(x % 4 == 0) m4++;
else nm4++;
}
}
int si = (m4.size() + nm4.size())/2;
if(m4.size() >= si) cout<<"Yes";
else cout<<"No";
return 0;
} | a.cc: In function 'int main()':
a.cc:46:18: error: request for member 'size' in 'm4', which is of non-class type 'int'
46 | int si = (m4.size() + nm4.size())/2;
| ^~~~
a.cc:46:31: error: request for member 'size' in 'nm4', which is of non-class type 'int'
46 | int si = (m4.size() + nm4.size())/2;
| ^~~~
a.cc:47:11: error: request for member 'size' in 'm4', which is of non-class type 'int'
47 | if(m4.size() >= si) cout<<"Yes";
| ^~~~
|
s088594536 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
int main(){
ll N;
cin >> N;
ll zero = 0, two = 0, odd = 0;
rep(i, 0, N){
ll a;
cin >> a;
if(a % 4 == 0) zero++;
if(a % 4 == 2) two++;
if(a % 2 == 1) odd++;
}
two = min(1, two);
if(two + odd > zero + 1){
cout << "No" << endl;
}else{
cout << "Yes" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:14: error: no matching function for call to 'min(int, ll&)'
17 | two = min(1, two);
| ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:17:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
17 | two = min(1, two);
| ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:17:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
17 | two = min(1, two);
| ~~~^~~~~~~~
|
s086914835 | p03639 | C++ | #define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;
ll two(ll a){
ll key=0;
while(a%2==0) {
a/=2;
key++;
}
return min((ll)2,key);
}
int main(){
ll n ; cin >>n;
vector<ll> a(n);
rep(i,n) cin >>a[i];
rep(i,n) a[i]=two(a[i]);
map<ll,ll> mp;
rep(i,n)mp[a[i]]++;
if(mp[1]==0&&mp[0]<=mp[2]+1) cout <<"Yes"<<endl;
else if(mp[1]>0&&mp[0]<=mp[2]) cout <<"Yes"<<endl;
else cout <<"No"<<endl;
}#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;
ll two(ll a){
ll key=0;
while(a%2==0) {
a/=2;
key++;
}
return min((ll)2,key);
}
int main(){
ll n ; cin >>n;
vector<ll> a(n);
rep(i,n) cin >>a[i];
rep(i,n) a[i]=two(a[i]);
map<ll,ll> mp;
rep(i,n)mp[a[i]]++;
if(mp[1]==0&&mp[0]<=mp[2]+1) cout <<"Yes"<<endl;
else if(mp[1]>0&&mp[0]<=mp[2]) cout <<"Yes"<<endl;
else cout <<"No"<<endl;
} | a.cc:38:2: error: stray '#' in program
38 | }#define _GLIBCXX_DEBUG
| ^
a.cc:38:3: error: 'define' does not name a type
38 | }#define _GLIBCXX_DEBUG
| ^~~~~~
a.cc:57:4: error: redefinition of 'long long int two(long long int)'
57 | ll two(ll a){
| ^~~
a.cc:20:4: note: 'long long int two(long long int)' previously defined here
20 | ll two(ll a){
| ^~~
a.cc:65:5: error: redefinition of 'int main()'
65 | int main(){
| ^~~~
a.cc:28:5: note: 'int main()' previously defined here
28 | int main(){
| ^~~~
|
s830151939 | p03639 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;
typedef vector<string> VS;
typedef vector<PLL> VP;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
int main()
{
ll N; cin >> N;
VLL a(N);
ll four=0;
ll two=0;
rep(i,N){
cin >> a.at(i);
if(a.at(i)%4==0){
four++;
}
if(a.at(i)%4!=0 && a.at(i)%2==0){
two++;
}
}
ll judge=N-four*2;
if(judge<=0){
cout << "Yes" << endl;
return 0;
}
else{
if(judge=<two){
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:43:18: error: expected primary-expression before '<' token
43 | if(judge=<two){
| ^
|
s704239852 | p03639 | Java | import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count4 = 0;
int count2 = 0;
for (int i = 0; i < n; i++) {
int val = sc.nextInt();
if (val % 4 == 0) {
count4++;
} else if (val % 2 ==0) {
count2++;
}
}
if (count4 * 3 >= n) {
System.out.println("Yes");
} else {
int count = n - count4 * 3;
if (count <= count2) {
System.out.println("Yes");
} else {
System.out.println("No");
}
} else {
System.out.println("No");
}
}
} | Main.java:28: error: 'else' without 'if'
} else {
^
1 error
|
s431986607 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
int a[N];
int b[N];
rep(i,N) {
cin >> a[i];
b[i]=0;
while(A[i]%2=0){
a[i]/=2;
b[i]++;
}
}
string ans="Yes";
rep(i,N-1){
if(b[i]+b[i+1]<2){
ans="No";
break;
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:23:15: error: 'A' was not declared in this scope
23 | while(A[i]%2=0){
| ^
|
s538661164 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
int a[N];
int b[N];
rep(i,N) {
cin >> A[i];
b[i]=0;
while(A[i]%2=0){
A[i]/=2;
b[i]++;
}
}
string ans="Yes";
rep(i,N-1){
if(b[i]+b[i+1]<2){
ans="No";
break;
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:21:16: error: 'A' was not declared in this scope
21 | cin >> A[i];
| ^
|
s298539181 | p03639 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n, num2=0, num4=0;
cin >> n;
long long temp;
for(int i=0;i<n;i++){
cin >> temp;
if(temp&4==0)num4++;
else if(temp&2==0)num2++;
}
cout << (num4*2+temp2+1>=n?"Yes":"No");
}
| a.cc: In function 'int main()':
a.cc:12:25: error: 'temp2' was not declared in this scope; did you mean 'temp'?
12 | cout << (num4*2+temp2+1>=n?"Yes":"No");
| ^~~~~
| temp
|
s809787338 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
ll n;
cin >> n;
vl a(n);
rep(i,n){
cin >> a[i];
}
ll cnt4=0,cnt2=0;
rep(i,n){
if(a[i]%4==0){
cnt4++;
}
else if(a[i]%2==0){
cnt2++;
}
}
if(2*cnt4+cnt2>=n){
cout << "Yes" << endl;
}
else
cout << "No" << endl;
}
} | a.cc:37:1: error: expected declaration before '}' token
37 | }
| ^
|
s229246391 | p03639 | C++ | c#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
ll N;
cin >> N;
ll i;
ll a=0,b=0,t;
for(i=0;i<N;i++){
cin >> t;
if(t%4==0)a++;
else if(t%2==0)b++;
}
if(2*a+max((ll)1,b)>=N)cout<<"Yes"<<endl;else cout << "No" <<endl;
return 0;
}
| a.cc:1:2: error: stray '#' in program
1 | c#include<iostream>
| ^
a.cc:1:1: error: 'c' does not name a type
1 | c#include<iostream>
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
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/char_traits.h:50:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/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/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/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/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~
| __n
/usr/include/c++/14/bits/char_traits.h: At global scope:
/usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a t |
s701058515 | p03639 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
ll N;
cin >> N;
ll i;
ll a=0,b=0,t;
for(i=0;i<N;i++){
cin >> t;
if(t%4==0)a++;
else if(t%2==0)b++;
}
if(2*a+max(1,b)>=2*N-2)cout<<"Yes"<<endl;else cout << "No" <<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:15: error: no matching function for call to 'max(int, long long int&)'
24 | if(2*a+max(1,b)>=2*N-2)cout<<"Yes"<<endl;else cout << "No" <<endl;
| ~~~^~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:24:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
24 | if(2*a+max(1,b)>=2*N-2)cout<<"Yes"<<endl;else cout << "No" <<endl;
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:5:
/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:24:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
24 | if(2*a+max(1,b)>=2*N-2)cout<<"Yes"<<endl;else cout << "No" <<endl;
| ~~~^~~~~
|
s358848104 | p03639 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
ll N;
cin >> N;
ll i;
ll a=0,b=0,t;
for(i=0;i<N;i++){
cin >> t;
if(t%4==0)a++;
else if(t%2==0)b++;
}
if(2*a+max(1,b)>=2*N-2)cout<<"Yes"<<endl;else cout << "No" <<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:15: error: no matching function for call to 'max(int, long long int&)'
24 | if(2*a+max(1,b)>=2*N-2)cout<<"Yes"<<endl;else cout << "No" <<endl;
| ~~~^~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:24:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
24 | if(2*a+max(1,b)>=2*N-2)cout<<"Yes"<<endl;else cout << "No" <<endl;
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:5:
/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:24:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
24 | if(2*a+max(1,b)>=2*N-2)cout<<"Yes"<<endl;else cout << "No" <<endl;
| ~~~^~~~~
|
s990051160 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int(i)=0;(i)<(n);++(i));
int main () {
int n;
cin >> n;
ll a[n];
REP(i, n) {
cin >> a[i];
}
int cnt = 0;
int cnt4 = 0;
REP(i ,n) {
if (a[i] % 4 == 0) {
cnt++;
cnt4++;
}
else if (a[i] % 2 ==1) cnt--;
}
if (cnt >= 0) cout << "Yes";
else if (cnt == -1 and cnt4 >= n/2) cout << "Yes";
else cout << "No";
}
| a.cc: In function 'int main()':
a.cc:12:14: error: 'i' was not declared in this scope
12 | cin >> a[i];
| ^
a.cc:19:11: error: 'i' was not declared in this scope
19 | if (a[i] % 4 == 0) {
| ^
|
s577811333 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int (i) = 0; (i) < (n); ++(i));
int main () {
int n;
cin >> n;
ll a[n];
rep(i, n) cin >> a[i];
int cnt = 0;
int cnt4 = 0;
rep(i ,n) {
if (a[i] % 4 == 0) {
cnt++;
cnt4++;
}
else if (a[i] % 2 ==1) cnt--;
}
if (cnt >= 0) cout << "Yes";
else if (cnt == -1 and cnt4 >= n/2) cout << "Yes";
else cout << "No";
}
| a.cc: In function 'int main()':
a.cc:11:22: error: 'i' was not declared in this scope
11 | rep(i, n) cin >> a[i];
| ^
|
s494497945 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i);
int main () {
int n;
cin >> n;
ll a[n];
rep(int i, n) cin >> a[i];
int cnt = 0;
int cnt4 = 0;
rep(i ,n) {
if (a[i] % 4 == 0) {
cnt++;
cnt4++;
}
else if (a[i] % 2 ==1) cnt--;
}
if (cnt >= 0) cout << "Yes";
else if (cnt == -1 and cnt4 >= n/2) cout << "Yes";
else cout << "No";
}
| a.cc: In function 'int main()':
a.cc:5:24: error: two or more data types in declaration of 'i'
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^~~
a.cc:11:3: note: in expansion of macro 'rep'
11 | rep(int i, n) cin >> a[i];
| ^~~
a.cc:5:37: error: expected initializer before '<' token
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^
a.cc:11:3: note: in expansion of macro 'rep'
11 | rep(int i, n) cin >> a[i];
| ^~~
a.cc:5:37: error: expected ';' before '<' token
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^
a.cc:11:3: note: in expansion of macro 'rep'
11 | rep(int i, n) cin >> a[i];
| ^~~
a.cc:5:37: error: expected primary-expression before '<' token
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^
a.cc:11:3: note: in expansion of macro 'rep'
11 | rep(int i, n) cin >> a[i];
| ^~~
a.cc:5:40: error: expected ')' before ';' token
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ~ ^
a.cc:11:3: note: in expansion of macro 'rep'
11 | rep(int i, n) cin >> a[i];
| ^~~
a.cc:11:7: error: expected primary-expression before 'int'
11 | rep(int i, n) cin >> a[i];
| ^~~
a.cc:5:44: note: in definition of macro 'rep'
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^
a.cc:11:26: error: 'i' was not declared in this scope
11 | rep(int i, n) cin >> a[i];
| ^
|
s214574674 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i);
int main () {
int n;
cin >> n;
ll a[n];
rep(i, n) cin >> a[i];
int cnt = 0;
int cnt4 = 0;
rep(int i ,n) {
if (a[i] % 4 == 0) {
cnt++;
cnt4++;
}
else if (a[i] % 2 ==1) cnt--;
}
if (cnt >= 0) cout << "Yes";
else if (cnt == -1 and cnt4 >= n/2) cout << "Yes";
else cout << "No";
}
| a.cc: In function 'int main()':
a.cc:11:22: error: 'i' was not declared in this scope
11 | rep(i, n) cin >> a[i];
| ^
a.cc:5:24: error: two or more data types in declaration of 'i'
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^~~
a.cc:15:3: note: in expansion of macro 'rep'
15 | rep(int i ,n) {
| ^~~
a.cc:5:37: error: expected initializer before '<' token
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^
a.cc:15:3: note: in expansion of macro 'rep'
15 | rep(int i ,n) {
| ^~~
a.cc:5:37: error: expected ';' before '<' token
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^
a.cc:15:3: note: in expansion of macro 'rep'
15 | rep(int i ,n) {
| ^~~
a.cc:5:37: error: expected primary-expression before '<' token
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^
a.cc:15:3: note: in expansion of macro 'rep'
15 | rep(int i ,n) {
| ^~~
a.cc:5:40: error: expected ')' before ';' token
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ~ ^
a.cc:15:3: note: in expansion of macro 'rep'
15 | rep(int i ,n) {
| ^~~
a.cc:15:7: error: expected primary-expression before 'int'
15 | rep(int i ,n) {
| ^~~
a.cc:5:44: note: in definition of macro 'rep'
5 | #define rep(i, n) for (int i = 0; i < n; ++i);
| ^
|
s766685368 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i);
int main () {
int n;
cin >> n;
ll a[n];
rep(i, n) cin >> a[i];
int cnt = 0;
int cnt4 = 0;
rep(i ,n) {
if (a[i] % 4 == 0) {
cnt++;
cnt4++;
}
else if (a[i] % 2 ==1) cnt--;
}
if (cnt >= 0) cout << "Yes";
else if (cnt == -1 and cnt4 >= n/2) cout << "Yes";
else cout << "No";
}
| a.cc: In function 'int main()':
a.cc:11:22: error: 'i' was not declared in this scope
11 | rep(i, n) cin >> a[i];
| ^
|
s385633723 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef ll long long;
#define rep(i, n) for (int i = 0; i < n; ++i);
int main () {
int n;
cin >> n;
ll a[n];
rep(i, n) cin >> a[i];
int cnt = 0;
int cnt4 = 0;
rep(i ,n) {
if (a[i] % 4 == 0) {
cnt++;
cnt4++;
}
else if (a[i] % 2 ==1) cnt--;
}
if (cnt >= 0) cout << "Yes";
else if (cnt == -1 and cnt4 >= n/2) cout << "Yes";
else cout << "No";
}
| a.cc:4:9: error: 'll' does not name a type
4 | typedef ll long long;
| ^~
a.cc: In function 'int main()':
a.cc:10:3: error: 'll' was not declared in this scope
10 | ll a[n];
| ^~
a.cc:11:20: error: 'a' was not declared in this scope
11 | rep(i, n) cin >> a[i];
| ^
a.cc:11:22: error: 'i' was not declared in this scope
11 | rep(i, n) cin >> a[i];
| ^
|
s235517100 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef ll long long;
#define rep(i, n) for (int i = 0; i < n; ++i);
int main () {
int n;
vector<ll> v;
cin >> n;
rep(i, n) cin >> a[i];
int cnt = 0;
int cnt4 = 0;
rep(i ,n) {
if (a[i] % 4 == 0) {
cnt++;
cnt4++;
}
else if (a[i] % 2 ==1) cnt--;
}
if (cnt >= 0) cout << "Yes";
else if (cnt == -1 and cnt4 >= n/2) cout << "Yes";
else cout << "No";
} | a.cc:4:9: error: 'll' does not name a type
4 | typedef ll long long;
| ^~
a.cc: In function 'int main()':
a.cc:9:10: error: 'll' was not declared in this scope
9 | vector<ll> v;
| ^~
a.cc:9:12: error: template argument 1 is invalid
9 | vector<ll> v;
| ^
a.cc:9:12: error: template argument 2 is invalid
a.cc:11:20: error: 'a' was not declared in this scope
11 | rep(i, n) cin >> a[i];
| ^
a.cc:11:22: error: 'i' was not declared in this scope
11 | rep(i, n) cin >> a[i];
| ^
|
s922167699 | p03639 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
long longmain(void){
long long n;
cin >> n;
vector<long long> a(n);
for(auto &x : a){
cin >> x;
}
long long c2,c4;
c2=c4=0;
for(auto x : a){
if(x%4 == 0)
c4++;
if(x%2 == 0)
c2++;
}
if(c4 * 2 >= n - c2 && (c4 *2 - (n - c2))>= (c2 - c4)%2 )
cout << "Yes";
else
{
cout << "No";
}
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
|
s384129746 | p03639 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main() {
int n;
cin >> n;
int a, b, c;
rep(i, n) {
ll k;
cin >> k;
if (k % 4 == 0) {
c++;
}
else if (k % 2 == 0) {
b++;
}
else a++;
}
if (c >= a) {
cout << "Yes" << endl;
return 0;
}
if (c == a - 1 && b == 0) {
cout << "Yes" << endl;
return;
}
cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:34:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
34 | return;
| ^~~~~~
|
s033323920 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
signed main(){
lli n;
cin>>n;
vector<lli> a(n);
int c2 = 0;
int c4 = 0;
int c = 0;
REP(i, 0, n) {
if (a[i] % 4 == 0) c4++;
else if (a[i] % 2 == 0) c2++;
else c++;
}
if (c4 + 1 == c && N == (c4 + c)) cout<<"Yes"<<endl;
else if (c4 < c) cout<<"No"<<endl;
else{ cout<<"Yes"<<endl;}
return 0;
} | a.cc: In function 'int main()':
a.cc:30:24: error: 'N' was not declared in this scope
30 | if (c4 + 1 == c && N == (c4 + c)) cout<<"Yes"<<endl;
| ^
|
s631570383 | p03639 | C++ | #include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
inline int read(){
int a=0;static char c;
while((c=tc())<48||c>57);
while(c>=48&&c<=57)a=a*10+c-48,c=tc();
return a;
}
const int N = 1e5 + 5;
vector<int> cnt[4];
int res[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
n = read();
for(int i=0; i<n; ++i) {
int x = read();
cnt[x%4].push_back(x);
}
int p = n-1;
for(int i=n-1; i>=0; --i) {
if(cnt[2].empty()) break;
res[i] = cnt[2].back();
cnt[2].pop_back();
p = i;
}
for(int i=p-1; i>=0; i-=2) {
if(cnt[0].empty()) break;
res[i] = cnt[0].back();
cnt[0].pop_back();
}
for(int i=0; i<n; ++i) {
if(res[i] == 0) {
if(cnt[0].empty()) break;
res[i] = cnt[0].back();
cnt[0].pop_back();
}
}
for(int i=0; i<n; ++i) {
if(res[i] == 0) {
if(!cnt[1].empty()) {
res[i] = cnt[1].back();
cnt[1].pop_back();
}
else if(!cnt[3].empty()) {
res[i] = cnt[3].back();
cnt[3].pop_back();
} else {
puts("No");
return 0;
}
}
}
for(int i=0; i<n-1; ++i) {
if((res[i] * res[i+1]) % 4 != 0) {
puts("No");
return 0;
}
}
puts("Yes");
return 0;
}
| a.cc: In function 'int read()':
a.cc:9:12: error: 'tc' was not declared in this scope; did you mean 'c'?
9 | while((c=tc())<48||c>57);
| ^~
| c
a.cc:10:36: error: 'tc' was not declared in this scope; did you mean 'c'?
10 | while(c>=48&&c<=57)a=a*10+c-48,c=tc();
| ^~
| c
|
s533848699 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
ll modpow(ll a,ll n,ll m){//modpow(a,n,m) := a ^ n (mod m)
ll res = 1;
while(n > 0){
if(n & 1)res = res * a % m;
a = a * a % m;
n >>= 1;
}
return res;
}
ll modinv(ll a,ll p){//modinv(a,p) := pを法とするaの逆元(※pは素数でなければならない)
ll res = modpow(a,p-2,p);
return res;
}
int main(){
ll N;
cin >> N;
vector<ll> A(N);
ll cnt4 = 0,cnt2 = 0;
for(ll i = 0;i < N;i++){
cin >> A[i];
A[i] %= 4;
if(A[i] == 0){
cnt4++;
}
if(A[i] == 2){
cnt2++;
}
}
if(cnt4 * 2 >= N-cnt4){
cout << "Yes" << endl;
return 0;
}
if(cnt4 * 2 > t){
cnt2 -= cnt4 * 2 - t;
}
ll cnt27 = cnt2 / 2;
if(cnt2 % 2 == 1){
cnt2 = 1;
}else{
cnt2 = 0;
}
ll t = N - cnt4 - cnt2;
if(cnt4 * 2>= t && cnt2 == 0){
cout << "Yes" << endl;
return 0;
}
if(cnt4 * 2 > t && cnt2 == 1){
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:42:17: error: 't' was not declared in this scope
42 | if(cnt4 * 2 > t){
| ^
|
s206591620 | p03639 | Java | import java.util.*;
import java.lang.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] a = new long[N];
int count4 = 0,count2 = 0;
for( int i=0; i<N; i++ ){
a[i] = sc.nextLong();
if( a[i]%4==0 ){
count4++;
}
if( a[i]%4!=0 && a[i]%2==0 ){
count2++;
}
}
if( count4>=N/2 ){
System.out.println("Yes");
}else if( count2>=N-(count*2) ){
System.out.println("Yes");
}else{
System.out.println("No");
}
}
}
| Main.java:21: error: cannot find symbol
}else if( count2>=N-(count*2) ){
^
symbol: variable count
location: class Main
1 error
|
s722804022 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
int N;
cin >> N;
vector<ll> A(N);
int cnt4=0,cnt2=0;
for(int i = 0;i < N;i++){
cin >> A[i];
if(A[i] % 4 == 0)cnt4++;
if(A[i] % 4 == 2)cnt2++;
}
int B = N - cnt4 - cnt2;
if(cnt4 * 2 >= B && (cnt2 > 1 || cnt2 == 0){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
/*cout << B << "/" << cnt4 << "/" << cnt2 << endl;*/
} | a.cc: In function 'int main()':
a.cc:17:46: error: expected ')' before '{' token
17 | if(cnt4 * 2 >= B && (cnt2 > 1 || cnt2 == 0){
| ~ ^
| )
a.cc:24:1: error: expected primary-expression before '}' token
24 | }
| ^
|
s296674210 | p03639 | C++ | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int count[4] = {};
for (int a; cin >> a; count[a % 4]++) {
}
if (count[0] == n || count[1] == count[3] && count[1] == n || count[2] == n) {
cout << "Yes";
} else {
count << "No";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:15: error: invalid operands of types 'int [4]' and 'const char [3]' to binary 'operator<<'
13 | count << "No";
| ~~~~~ ^~ ~~~~
| | |
| int [4] const char [3]
|
s162634313 | p03639 | C++ | #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long
void solve() {
int N; cin >> N;
int a[100100];
rep(i, N) cin >> a[i];
map<int, int> mp;
rep(i, N) {
if(a[i] % 2 = 1) mp[0] ++;
else if(a[i] % 4 == 2) mp[1] ++;
else mp[2] ++;
}
int A = mp[2], B = mp[0] + (mp[1] != 0 ? 1 : 0);
if(B <= A + 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
//cout << fixed << setprecision(10);
//init();
solve();
//cout << "finish" << endl;
return 0;
} | a.cc: In function 'void solve()':
a.cc:55:17: error: lvalue required as left operand of assignment
55 | if(a[i] % 2 = 1) mp[0] ++;
| ~~~~~^~~
|
s634208368 | p03639 | C++ | #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long
void solve() {
int N; cin >> N;
rep(i, N) cin >> a[i];
map<int, int> mp;
rep(i, N) {
if(a[i] % 2 = 1) mp[0] ++;
else if(a[i] % 4 == 2) mp[1] ++;
else mp[2] ++;
}
int A = mp[2], B = mp[0] + (mp[1] != 0 ? 1 : 0);
if(B <= A + 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
//cout << fixed << setprecision(10);
//init();
solve();
//cout << "finish" << endl;
return 0;
} | a.cc: In function 'void solve()':
a.cc:51:22: error: 'a' was not declared in this scope
51 | rep(i, N) cin >> a[i];
| ^
a.cc:54:12: error: 'a' was not declared in this scope
54 | if(a[i] % 2 = 1) mp[0] ++;
| ^
|
s823072911 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void){
int N;
cin >> N;
int q_one = 0;
int q_two = 0;
int q_four = 0;
for(int i=0; i<N; i++){
int tmp;
cin >> tmp;
tmp %= 4;
if(tmp == 0) q_four++;
else if(tmp == 2) q_two++;
else q_one++;
}
q_two %= 2;
bool tf = false;
if(q_two == 1){
if(q_four > =q_one-1) tf = true;
}else{
if(q_four >= q_one) tf = true;
}
if(tf) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:17: error: expected primary-expression before '=' token
20 | if(q_four > =q_one-1) tf = true;
| ^
|
s238007881 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
#difine int long long
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int N;
cin >> N;
int div4 = 0;
int div2 = 0;
for (int i = 0; i < N; i++) {
int A;
cin >> A;
if (A % 4 == 0) div4++;
else if (A % 2 == 0) div2++;
}
int div1 = N - div2 - div4;
if (div2 > 0) div1 ++;
bool ok = div4 + 1 >= div1;
cout << (ok ? "Yes" : "NO") << endl;
return 0;
} | a.cc:4:2: error: invalid preprocessing directive #difine; did you mean #define?
4 | #difine int long long
| ^~~~~~
| define
|
s633327232 | p03639 | C++ | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 200000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;
int a[N];
int main() {
int n;
scanf("%d",&n);
int num4=0,num2=0;
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
if(a[i]%4==0)
num4++;
else if(a[i]%2==0)
num2++;
}
if(n>2*num4+num2+1)
printf("No\n");
else if(2*num4+num2+1==numOdd&&num2!=0)
printf("No\n");
else
printf("Yes\n");
return 0;
}
| a.cc: In function 'int main()':
a.cc:40:28: error: 'numOdd' was not declared in this scope
40 | else if(2*num4+num2+1==numOdd&&num2!=0)
| ^~~~~~
|
s966225539 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
typedef long long ll;
int main() {
int n;
cinh >> n;
int a[n];
bool f = 1;
rep(i, n - 1) {
cin >> a[i];
if((a[i] * a[i + 1]) % 4 == 0) {
f = 0;
break;
}
}
if(f) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:3: error: 'cinh' was not declared in this scope; did you mean 'sinh'?
7 | cinh >> n;
| ^~~~
| sinh
|
s786249415 | p03639 | C++ | 1 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1
| ^
|
s219690428 | p03639 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
typedef long long ll;
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
vector<ll> prime;
ll inv[MAX_N], fac[MAX_N];
template <class T = ll> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1; while (b > 0) { if (b & 1) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1]; for (int i = 0; i < n + 1; i++) { a[i] = 1; }for (int i = 2; i < n + 1; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }
vector<vector<pair<int,int>>> Edge;
vector<int> node;
bool bellman_ford(int n,int s) {
node = vector<int>(n,INF);
node[s] = 0;
REP (i,n) {
REP (j,Edge.size()) {
REP (k,Edge[j].size()) {
int from = j,to = Edge[j][k].F;
int cost = Edge[j][k].S;
if (node[from] != INF && node[to] > node[from] + cost) {
node[to] = node[from] + cost;
if (i == n - 1 && to == n - 1) return true;
}
}
}
}
return false;
}
signed main() {
int n;
cin >> n;
int odd = 0;
int eveven = 0;
REP (i,n) {
int x;
cin >> x;
if (x % 2 == 1) {
odd++;
}
if (x % 4 == 0) {
eveven++;
}
}
if ((odd + eveven == n && odd - 1 <= eveven) || odd <= even) cout << "Yes" << endl;
else cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:68:64: error: 'even' was not declared in this scope; did you mean 'eveven'?
68 | if ((odd + eveven == n && odd - 1 <= eveven) || odd <= even) cout << "Yes" << endl;
| ^~~~
| eveven
|
s618699750 | p03639 | C | #include <stdio.h>
#define min(a, b) ((a) < (b) ? (a) : (b))
#ifdef ONLINE_JUDGE
static char _in_buf[100000], *_in_p1 = _in_buf, *_in_p2 = _in_buf;
#define getchar() (_in_p1 == _in_p2 && (_in_p2 = (_in_p1 = _in_buf) + fread(_in_buf, 1, 100000, stdin), _in_p1 == _in_p2) ? EOF : *_in_p1 ++)
#endif
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((always_inline)) __inline__
void read(int *now) {
int f = *now = 0; register char c = getchar();
while ((c > 57 || c < 48) && ~c && c != '-') c = getchar();
(c == '-') && ((f = 1), c = getchar());
for (; c > 47 && c < 58; *now = (*now << 3) + (*now << 1) + c - '0', c = getchar());
f && (*now = -*now);
}
#ifdef __cplusplus
}
#endif
#define N 262144
#define inf 0x3f3f3f3f
int n, x, y, l, r, p[N];
int tr[N << 1 | 5], tr1[N << 1 | 5], tr2[N << 1 | 5];
#define build(tr) for (i = N; -- i; ) \
tr[i] = min(tr[i << 1], tr[i << 1 | 1])
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((always_inline)) __inline__
int query(int *t, int l, int r) {
int res = inf; l += N - 1, r += N + 1;
for (; l ^ r ^ 1; l >>= 1, r >>= 1)
(~l & 1) && (res = min(res, t[l + 1])),
(r & 1) && (res = min(res, t[r - 1]));
return res;
}
#ifdef __cplusplus
}
#endif
struct node {
int a, b, c, d;
} tp, q[N];
int sz = 0;
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((always_inline)) __inline__
int cmp(node a, node b) {
if (a.a ^ b.a) return a.a - b.a;
if (a.b ^ b.b) return a.b - b.b;
if (a.c ^ b.c) return a.c - b.c;
return a.d - b.d;
}
__attribute__((always_inline)) __inline__
void swap(node *a, node *b) { node c = *a; *a = *b; *b = c; }
__attribute__((always_inline)) __inline__
void heap_push(node x) {
q[++ sz] = x;
for (int i = sz, j = i >> 1; j; i = j, j >>= 1)
if (cmp(q[j], q[i]) > 0) swap(q + i, q + j);
}
__attribute__((always_inline)) __inline__
void heap_pop() {
q[1] = q[sz --];
for (int i = 1, j = i << 1; j <= sz; i = j, j <<= 1) {
((j | 1) <= sz && cmp(q[j | 1], q[j]) < 0) && (j |= 1);
if (cmp(q[i], q[j]) > 0) swap(q + i, q + j);
else break;
}
}
__attribute__((always_inline)) __inline__
void push(int l, int r) {
if (l > r) return; int x = query(l & 1 ? tr1 : tr2, l, r);
heap_push((node){x, query(l & 1 ? tr2 : tr1, p[x] + 1, r), l, r});
}
#ifdef __cplusplus
}
#endif
int main() {
register int i;
for (read(&n), i = 1; i <= n; ++ i)
read(&x), p[x] = i, tr[i + N] = x,
tr1[i + N] = i & 1 ? x : inf, tr2[i + N] = i & 1 ? inf : x;
build(tr); build(tr1); build(tr2);
for (push(1, n); sz; ) {
x = q[1].a, y = q[1].b, l = q[1].c, r = q[1].d;
printf("%d %d ", x, y), heap_pop();
push(l, p[x] - 1), push(p[x] + 1, p[y] - 1), push(p[y] + 1, r);
}
putchar('\n');
} | main.c:53:9: error: unknown type name 'node'
53 | int cmp(node a, node b) {
| ^~~~
main.c:53:17: error: unknown type name 'node'
53 | int cmp(node a, node b) {
| ^~~~
main.c:60:11: error: unknown type name 'node'
60 | void swap(node *a, node *b) { node c = *a; *a = *b; *b = c; }
| ^~~~
main.c:60:20: error: unknown type name 'node'
60 | void swap(node *a, node *b) { node c = *a; *a = *b; *b = c; }
| ^~~~
main.c:62:16: error: unknown type name 'node'
62 | void heap_push(node x) {
| ^~~~
main.c: In function 'heap_pop':
main.c:71:23: error: implicit declaration of function 'cmp' [-Wimplicit-function-declaration]
71 | ((j | 1) <= sz && cmp(q[j | 1], q[j]) < 0) && (j |= 1);
| ^~~
main.c:72:30: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
72 | if (cmp(q[i], q[j]) > 0) swap(q + i, q + j);
| ^~~~
main.c: In function 'push':
main.c:79:3: error: implicit declaration of function 'heap_push'; did you mean 'heap_pop'? [-Wimplicit-function-declaration]
79 | heap_push((node){x, query(l & 1 ? tr2 : tr1, p[x] + 1, r), l, r});
| ^~~~~~~~~
| heap_pop
main.c:79:14: error: 'node' undeclared (first use in this function)
79 | heap_push((node){x, query(l & 1 ? tr2 : tr1, p[x] + 1, r), l, r});
| ^~~~
main.c:79:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:79:19: error: expected ')' before '{' token
79 | heap_push((node){x, query(l & 1 ? tr2 : tr1, p[x] + 1, r), l, r});
| ~ ^
| )
|
s683648862 | p03639 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,m2=0,m4=0;;
cin>>n;
for(int i=0;i<n;i++){
cin>>a;
if(a%4==0)
m4++;
else if(a%2==0)
m2++;
}
if(m4>=(n-m4-m2+min(m2,1))
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:13:29: error: expected ';' before 'cout'
13 | if(m4>=(n-m4-m2+min(m2,1))
| ^
| ;
14 | cout<<"Yes"<<endl;
| ~~~~
a.cc:15:3: error: expected primary-expression before 'else'
15 | else
| ^~~~
a.cc:14:23: error: expected ')' before 'else'
14 | cout<<"Yes"<<endl;
| ^
| )
15 | else
| ~~~~
a.cc:13:5: note: to match this '('
13 | if(m4>=(n-m4-m2+min(m2,1))
| ^
|
s046074658 | p03639 | C++ | fn read<T: std::str::FromStr>() -> T {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
read::<String>().split_whitespace()
.map(|e| e.parse().ok().unwrap()).collect()
}
fn main() {
let n: i32 = read();
let v: Vec<usize> = read_vec();
let mut four_count = 0;
let mut two_count = 0;
for elem in v {
if elem % 4 == 0 {
four_count += 1;
} else if elem % 2 == 0 {
two_count += 1;
}
}
if two_count + four_count * 2 >= n {
println!("Yes");
} else if two_count == 0 && 2 * four_count + 1 >= n {
println!("Yes");
} else {
println!("No");
}
}
| a.cc:1:1: error: 'fn' does not name a type
1 | fn read<T: std::str::FromStr>() -> T {
| ^~
a.cc:7:1: error: 'fn' does not name a type
7 | fn read_vec<T: std::str::FromStr>() -> Vec<T> {
| ^~
a.cc:12:1: error: 'fn' does not name a type
12 | fn main() {
| ^~
|
s612668441 | p03639 | C++ | #include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;
int n;
int l[100005];
int main() {
scanf("%d", &n);
for(int i = 0; i < n; i++) {
int t;
scanf("%d", &t);
if(t%4==0) {
l[i] = 2;
}
else if(t%2 == 0) {
l[i] = 1;
}
else {
l[i] = 0;
}
}
sort(l, l+n);
vector<int> all;
int lhs = 0;
int rhs = n=1;
while(lhs <= rhs) {
all.push_back(l[lhs++]);
if(lhs <= rhs) {
all.push_back(r[rhs--]);
}
}
for(int i = 1; i < all.size(); i++) {
if(all[i-1] + all[i] < 2) {
printf("No\n");
return 0;
}
}
printf("Yes\n");
}
| a.cc: In function 'int main()':
a.cc:68:21: error: 'r' was not declared in this scope
68 | all.push_back(r[rhs--]);
| ^
|
s847542424 | p03639 | Java |
import java.io.*;
import java.util.*;
class Main{
public static void main(String[] args){
solve();
}
public static void solve(){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for(int i=0;i<n;i++){
a[i] = sc.nextInt();
}
int[] num = new int[3];
for(int i=0;i<n;i++){
if(a[i]%4==0){
num[0]++;
}
else if(a[i]%2==0){
num[1]++;
}
else{
num[2]++;
}
}
if(num[2]>num[0]+1){
System.out.printn("No");
}
else if(num[2]>num[0] && num[1]!=0){
System.out.println("No");
}
else if(num[2]!=0 && num[0]==0){
System.out.println("No");
}
else{
System.out.println("Yes");
}
}
}
| Main.java:29: error: cannot find symbol
System.out.printn("No");
^
symbol: method printn(String)
location: variable out of type PrintStream
1 error
|
s787428302 | p03639 | C++ | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int n, num, b1, b2, b4;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
scanf("%d", &num);
if (num % 4 == 0) b4++;
else if (num % 2 == 0) b2++;
else b1++;
}
if (b4 + 1 < b1 + b2 % 2) cout << "No" << endl;
else cout << "Yes" <, endl;
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:25: error: expected primary-expression before ',' token
17 | else cout << "Yes" <, endl;
| ^
a.cc:18:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
18 | cout << ans << endl;
| ^~~
| abs
|
s671399225 | p03639 | C++ | #include <stdio.h>
#include <stdlib.h>
int abs(int a)
{
return (a < 0) ? -a : a;
}
int solve(int *numbers, int N, int K)
{
int **storage = malloc(sizeof(int *) * N);
int i, j, k;
int result = 0;
for (i = 0; i < N; ++i)
*(storage + i) = calloc(K, sizeof(int));
// storage[i][j] keeps the optimal result where j + 1 elements are taken (K = j + 1) with numbers[i] appearing as the last element.
for (i = 1; i < N; ++i) {
for (j = 1; j < K; ++j) {
for (k = j - 1; k < i; ++k) {
if (storage[i][j] < storage[k][j - 1] + abs(numbers[k] - numbers[i]))
storage[i][j] = storage[k][j - 1] + abs(numbers[k] - numbers[i]);
if (j == K - 1 && result < storage[i][j])
result = storage[i][j];
}
}
}
for (i = 0; i < N; ++i)
free(*(storage + i));
free(storage);
return result;
}
int main()
{
int N, K;
scanf("%d %d", &N, &K);
int *numbers = malloc(sizeof(int) * N);
int i;
for (i = 0; i < N; ++i)
scanf("%d", numbers + i);
printf("%d\n", solve(numbers, N, K));
return 0;
} | a.cc: In function 'int solve(int*, int, int)':
a.cc:11:27: error: invalid conversion from 'void*' to 'int**' [-fpermissive]
11 | int **storage = malloc(sizeof(int *) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
| |
| void*
a.cc:16:32: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
16 | *(storage + i) = calloc(K, sizeof(int));
| ~~~~~~^~~~~~~~~~~~~~~~
| |
| void*
a.cc: In function 'int main()':
a.cc:43:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
43 | int *numbers = malloc(sizeof(int) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~
| |
| void*
|
s970364409 | p03639 | C++ | #include <stdio.h>
#include <stdlib.h>
int abs(int a)
{
return (a < 0) ? -a : a;
}
int solve(int *numbers, int N, int K)
{
int **storage = malloc(sizeof(int *) * N);
int i, j, k;
int result = 0;
for (i = 0; i < N; ++i)
*(storage + i) = calloc(K, sizeof(int));
// storage[i][j] keeps the optimal result where j + 1 elements are taken (K = j + 1) with numbers[i] appearing as the last element.
for (i = 1; i < N; ++i) {
for (j = 1; j < K; ++j) {
for (k = j - 1; k < i; ++k) {
if (storage[i][j] < storage[k][j - 1] + abs(numbers[k] - numbers[i]))
storage[i][j] = storage[k][j - 1] + abs(numbers[k] - numbers[i]);
if (j == K - 1 && result < storage[i][j])
result = storage[i][j];
}
}
}
for (i = 0; i < N; ++i)
free(*(storage + i));
free(storage);
return result;
}
int main()
{
int N, K;
scanf("%d %d", &N, &K);
int *numbers = malloc(sizeof(int) * N);
int i;
for (i = 0; i < N; ++i)
scanf("%d", numbers + i);
printf("%d\n", solve(numbers, N, K));
return 0;
}
| a.cc: In function 'int solve(int*, int, int)':
a.cc:11:27: error: invalid conversion from 'void*' to 'int**' [-fpermissive]
11 | int **storage = malloc(sizeof(int *) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
| |
| void*
a.cc:16:32: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
16 | *(storage + i) = calloc(K, sizeof(int));
| ~~~~~~^~~~~~~~~~~~~~~~
| |
| void*
a.cc: In function 'int main()':
a.cc:43:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
43 | int *numbers = malloc(sizeof(int) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~
| |
| void*
|
s570267746 | p03639 | C++ | #include <stdio.h>
#include <stdlib.h>
int abs(int a)
{
return (a < 0) ? -a : a;
}
int solve(int *numbers, int N, int K)
{
int **storage = malloc(sizeof(int *) * N);
int i, j, k;
int result = 0;
for (i = 0; i < N; ++i)
*(storage + i) = calloc(K, sizeof(int));
// storage[i][j] keeps the optimal result where j + 1 elements are taken (K = j + 1) with numbers[i] appearing as the last element.
for (i = 1; i < N; ++i) {
for (j = 1; j < K; ++j) {
for (k = j - 1; k < i; ++k) {
if (storage[i][j] < storage[k][j - 1] + abs(numbers[k] - numbers[i]))
storage[i][j] = storage[k][j - 1] + abs(numbers[k] - numbers[i]);
if (j == K - 1 && result < storage[i][j])
result = storage[i][j];
}
}
}
for (i = 0; i < N; ++i)
free(*(storage + i));
free(storage);
return result;
}
int main()
{
int N, K;
scanf("%d %d", &N, &K);
int *numbers = malloc(sizeof(int) * N);
int i;
for (i = 0; i < N; ++i)
scanf("%d", numbers + i);
printf("%d\n", solve(numbers, N, K));
return 0;
}
| a.cc: In function 'int solve(int*, int, int)':
a.cc:11:27: error: invalid conversion from 'void*' to 'int**' [-fpermissive]
11 | int **storage = malloc(sizeof(int *) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
| |
| void*
a.cc:16:32: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
16 | *(storage + i) = calloc(K, sizeof(int));
| ~~~~~~^~~~~~~~~~~~~~~~
| |
| void*
a.cc: In function 'int main()':
a.cc:43:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
43 | int *numbers = malloc(sizeof(int) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~
| |
| void*
|
s834153188 | p03639 | C++ | #include <stdio.h>
#include <stdlib.h>
int abs(int a)
{
return (a < 0) ? -a : a;
}
int solve(int *numbers, int N, int K)
{
int **storage = malloc(sizeof(int *) * N);
int i, j, k;
int result = 0;
for (i = 0; i < N; ++i)
*(storage + i) = calloc(K, sizeof(int));
// storage[i][j] keeps the optimal result where j + 1 elements are taken (K = j + 1) with numbers[i] appearing as the last element.
for (i = 1; i < N; ++i) {
for (j = 1; j < K; ++j) {
for (k = j - 1; k < i; ++k) {
if (storage[i][j] < storage[k][j - 1] + abs(numbers[k] - numbers[i]))
storage[i][j] = storage[k][j - 1] + abs(numbers[k] - numbers[i]);
if (j == K - 1 && result < storage[i][j])
result = storage[i][j];
}
}
}
for (i = 0; i < N; ++i)
free(*(storage + i));
free(storage);
return result;
}
int main()
{
int N, K;
scanf("%d %d", &N, &K);
int *numbers = malloc(sizeof(int) * N);
int i;
for (i = 0; i < N; ++i)
scanf("%d", numbers + i);
printf("%d\n", solve(numbers, N, K))
return 0;
}
| a.cc: In function 'int solve(int*, int, int)':
a.cc:11:27: error: invalid conversion from 'void*' to 'int**' [-fpermissive]
11 | int **storage = malloc(sizeof(int *) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
| |
| void*
a.cc:16:32: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
16 | *(storage + i) = calloc(K, sizeof(int));
| ~~~~~~^~~~~~~~~~~~~~~~
| |
| void*
a.cc: In function 'int main()':
a.cc:43:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
43 | int *numbers = malloc(sizeof(int) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~
| |
| void*
a.cc:48:41: error: expected ';' before 'return'
48 | printf("%d\n", solve(numbers, N, K))
| ^
| ;
49 |
50 | return 0;
| ~~~~~~
|
s735802236 | p03639 | C++ | #include <stdio.h>
#include <stdlib.h>
int abs(int a)
{
return (a < 0) ? -a : a;
}
int solve(int *numbers, int N, int K)
{
int **storage = malloc(sizeof(int *) * N);
int i, j, k;
int result = 0;
for (i = 0; i < N; ++i)
*(storage + i) = calloc(K, sizeof(int));
// storage[i][j] keeps the optimal result where j + 1 elements are taken (K = j + 1) with numbers[i] appearing as the last element.
for (i = 1; i < N; ++i) {
for (j = 1; j < K; ++j) {
for (k = j - 1; k < i; ++k) {
if (storage[i][j] < storage[k][j - 1] + abs(numbers[k] - numbers[i]))
storage[i][j] = storage[k][j - 1] + abs(numbers[k] - numbers[i]);
if (j == K - 1 && result < storage[i][j])
result = storage[i][j];
}
}
}
for (i = 0; i < N; ++i)
free(*(storage + i));
free(storage);
return result;
}
int main()
{
int N, K;
scanf("%d %d", &N, &K);
int *numbers = malloc(sizeof(int) * N);
int i;
for (i = 0; i < N; ++i)
scanf("%d", numbers + i);
printf("%d\n", solve(numbers, N, K))
return 0;
}
| a.cc: In function 'int solve(int*, int, int)':
a.cc:11:27: error: invalid conversion from 'void*' to 'int**' [-fpermissive]
11 | int **storage = malloc(sizeof(int *) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
| |
| void*
a.cc:16:32: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
16 | *(storage + i) = calloc(K, sizeof(int));
| ~~~~~~^~~~~~~~~~~~~~~~
| |
| void*
a.cc: In function 'int main()':
a.cc:43:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
43 | int *numbers = malloc(sizeof(int) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~
| |
| void*
a.cc:48:41: error: expected ';' before 'return'
48 | printf("%d\n", solve(numbers, N, K))
| ^
| ;
49 |
50 | return 0;
| ~~~~~~
|
s215955724 | p03639 | C++ | #include <stdio.h>
#include <stdlib.h>
int abs(int a)
{
return (a < 0) ? -a : a;
}
int solve(int *numbers, int N, int K)
{
int **storage = malloc(sizeof(int *) * N);
int i, j, k;
int result = 0;
for (i = 0; i < N; ++i)
*(storage + i) = calloc(K, sizeof(int));
// storage[i][j] keeps the optimal result where j + 1 elements are taken (K = j + 1) with numbers[i] appearing as the last element.
for (i = 1; i < N; ++i) {
for (j = 1; j < K; ++j) {
for (k = j - 1; k < i; ++k) {
if (storage[i][j] < storage[k][j - 1] + abs(numbers[k] - numbers[i]))
storage[i][j] = storage[k][j - 1] + abs(numbers[k] - numbers[i]);
if (j == K - 1 && result < storage[i][j])
result = storage[i][j];
}
}
}
for (i = 0; i < N; ++i)
free(*(storage + i));
free(storage);
return result;
}
int main()
{
int N, K;
scanf("%d %d", &N, &K);
int *numbers = malloc(sizeof(int) * N);
int i
for (i = 0; i < N; ++i)
scanf("%d", numbers + i);
printf("%d\n", solve(numbers, N, K));
return 0;
}
| a.cc: In function 'int solve(int*, int, int)':
a.cc:11:27: error: invalid conversion from 'void*' to 'int**' [-fpermissive]
11 | int **storage = malloc(sizeof(int *) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
| |
| void*
a.cc:16:32: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
16 | *(storage + i) = calloc(K, sizeof(int));
| ~~~~~~^~~~~~~~~~~~~~~~
| |
| void*
a.cc: In function 'int main()':
a.cc:43:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
43 | int *numbers = malloc(sizeof(int) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~
| |
| void*
a.cc:45:1: error: expected initializer before 'for'
45 | for (i = 0; i < N; ++i)
| ^~~
a.cc:45:13: error: 'i' was not declared in this scope
45 | for (i = 0; i < N; ++i)
| ^
|
s216599944 | p03639 | C++ | #include <stdio.h>
#include <stdlib.h>
int abs(int a)
{
return (a < 0) ? -a : a;
}
int solve(int *numbers, int N, int K)
{
int **storage = malloc(sizeof(int *) * N);
int i, j, k;
int result = 0;
for (i = 0; i < N; ++i)
*(storage + i) = calloc(K, sizeof(int));
// storage[i][j] keeps the optimal result where j + 1 elements are taken (K = j + 1) with numbers[i] appearing as the last element.
for (i = 1; i < N; ++i) {
for (j = 1; j < K; ++j) {
for (k = j - 1; k < i; ++k) {
if (storage[i][j] < storage[k][j - 1] + abs(numbers[k] - numbers[i]))
storage[i][j] = storage[k][j - 1] + abs(numbers[k] - numbers[i]);
if (j == K - 1 && result < storage[i][j])
result = storage[i][j];
}
}
}
for (i = 0; i < N; ++i)
free(*(storage + i));
free(storage);
return result;
}
int main()
{
int N, K;
scanf("%d %d", &N, &K);
int *numbers = malloc(sizeof(int) * N);
int i;
for (i = 0; i < N; ++i)
scanf("%d", numbers + i);
printf("%d\n", solve(numbers, N, K));
return 0;
} | a.cc: In function 'int solve(int*, int, int)':
a.cc:11:27: error: invalid conversion from 'void*' to 'int**' [-fpermissive]
11 | int **storage = malloc(sizeof(int *) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
| |
| void*
a.cc:16:32: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
16 | *(storage + i) = calloc(K, sizeof(int));
| ~~~~~~^~~~~~~~~~~~~~~~
| |
| void*
a.cc: In function 'int main()':
a.cc:43:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
43 | int *numbers = malloc(sizeof(int) * N);
| ~~~~~~^~~~~~~~~~~~~~~~~
| |
| void*
|
s987896135 | p03639 | C | #include<stdio.h>
#define m 200000
int main()
{
int a[m],i,n,sum1=0,sum2=0,sum3=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]%4==0)
sum1++;
if(a[i]%2==0)
sum2++;
}
sum3=n-sum2;
if(sum2==n||(sum1>=sum3-1&&sum2==0))printf("Yes");
else if(sum2==n||sum1>sum3)printf("Yes");
else printf("No");
return 0; | main.c: In function 'main':
main.c:19:5: error: expected declaration or statement at end of input
19 | return 0;
| ^~~~~~
|
s979247261 | p03639 | C |
public class Main {
int i=100100;
long a[] =new long[i];
String b[] =new String[i];
int four=0,two=0,one=0;
String str;
String[] temp;
public static void main(String[] args) {
Main c=new Main();
java.util.Scanner sc =new java.util.Scanner (System.in);
int n=sc.nextInt();
c.read_in(n);
c.check();
sc.close();
}
public void read_in(int n){
java.util.Scanner sc =new java.util.Scanner (System.in);
str=sc.nextLine();
temp=str.trim().split(" ");
for(i=0;i<n;i++){
a[i]= Long.parseLong(temp[i]);
if(a[i]%4==0){
four++;
}
else if(a[i]%2==0){
two++;
}
else one++;
}
sc.close();
}
public void check(){
if(one>four+1||(one==four+1&&two!=0))
System.out.println("No");
else System.out.println("Yes");
}
} | main.c:2:1: error: unknown type name 'public'
2 | public class Main {
| ^~~~~~
main.c:2:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
2 | public class Main {
| ^~~~
|
s812048039 | p03639 | C | #include<stdio.h>
#define N 100000000
int main()
{
long long int n = 0, i = 0;
int a[N] = { 0 };
int num1 = 0, num2 = 0, num3 = 0, answer = 0;
scanf_s("%lld", &n);
for (i = 0; i<n; i++)
scanf_s("%lld", &a[i]);
for (i = 0; i<n; i++) {
if (a[i] % 2 == 1)
num1 = num1 + 1;
if (a[i] % 2 == 0 && a[i] % 4 != 0)
num2 = num2 + 1;
if (a[i] % 4 == 0)
num3 = num3 + 1;
}
if (2 * num3 >= n - 1)
answer = 1;
else if ((num3 >= num1) && (num2 >= 2))
answer = 1;
else answer = 0;
if (answer) printf("YES");
if (!answer) printf("NO");
return 0;
} | main.c: In function 'main':
main.c:9:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
9 | scanf_s("%lld", &n);
| ^~~~~~~
| scanf
|
s507698845 | p03639 | C | [Window Title]
t255.exe
[Main Instruction]
t255.exe 已停止工作
[Content]
Windows 正在查找该问题的解决方案...
[取消] | main.c:1:1: error: expected identifier or '(' before '[' token
1 | [Window Title]
| ^
|
s629576151 | p03639 | Java | import java.util.Scanner;
public class C {
private int i=100100;
private int four=0,two=0,one=0;
private long a[] =new long[i];
public static void main(String[] args) {
C c=new C();
Scanner sc =new Scanner (System.in);
int n=sc.nextInt();
c.read_in(n);
c.check();
}
public void read_in(int n){
for(i=n;n>=1;n--){
Scanner sc =new Scanner (System.in);
a[i]= sc.nextInt();
if(a[i]%4==0){
four++;
}
else if(a[i]%2==0){
two++;
}
else one++;
}
}
public void check(){
if(one>four+1||(one==four+1&&two!=0)) System.out.print("No\n");
else System.out.print("Yes\n");
}
}
| Main.java:2: error: class C is public, should be declared in a file named C.java
public class C {
^
1 error
|
s409865750 | p03639 | C++ | #include<algorithm>
#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
int n, a[100005], b[5];
int main()
{
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= n; i++)
{
if (a[i] & 1)
{
b[1]++;
continue;
}
if (a[i] % 4 == 0)
b[4]++;
else if
(a[i] % 2 == 0) b[2]++;
}
if (!b[2] && b[1] > b[4] + 1)
{
printf("No");
return 0;
}
if (b[2] && b[1] > b[4])
{
printf("No");
return 0;
}
printf("Yes");
return 0; | a.cc: In function 'int main()':
a.cc:35:18: error: expected '}' at end of input
35 | return 0;
| ^
a.cc:8:1: note: to match this '{'
8 | {
| ^
|
s351321356 | p03639 | C++ | #include<algorithm>
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int n, a[100005], b[5];
int main()
{
scanf_s("%d", &n);
for (int i = 1; i <= n; i++)
scanf_s("%d", &a[i]);
for (int i = 1; i <= n; i++)
{
if (a[i] & 1)
{
b[1]++; continue;
}
if (a[i] % 4 == 0)
b[4]++;
else if
(a[i] % 2 == 0) b[2]++;
}
if (!b[2] && b[1] > b[4] + 1)
{
printf("No");
return 0;
}
if (b[2] && b[1] > b[4])
{
printf("No");
return 0;
}
printf("Yes");
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
9 | scanf_s("%d", &n);
| ^~~~~~~
| scanf
|
s701993509 | p03639 | C | #include<stdio.h>
int main(void)
{
int i,N,num,num_4=0,num_1=0,num_2=0;
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%d",&num);
if(num%4==0)
num_4+=1;
else if(num%2==0)
num_2+=1;
else
num_1+=1;
}
if(num_4+1>=num_1&&num_2=0)
printf("Yes\n");
else if(num_4>=num_1&&num_2!=0)
printf("Yes\n");
else printf("No\n");
return 0;
} | main.c: In function 'main':
main.c:16:33: error: lvalue required as left operand of assignment
16 | if(num_4+1>=num_1&&num_2=0)
| ^
|
s899177340 | p03639 | C++ | #include<iostream>
using namespace std;
long a[200050];
int main(){
int n,i;
long cnt1=0,cnt2=0,cnt3=0;
cin>>n;
for(i=0;i<n;i++){
cin>>a[i];
if(a[i]%4==0) cnt1++;
else if(a[i]%2==0) cnt2++;
else cnt3++;
}
if(cnt3&&cnt1<cnt3||!cnt2&&cnt1<cnt3-1) cout<<"No";
else cout<<"Yes";
return 0;
} | a.cc: In function 'int main()':
a.cc:14:29: error: '\U0000ff01cnt2' was not declared in this scope; did you mean 'cnt2'?
14 | if(cnt3&&cnt1<cnt3||!cnt2&&cnt1<cnt3-1) cout<<"No";
| ^~~~~~
| cnt2
|
s470112532 | p03639 | C | #include<stdio.h>
int main()
{
int n,b=0,c=0,d=0,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
` if(a[i]%2) b++;
else if(a[i]%4) c++;
else d++;
}
if(d>=b) printf("Yes");
else if(d==b-1&&c==0) printf("Yes");
else printf("No");
return 0;
}
| main.c: In function 'main':
main.c:9:3: error: stray '`' in program
9 | ` if(a[i]%2) b++;
| ^
|
s738172993 | p03639 | C | #include<stdio.h>
int main()
{
int n,b=0,c=0,d=0,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
` if(a[i]%2) b++;
else if(a[i]%4) c++;
else d++;
}
if(d>=b) printf("Yes");
else if(d=b-1&&c==0) printf("Yes");
else printf("No");
return 0;
}
| main.c: In function 'main':
main.c:9:3: error: stray '`' in program
9 | ` if(a[i]%2) b++;
| ^
|
s631494390 | p03639 | C++ | #include<iostream>
using namespace std;
int main()
{
int N;
while (cin >> N)
{
int *a = new int[N];
int num2 = 0;
int num4 = 0;
for (int i = 0; i < N; i++)
cin >> a[i];
for (int j = 0; j < N; j++)
if (a[j] % 2 == 0 && a[j] % 4 != 0)
num2++;
for (int k = 0; k < N; k++)
if (a[k] % 4 == 0)
num4++;
if (num4 == 0)
if (num2 == N)
cout << "Yes";
else
cout << "No";
if (num4 != 0)
{
if (num2 != 0)
if (num4 >= floor((N - num2 + 1) / 2.0))
cout << "Yes";
else
cout << "No";
else
if (num4 >= floor(N / 2))
cout << "Yes";
else
cout << "No";
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:45: error: 'floor' was not declared in this scope
29 | if (num4 >= floor((N - num2 + 1) / 2.0))
| ^~~~~
a.cc:34:45: error: 'floor' was not declared in this scope
34 | if (num4 >= floor(N / 2))
| ^~~~~
|
s854428965 | p03639 | C++ | #include<iostream>
using namespace std;
int main()
{
int N;
while (cin >> N)
{
int *a = new int[N];
int num2 = 0;
int num4 = 0;
for (int i = 0; i < N; i++)
cin >> a[i];
for (int j = 0; j < N; j++)
if (a[j] % 2 == 0 && a[j] % 4 != 0)
num2++;
for (int k = 0; k < N; k++)
if (a[k] % 4 == 0)
num4++;
if (num4 == 0)
if (num2 == N)
cout << "Yes";
else
cout << "No";
if (num4 != 0)
{
if (num2 != 0)
if (num4 >= floor((N - num2 + 1) / 2.0))
cout << "Yes";
else
cout << "No";
else
if (num4 >= floor(N / 2))
cout << "Yes";
else
cout << "No";
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:45: error: 'floor' was not declared in this scope
29 | if (num4 >= floor((N - num2 + 1) / 2.0))
| ^~~~~
a.cc:34:45: error: 'floor' was not declared in this scope
34 | if (num4 >= floor(N / 2))
| ^~~~~
|
s055573600 | p03639 | C++ | #include<iostream>
using namespace std;
int main()
{
int N;
while (cin >> N)
{
int *a = new int[N];
int num2 = 0;
int num4 = 0;
for (int i = 0; i < N; i++)
cin >> a[i];
for (int j = 0; j < N; j++)
if (a[j] % 2 == 0 && a[j] % 4 != 0)
num2++;
for (int k = 0; k < N; k++)
if (a[k] % 4 == 0)
num4++;
if (num4 == 0)
if (num2 == N)
cout << "Yes";
else
cout << "No";
if (num4 != 0)
{
if (num2 != 0)
if (num4 >= floor((N - num2 + 1) / 2.0))
cout << "Yes";
else
cout << "No";
else
if (num4 >= floor(N / 2))
cout << "Yes";
else
cout << "No";
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:45: error: 'floor' was not declared in this scope
29 | if (num4 >= floor((N - num2 + 1) / 2.0))
| ^~~~~
a.cc:34:45: error: 'floor' was not declared in this scope
34 | if (num4 >= floor(N / 2))
| ^~~~~
|
s485572225 | p03639 | C++ | #include<iostream>
using namespace std;
int main()
{
int N;
while (cin >> N)
{
int *a = new int[N];
int num2 = 0;
int num4 = 0;
for (int i = 0; i < N; i++)
cin >> a[i];
for (int j = 0; j < N; j++)
if (a[j] % 2 == 0 && a[j] % 4 != 0)
num2++;
for (int k = 0; k < N; k++)
if (a[k] % 4 == 0)
num4++;
if (num4 == 0)
if (num2 == N)
cout << "Yes";
else
cout << "No";
if (num4 != 0)
{
if (num2 != 0)
if (num4 >= floor((N - num2 + 1) / 2.0))
cout << "Yes";
else
cout << "No";
else
if (num4 >= floor(N / 2))
cout << "Yes";
else
cout << "No";
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:45: error: 'floor' was not declared in this scope
29 | if (num4 >= floor((N - num2 + 1) / 2.0))
| ^~~~~
a.cc:34:45: error: 'floor' was not declared in this scope
34 | if (num4 >= floor(N / 2))
| ^~~~~
|
s246098054 | p03639 | C++ | #include<iostream>
using namespace std;
int main()
{
int n,Ji=1;
cin >> n;
int a[10];
for (int i = 0; i < n; i++)
cin >> a[i];
int z = pow(4, (n - 2));
for (int m = 0; m < n; m++)
Ji *= a[m];
if (Ji % z!=0)
cout << "No";
else
cout << "Yes";
return 0;
} | a.cc: In function 'int main()':
a.cc:10:17: error: 'pow' was not declared in this scope
10 | int z = pow(4, (n - 2));
| ^~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.