submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s044376348 | p00700 | C++ | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;
//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"
int main() {
int N; cin >> N;
while (N--) {
int nx = 0, ny = 0;
int amax = 0;
pair<int, int>ans;
while (1) {
int dx, dy; cin >> dx >> dy;
if (!dx&&!dy)break;
nx += dx; ny += dy;
if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
ans = make_pair(nx, ny);
amax = nx*nx + ny*ny;
}
}
cout << ans.first<<" "<<ans.second << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:54: error: no match for 'operator==' (operand types are 'std::pair<int, int>' and 'int')
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ~~~^~~~~~~~~~~~~
| | |
| | int
| std::pair<int, 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:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/regex.h:1199: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>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/regex.h:1274: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>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
22 | if (amax < nx*nx + ny*ny||ans==nx*nx+ny*ny&&nx>ans.first) {
| ^~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:22:65: note: 'std::pair<int, int>' is not derived from 'const std::fpos<_StateT>'
22 | |
s805644750 | p00700 | C++ | #include<iostream>
using namespace std;
struct P
{
int x,y;
};
P maxP(const P a,const P b){
int la=a.x*a.x+a.y*a.y;
int lb=b.x*b.x+b.y*b.y;
if(la>lb)return a;
if(la<lb)return b;
if(a.x>b.x)
return a;
else
return b;
}
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
P d,p={0,0},m={0,0};
while(cin >> d.x >> d.y, d.x|d.y){
p.x+=d.x;p.y+=d.y;
m=maxP(m,p);
}
cout m.x << " " << m.y << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:32:21: error: expected ';' before 'm'
32 | cout m.x << " " << m.y << endl;
| ^~
| ;
|
s715454806 | p00701 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int up[101];
int down[101];
bool isaonb(int a,int b){
while(up[b]){
if(a==b)return true;
b=up[b];
}
return false;
}
void overaf(int a){
while(up[a]){
int upa=up[a];
down[up[a]]=0;
up[a]=0;
a=upa;
}
down[a]=0;
}
int topa(int a){
while(up[a])a=up[a];
return a;
}
main(){
int m;
while(cin>>m){
if(m==0)break;
memset(up,0,sizeof(up));
memset(down,0,sizeof(down));
int i,j;
while(cin>>i>>j){
if(i==0 && j==0)break;
if(i==j)continue;
if(i==0)continue;
if(j==0){
if(down[i]==0)continue;
else {
overaf(down[i]);
continue;
}
}
if(isaonb(i,j)){
continue;
}else if(isaonb(j,i)){
if(down[i])overaf(down[i]);
else overaf(i);
up[j]=i;
down[i]=j;
continue;
}else{
if(down[i])overaf(down[i]);
else overaf(i);
int topj=topa(j);
up[topj]=i;
down[i]=topj;
continue;
}
}
vector<int> pile;
for(int i=1;i<=m;i++){
if(down[i])continue;
int num=1;
int cur=i;
while(up[cur]){
++num;
cur=up[cur];
}
pile.push_back(num);
}
sort(pile.begin(),pile.end());
for(int i=0;i<pile.size();i++){
cout<<pile[i]<<endl;
}
cout<<"end"<<endl;
}
} | a.cc:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
33 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:38:5: error: 'memset' was not declared in this scope
38 | memset(up,0,sizeof(up));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 |
|
s373002939 | p00701 | C++ | #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int m,I,J,p[10000][100],s[10000],P;
void destroy(int pI,int ppI){
p[pI][ppI]=0;
for(int i=ppI+1;i<s[pI];i++){
p[P][0]=p[pI][i];
s[P++]=1;
p[pI][i]=0;
}
s[pI]=ppI;
}
int main(){
while(cin>>m&&m){
memset(p,0,sizeof(p));
fill(s,s+10000,0);
rep(i,m){p[i][0]=i+1;s[i]=1;}
P=m;
while(cin>>I>>J&&I){
if(I==J)continue;
int pI,ppI,pJ,ppJ;
if(!J){
rep(i,10000)rep(j,m){
if(p[i][j]==I){pI=i;ppI=j;}
}
if(ppI){
destroy(pI,ppI);
p[P][0]=I;
s[P++]=1;
}
continue;
}
rep(i,10000)rep(j,m){
if(p[i][j]==I){pI=i;ppI=j;}
if(p[i][j]==J){pJ=i;ppJ=j;}
}
if(pI==pJ){
if(ppI>ppJ)continue;
else{
int pppJ=P+ppJ-ppI;
destroy(pI,ppI);
p[pppJ][1]=I;
s[pppJ]++;
}
}
else{
destroy(pI,ppI);
p[pJ][s[pJ]++]=I;
}
}
sort(s,s+10000);
rep(i,10000)if(s[i])cout<<s[i]<<(i<9999?"\n":"\nend\n");
}
} | a.cc: In function 'int main()':
a.cc:32:17: error: 'memset' was not declared in this scope
32 | memset(p,0,sizeof(p));
| ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
11 | #include <stack>
+++ |+#include <cstring>
12 | #include <string>
|
s604433974 | p00701 | C++ | #include <iostream>
#include <vector>
using namespace std;
typedef pair<int, int> P;
bool empty(vector<int> &vi){ return vi.empty(); }
int main(){
int m;
while(cin >> m && m){
int I, J;
vector<vector<int> > vvi;
for(int i = 1; i <= m; i++){
vector<int> vi;
vi.push_back(i);
vvi.push_back(vi);
}
while(cin >> I >> J && (I || J)){
if(I == J) continue;
if(J == 0){
bool ok = false;
for(int i = 0; i < (int)vvi.size(); i++){
for(int j = 0; j < (int)vvi[i].size(); j++){
if(vvi[i][j] == I){
ok = true;
if(j != 0){
if(j == ((int)vvi[i].size() - 1)){
vector<int> vi;
vi.push_back(I);
vvi[i].pop_back();
vvi.push_back(vi);
}else{
int c = vvi[i].size() - j;
for(int k = 0; k < c; k++){
vector<int> vi(1, vvi[i][vvi[i].size() - 1]);
vvi[i].pop_back();
vvi.push_back(vi);
}
}
}
break;
}
}
if(ok) break;
}
}else{
P pi, pj;
for(int i = 0; i < (int)vvi.size(); i++){
for(int j = 0; j < (int)vvi[i].size(); j++){
if(vvi[i][j] == I) pi = P(i, j);
if(vvi[i][j] == J) pj = P(i, j);
}
}
if(pi.first == pj.first) {
if(pi.second < pj.second){
int c = vvi[pi.first].size() - pi.second - 1;
for(int i = 0; i < c; i++) {
vector<int> vi(1, vvi[pi.first][vvi[pi.first].size() - 1]);
vvi[pi.first].pop_back();
if(vi[0] == J) vi.push_back(I);
vvi.push_back(vi);
}
vvi[pi.first].pop_back();
}
}else{
if(vvi[pi.first].size() - pi.second == 1){
vvi[pi.first].pop_back();
vvi[pj.first].push_back(I);
}else{
int c = vvi[pi.first].size() - pi.second;
for(int i = 0; i < c - 1; i++){
vector<int> vi(1, vvi[pi.first][vvi[pi.first].size() - 1]);
vvi.push_back(vi);
vvi[pi.first].pop_back();
}
vvi[pi.first].pop_back();
vvi[pj.first].push_back(I);
}
}
}
vvi.erase(remove_if(vvi.begin(), vvi.end(), empty), vvi.end());
}
vector<int> res;
for(int i = 0; i < (int)vvi.size(); i++) res.push_back((int)vvi[i].size());
sort(res.begin(),res.end());
for(int i = 0; i < (int)res.size(); i++){
cout << res[i]<< endl;
}
cout << "end" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:89:17: error: 'remove_if' was not declared in this scope; did you mean 'remove'?
89 | vvi.erase(remove_if(vvi.begin(), vvi.end(), empty), vvi.end());
| ^~~~~~~~~
| remove
a.cc:94:5: error: 'sort' was not declared in this scope; did you mean 'short'?
94 | sort(res.begin(),res.end());
| ^~~~
| short
|
s923379326 | p00703 | Java |
import java.util.Scanner;
//FIX: Pay attention what the wild digits needs to be.
//They must not be used in different ways for the same could-be-answer.
//eliminate wild digit possibilities.
//Nah, thats not it.
//Maybe the blow counting is faulty.
public class Main
{
static Scanner scan = new Scanner(System.in);
public static void main(String[] args)
{
int l;
int h;
while(true)
{
l = scan.nextInt();
h = scan.nextInt();
if(l == 0 && h == 0)
{
break;
}
else
{
new HintSet(l, h);
}
}
}
static class HintSet
{
int length;
int hints;
String satisfier;
String[] guess;
int[] hit;
int[] blow;
// boolean[] numIsImpossible = new boolean[10]; //index 0 = true means there is no 0 in the answer.
// Digit[] digits;
int possibilities = 0; // When it reaches more than 1 answer becomes NO, terminate all computation.
// class Digit //nth digit
// {
// boolean[] eliminated = new boolean[10];
// public Digit()
// {
// }
// }
void computeAll()
{
compute("0");
compute("1");
compute("2");
compute("3");
compute("4");
compute("5");
compute("6");
compute("7");
compute("8");
compute("9");
}
boolean compute(String s)
{
if(possibilities < 2)
{
//check if it's possible.
int curL = s.length();
for(int i = 0; i < hints; i++)
{
//check hits.
//if the answer really [starts with]/[is] s...
int hitCount = 0;
int blowCount = 0;
for(int d = 0; d < s.length(); d++)
{
if(s.charAt(d) == guess[i].charAt(d))
{
hitCount += 1;
}
else
{
//check for blows (inefficient)
//check if, the character exists at another place in guess[i]
if(guess[i].contains( (""+s.charAt(d)) ) )
{
blowCount += 1;
}
}
}
// if(s.equals("638287")) {System.out.println("hint " + i + ", " + hitCount + " hits and " + blowCount + " blows");}
//if the answer really [starts with]/[is] s...
int zure = length - s.length(); //wild digits
int usedZure = 0;
//CHECK HITS
{
//we should at least have hit[i] - zure count of hits?
if(hitCount < hit[i] - zure)
{
//no matter what the blanks are filled with,
//(even if they're all hits)
//we still won't have enough hits,
//if this were the answer.
// System.out.println("[1] Answer cant be " + s + " according to hint " + i);
return false;
}
if(hitCount > hit[i])
{
// System.out.println("[2] Answer cant be " + s + " according to hint " + i);
//overhit; even if they blanks were all non hits,
//we already have too many hits.
//(the actual answer is not as close to the 'try')
return false;
}
usedZure = hit[i] - hitCount; //usedZure --> wild digits that have to be hits.
}
//CHECK BLOWS
{
zure -= usedZure;
//zure is reduced by hits accordingly, since the wild digits can't fulfill both hit and blow at once.
//zure right now is only wild digits that may fulfill blows.
if(blowCount < blow[i] - zure)
{
// System.out.println("[1] Answer cant be " + s + " according to hint " + i);
return false;
}
if(blowCount > blow[i])
{
// System.out.println("[2] Answer cant be " + s + " according to hint " + i);
return false;
}
}
//
}
//haven't returned false yet means it's still possible.
if(curL == length)
{
//this could be the answer!!
possibilities += 1;
satisfier = s;
// System.out.println("Answer could be " + s);
return true;
}
else
{
//LATER: don't check impossible digits.
for(int a = 0; a<= 9;a++)
{
String sa = Integer.toString(a);
if(!s.contains(sa)) {compute(s + sa);}
}
// compute(s + "0");
// compute(s + "1");
// compute(s + "2");
}
return false;
}
else
{
return false;
}
}
public HintSet(int l, int h)
{
length = l;
hints = h;
guess = new String[hints];
hit = new int[hints];
blow = new int[hints];
digits = new Digit[l];
for(int i = 0; i < l; i++)
{
}
for(int i = 0; i < h; i++)
{
guess[i] = scan.next();
hit[i] = scan.nextInt();
blow[i] = scan.nextInt();
//process hits
//process blows
}
computeAll();
//process blows
if(possibilities == 1)
{
System.out.println(satisfier);
}
else
{
System.out.println("NO");
}
// System.out.println(possibilities + " possibilities.");
}
}
}
| Main.java:196: error: cannot find symbol
digits = new Digit[l];
^
symbol: variable digits
location: class HintSet
Main.java:196: error: cannot find symbol
digits = new Digit[l];
^
symbol: class Digit
location: class HintSet
2 errors
|
s253471123 | p00703 | Java |
import java.util.Scanner;
//FIX: Pay attention what the wild digits needs to be.
//They must not be used in different ways for the same could-be-answer.
//eliminate wild digit possibilities.
//Nah, thats not it.
//Maybe the blow counting is faulty.
public class Main
{
static Scanner scan = new Scanner(System.in);
public static void main(String[] args)
{
int l;
int h;
while(true)
{
l = scan.nextInt();
h = scan.nextInt();
if(l == 0 && h == 0)
{
break;
}
else
{
new HintSet(l, h);
}
}
}
static class HintSet
{
int length;
int hints;
String satisfier;
String[] guess;
int[] hit;
int[] blow;
// boolean[] numIsImpossible = new boolean[10]; //index 0 = true means there is no 0 in the answer.
// Digit[] digits;
int possibilities = 0; // When it reaches more than 1 answer becomes NO, terminate all computation.
// class Digit //nth digit
// {
// boolean[] eliminated = new boolean[10];
// public Digit()
// {
// }
// }
void computeAll()
{
compute("0");
compute("1");
compute("2");
compute("3");
compute("4");
compute("5");
compute("6");
compute("7");
compute("8");
compute("9");
}
boolean compute(String s)
{
if(possibilities < 2)
{
//check if it's possible.
int curL = s.length();
for(int i = 0; i < hints; i++)
{
//check hits.
//if the answer really [starts with]/[is] s...
int hitCount = 0;
int blowCount = 0;
for(int d = 0; d < s.length(); d++)
{
if(s.charAt(d) == guess[i].charAt(d))
{
hitCount += 1;
}
else
{
//check for blows (inefficient)
//check if, the character exists at another place in guess[i]
if(guess[i].contains( (""+s.charAt(d)) ) )
{
blowCount += 1;
}
}
}
// if(s.equals("638287")) {System.out.println("hint " + i + ", " + hitCount + " hits and " + blowCount + " blows");}
//if the answer really [starts with]/[is] s...
int zure = length - s.length(); //wild digits
int usedZure = 0;
//CHECK HITS
{
//we should at least have hit[i] - zure count of hits?
if(hitCount < hit[i] - zure)
{
//no matter what the blanks are filled with,
//(even if they're all hits)
//we still won't have enough hits,
//if this were the answer.
// System.out.println("[1] Answer cant be " + s + " according to hint " + i);
return false;
}
if(hitCount > hit[i])
{
// System.out.println("[2] Answer cant be " + s + " according to hint " + i);
//overhit; even if they blanks were all non hits,
//we already have too many hits.
//(the actual answer is not as close to the 'try')
return false;
}
usedZure = hit[i] - hitCount; //usedZure --> wild digits that have to be hits.
}
//CHECK BLOWS
{
zure -= usedZure;
//zure is reduced by hits accordingly, since the wild digits can't fulfill both hit and blow at once.
//zure right now is only wild digits that may fulfill blows.
if(blowCount < blow[i] - zure)
{
// System.out.println("[1] Answer cant be " + s + " according to hint " + i);
return false;
}
if(blowCount > blow[i])
{
// System.out.println("[2] Answer cant be " + s + " according to hint " + i);
return false;
}
}
//
}
//haven't returned false yet means it's still possible.
if(curL == length)
{
//this could be the answer!!
possibilities += 1;
satisfier = s;
// System.out.println("Answer could be " + s);
return true;
}
else
{
//LATER: don't check impossible digits.
for(int a = 0; a<= 9;a++)
{
String sa = Integer.toString(a);
if(!s.contains(sa)) {compute(s + sa);}
}
// compute(s + "0");
// compute(s + "1");
// compute(s + "2");
}
return false;
}
else
{
return false;
}
}
public HintSet(int l, int h)
{
length = l;
hints = h;
guess = new String[hints];
hit = new int[hints];
blow = new int[hints];
digits = new Digit[l];
for(int i = 0; i < l; i++)
{
}
for(int i = 0; i < h; i++)
{
guess[i] = scan.next();
hit[i] = scan.nextInt();
blow[i] = scan.nextInt();
//process hits
//process blows
}
computeAll();
//process blows
if(possibilities == 1)
{
System.out.println(satisfier);
}
else
{
System.out.println("NO");
}
// System.out.println(possibilities + " possibilities.");
}
}
}
| Main.java:196: error: cannot find symbol
digits = new Digit[l];
^
symbol: variable digits
location: class HintSet
Main.java:196: error: cannot find symbol
digits = new Digit[l];
^
symbol: class Digit
location: class HintSet
2 errors
|
s317381743 | p00703 | Java | package mastermind;
public class InfinityLoopTest {
public static void main(String[] args) {
//infinite loop test
while(true) {}
}
}
| Main.java:3: error: class InfinityLoopTest is public, should be declared in a file named InfinityLoopTest.java
public class InfinityLoopTest {
^
1 error
|
s147912223 | p00703 | C++ | #include <iostream>
#include <string>
#include <cstdlib>
#include <bitset>
using namespace std;
typedef long long int lli;
const int MAX_H = 1000000;
int L, H;
lli nums[MAX_H];
int s_nums[MAX_H], hit[MAX_H], blow[MAX_H];
lli ans;
void print_bit(lli n){
for(int i = 0; i < L; ++i){
cout << static_cast<bitset<4> >(n&15) << ".";
n >>= 4;
}
cout << endl;
}
lli conv_64(string s){
lli ret = 0;
for(int i = 0; i < L; ++i){
ret <<= 4;
ret += (lli)(s[i]-'0');
}
return ret;
}
string deco_64(lli n){
string ret;
for(int i = 0; i < L; ++i){
ret += (char)((n&15)+'0');
n >>= 4;
}
reverse(ret.begin(), ret.end());
return ret;
}
int conv(string s){
int ret = 0;
for(int i = 0; i < L; ++i){
ret += 1 << (s[i]-'0');
}
return ret;
}
int check_64(lli n, lli m){
lli tmp = n ^ m;
int ret = 0;
for(int i = 0; i < L; ++i){
if((15&tmp) == 0){
++ret;
}
tmp >>= 4;
}
return ret;
}
int check(int n, int m){
int tmp = n & m;
int ret = 0;
while(tmp != 0){
if((tmp & 1) == 1){
++ret;
}
tmp >>= 1;
}
return ret;
}
bool solve(lli n, int m){
for(int i = 0; i < H; ++i){
int h = check_64(n, nums[i]);
int b = check(m, s_nums[i]) - h;
if(hit[i] != h || blow[i] != b){
return false;
}
}
return true;
}
int dfs(lli n, int used, int depth){
if(depth == L){
if(solve(n, used)){
ans = n;
return 1;
}
return 0;
}
int ret = 0;
for(int i = 0; i < 10; ++i){
if(((used >> i) & 1) == 1){
continue;
}
ret += dfs((n<<4)+i, used|(1<<i), depth+1);
if(ret >= 2){
return ret;
}
}
return ret;
}
int main(){
while(true){
cin >> L >> H;
if(L == 0 && H == 0){
break;
}
for(int i = 0; i < H; ++i){
string tmp;
cin >> tmp;
nums[i] = conv_64(tmp);
s_nums[i] = conv(tmp);
cin >> hit[i] >> blow[i];
}
int a = dfs(0L, 0, 0);
if(a == 1){
//print_bit(ans);
cout << deco_64(ans) << endl;
}
else{
cout << "NO" << endl;
}
}
return 0;
}
//uncode | a.cc: In function 'std::string deco_64(lli)':
a.cc:33:3: error: 'reverse' was not declared in this scope
33 | reverse(ret.begin(), ret.end());
| ^~~~~~~
|
s649717902 | p00703 | C++ | #include<cstdio>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
bool isvalid(int n,const char *s,const char *tr,int hit,int blow){
rep(i,n) rep(j,n) if(s[i]==tr[j]) {
if(i==j) hit--;
else blow--;
}
return hit==0 && blow==0;
}
int m,idx[3628800];
char s[3628800][11];
void gen(int i,int n,char *tmp,bool *used){
if(i==n){
strcpy(s[m],tmp);
idx[m]=m++;
return;
}
for(int c='0';c<='9';c++) if(!used[c]) {
used[c]=true;
tmp[i]=c;
gen(i+1,n,tmp,used);
used[c]=false;
}
}
int main(){
for(int n,nh;scanf("%d%d",&n,&nh),n;){
m=0;
char tmp[11]="";
bool used[128]={};
gen(0,n,tmp,used);
// printf("m=%d\n",m);
// rep(i,10) puts(s[i]);
while(nh--){
char tr[11];
int hit,blow; scanf("%s%d%d",tr,&hit,&blow);
rep(i,m) if(!isvalid(n,s[idx[i]],tr,hit,blow)) {
swap(idx[i],idx[m-1]);
i--;
m--;
}
}
printf("%s\n",m==1?s[idx[0]]:"NO");
}
return 0;
} | a.cc: In function 'void gen(int, int, char*, bool*)':
a.cc:20:17: error: 'strcpy' was not declared in this scope
20 | strcpy(s[m],tmp);
| ^~~~~~
a.cc:3:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<algorithm>
+++ |+#include <cstring>
3 |
|
s093888729 | p00703 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int L,H;
string strs[1001];
int hits[1001];
int blows[1001];
int nums[1001];
bool isSelected[1001];
// numsÌgÆtgtðär
bool check(string &tgt,int hit,int blow){
int h=0;
int b=0;
for(int i=0;i<tgt.size();i++){
if(tgt[i]==nums[i]+'0'){
h++;
}
else{
if(isSelected[tgt[i]-'0'])b++;
}
}
return (h==hit)&&(b==blow);
}
int main(){
while(cin>>L>>H&&(L|H)){
memset(isSelected,0,sizeof(isSelected));
int cnt=0;
string obj;
for(int i=0;i<H;i++)
cin>>strs[i]>>hits[i]>>blows[i];
for(int s=0;s<(1<<10);s++){
int a=0;
for(int i=0;i<10;i++){
if((s>>i)&1){
isSelected[i]=true;
nums[a++]=i;
}
else isSelected[i]=false;
}
if(a!=L)continue;
// Ôðüê֦·×Ä·
do{
bool ok=true;
for(int i=0;i<H;i++){
if(!check(strs[i],hits[i],blows[i])){
ok=false;
break;
}
}
// ·×ÄÌÉεÄÃÈçÎ
if(ok){
cnt++;
if(cnt>=2)break;
for(int i=0;i<L;i++)
obj+=(nums[i]+'0');
}
}while(next_permutation(nums,nums+L));
if(cnt>=2)break;
}
if(cnt==1)
cout<<obj<<endl;
else cout<<"NO"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:33:9: error: 'memset' was not declared in this scope
33 | memset(isSelected,0,sizeof(isSelected));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <algorithm>
+++ |+#include <cstring>
4 | #include <string>
|
s023624556 | p00703 | C++ | #include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;
#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }
typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int main(){
int L, H;
while(cin>>L>>H,L){
int S = (1<<L)-1;
vector<int> ans;
bool used[1000][10] = {};
vector<string> vs(H);
vector<int> hit(H);
vector<int> brow(H);
REP(i,H){
cin>>vs[i]>>hit[i]>>brow[i];
REP(j,vs[i].size())used[i][vs[i][j]-'0'] = true;
}
while(S < 1<<10){
REP(i,H){
int hb = 0;
REP(j,10)if(used[i][j] && S >> j & 1)hb++;
if(hit[i] + brow[i] != hb){
goto NEXT;
}
}
vector<int> digit;
REP(i,10)if(S >> i & 1)digit.push_back(i);
do{
bool ok = true;
REP(i,H){
int h = 0;
REP(j,L)if((vs[i][j]-'0') == digit[j])h++;
if(hit[i] != h){
ok = false;
break;
}
}
if(ok){
if(ans.size() > 0){
ans = vector<int>();
goto OUTPUT;
}else{
ans = digit;
}
}
}while(next_permutation(digit.begin(), digit.end()));
NEXT:
int x = S & -S, y = S + x;
S = ((S & ~y) / x >> 1) | y;
}
OUTPUT:
if(ans.size() > 0) { REP(i,ans.size()){cout<<ans[i];} cout<<endl; }
else cout<<"NO"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:71:7: error: jump to label 'NEXT'
71 | NEXT:
| ^~~~
a.cc:47:16: note: from here
47 | goto NEXT;
| ^~~~
a.cc:50:19: note: crosses initialization of 'std::vector<int> digit'
50 | vector<int> digit;
| ^~~~~
|
s823465961 | p00704 | C++ | やほお | a.cc:1:1: error: '\U00003084\U0000307b\U0000304a' does not name a type
1 | やほお
| ^~~~~~
|
s787939804 | p00705 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigDecimal;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static final int INF=Integer.MAX_VALUE;
static final long LINF=Long.MAX_VALUE;
static void solve(){
int[] cnt=new int[100];
while(true){
int n=ir.nextInt();
if(n==0) return;
int q=ir.nextInt();
for(int i=0;i<n;i++){
int m=ir.nextInt();
for(int j=0;j<m;j++){
cnt[ir.nextInt()]++;
}
}
for(int i=99;i>=0;i--){
if(cnt[i]==q){
out.println(i);
break;
}
if(i==0) out.println(0);
}
Arrays.fill(cnt,0)
}
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public BigInteger nextBigInteger(){return new BigInteger(next());}
public BigDecimal nextBigDecimal(){return new BigDecimal(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:38: error: ';' expected
Arrays.fill(cnt,0)
^
1 error
|
s258551011 | p00705 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigDecimal;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static final int INF=Integer.MAX_VALUE;
static final long LINF=Long.MAX_VALUE;
static void solve(){
int[] cnt=new int[100];
while(true){
int n=ir.nextInt();
if(n==0) return;
int q=ir.nextInt();
for(int i=0;i<n;i++){
int m=ir.nextInt();
for(int j=0;j<m;j++){
cnt[ir.nextInt()]++;
}
}
int ans=0;
for(int i=1;i<100;i++)
if(cnt[i]>=q){
ans=i;
break;
}
}
out.println(ans);
Arrays.fill(cnt,0);
}
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public BigInteger nextBigInteger(){return new BigInteger(next());}
public BigDecimal nextBigDecimal(){return new BigDecimal(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:43: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) throws Exception{
^
(use --enable-preview to enable unnamed classes)
Main.java:151: error: class, interface, enum, or record expected
}
^
2 errors
|
s864287543 | p00705 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigDecimal;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static final int INF=Integer.MAX_VALUE;
static final long LINF=Long.MAX_VALUE;
static void solve(){
int[] cnt=new int[100];
while(true){
int n=ir.nextInt();
if(n==0) return;
int q=ir.nextInt();
for(int i=0;i<n;i++){
int m=ir.nextInt();
for(int j=0;j<m;j++){
cnt[ir.nextInt()]++;
}
}
int ans=0;
for(int i=1;i<100;i++)
if(cnt[i]>=q){
ans=i;
break;
}
}
out.println(ans);
Arrays.fill(cnt,0);
}
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public BigInteger nextBigInteger(){return new BigInteger(next());}
public BigDecimal nextBigDecimal(){return new BigDecimal(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:43: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) throws Exception{
^
(use --enable-preview to enable unnamed classes)
Main.java:151: error: class, interface, enum, or record expected
}
^
2 errors
|
s270732809 | p00705 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while (true) {
int n = s.nextInt();
int q = s.nextInt();
if (n == 0 && q == 0)
break;
int[] day = new int[101];
for (int i = 0; i < n; i++) {
int m = s.nextInt();
for (int j = 0; j < m; j++) {
int d = s.nextInt();
day[d]++;
}
}
int max = 0;
for (int j = 0; j < 101; j++) {
if (max < day[j])
max = day[j];
}
int ans = 0;
for (int j = 0; j < 101; j++) {
if (max == day[j]) {
ans = j;
break;
}
}
if (max >= q)
System.out.println(ans);
else
System.out.println(0);
}
s.close();
}
} | Main.java:3: error: illegal character: '\u3000'
public class?Main {
^
1 error
|
s323134115 | p00705 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while (true) {
int n = s.nextInt();
int q = s.nextInt();
if (n == 0 && q == 0)
break;
int[] day = new int[101];
for (int i = 0; i < n; i++) {
int m = s.nextInt();
for (int j = 0; j < m; j++) {
int d = s.nextInt();
day[d]++;
}
}
int max = 0;
for (int j = 0; j < 101; j++) {
if (max < day[j])
max = day[j];
}
int ans = 0;
for (int j = 0; j < 101; j++) {
if (max == day[j]) {
ans = j;
break;
}
}
if (max >= q)
System.out.println(ans);
else
System.out.println(0);
}
s.close();
}
} | Main.java:3: error: illegal character: '\u3000'
public class?Main {
^
1 error
|
s256794215 | p00705 | C | g#include <stdio.h>
#define SIZE 100
int date[SIZE + 1];
/* prototype declaration */
void init();
void count(int day);
int search(int quorum);
int main(int argc, const char *argv[])
{
int i, j, N, Q, M, day, ans;
while(1)
{
/* initialization */
init();
ans = 0;
scanf("%d%d", &N, &Q);
if(N == 0 && Q == 0)
{
break;
}
for(i = 0; i < N; i++)
{
scanf("%d", &M);
for(j = 0; j < M; j++)
{
scanf("%d", &day);
count(day);
}
if(!ans)
{
ans = search(Q);
}
}
printf("%d\n", ans);
}
return 0;
}
void init()
{
int i;
for(i = 0; i < SIZE; i++)
{
date[i] = 0;
}
}
void count(int day)
{
date[day] += 1;
}
int search(int quorum)
{
int i, min = SIZE + 1;
for(i = 0; i < SIZE; i++)
{
if(date[i] >= quorum)
{
min = i < min ? i : min;
}
}
return min == SIZE + 1 ? 0 : min;
} | main.c:1:2: error: stray '#' in program
1 | g#include <stdio.h>
| ^
main.c:1:1: error: unknown type name 'g'
1 | g#include <stdio.h>
| ^
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | g#include <stdio.h>
| ^
main.c: In function 'main':
main.c:21:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
21 | scanf("%d%d", &N, &Q);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | g#include <stdio.h>
main.c:21:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
21 | scanf("%d%d", &N, &Q);
| ^~~~~
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:44:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
44 | printf("%d\n", ans);
| ^~~~~~
main.c:44:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:44:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:44:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'init':
main.c:55:17: error: 'date' undeclared (first use in this function)
55 | date[i] = 0;
| ^~~~
main.c:55:17: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'count':
main.c:61:9: error: 'date' undeclared (first use in this function)
61 | date[day] += 1;
| ^~~~
main.c: In function 'search':
main.c:70:20: error: 'date' undeclared (first use in this function)
70 | if(date[i] >= quorum)
| ^~~~
|
s679120453 | p00705 | C | #include <stdio.h>
int main(){
int N, Q;
int M, data;
int i,j;
int maxMember,maxMemberdata;
while(1){
//int canAttend[100]={0,};
scanf("%d%d",&N,&Q);if(N==0&&Q==0) break;
maxMember=Q-1;
maxMemberdata=0;
for(j=0;j<100;j++) canAttend[j]=0;
for(i=0;i<N;i++){
scanf("%d", &M);
for(j=0;j<M;j++){
scanf("%d", &data);
canAttend[data]=canAttend[data]+1;
}
}
for(i=0;i<100;i++){
if(canAttend[i]>maxMember){
maxMember=canAttend[i];
maxMemberdata=i;
}
}
printf("%d\n",maxMemberdata);
}
return 0;
} | main.c: In function 'main':
main.c:13:36: error: 'canAttend' undeclared (first use in this function)
13 | for(j=0;j<100;j++) canAttend[j]=0;
| ^~~~~~~~~
main.c:13:36: note: each undeclared identifier is reported only once for each function it appears in
|
s164196172 | p00705 | C | #include <stdio.h>
int main(){
int N, Q;
int M, data;
//int canAttend[100];
int i,j;
int maxMember,maxMemberdata;
while(true){
int canAttend[100]={0,};
scanf("%d%d",&N,&Q);if(N==0&&Q==0) break;
maxMember=Q-1;
maxMemberdata=0;
//for(j=0;j<100;j++) canAttend[j]=0;
for(i=0;i<N;i++){
scanf("%d", &M);
for(j=0;j<M;j++){
scanf("%d", &data);
canAttend[data]=canAttend[data]+1;
}
}
for(i=0;i<100;i++){
if(canAttend[i]>maxMember){
maxMember=canAttend[i];
maxMemberdata=i;
}
}
printf("%d\n",maxMemberdata);
}
return 0;
} | main.c: In function 'main':
main.c:9:15: error: 'true' undeclared (first use in this function)
9 | while(true){
| ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
1 | #include <stdio.h>
+++ |+#include <stdbool.h>
2 |
main.c:9:15: note: each undeclared identifier is reported only once for each function it appears in
9 | while(true){
| ^~~~
|
s564744071 | p00705 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N, Q, M, temp;
while(1){
int temp2[300] = {}ans = 0;
cin>>N>>Q;
if(N == 0 && Q == 0) break;
for(int i = 1; i <= N; i++){
cin>>M;
for(int j = 1; j <= M; j++){
cin>>temp;
temp2[temp]++;
}
}
for(int i = 1; i <= 250; i++){
if(temp2[ans] < temp2[i])ans = i;
}
if(temp2[ans] >= Q) cout<<ans<<endl;
else cout<<0<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:36: error: expected ',' or ';' before 'ans'
8 | int temp2[300] = {}ans = 0;
| ^~~
a.cc:22:34: error: 'ans' was not declared in this scope; did you mean 'abs'?
22 | if(temp2[ans] < temp2[i])ans = i;
| ^~~
| abs
a.cc:25:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
25 | if(temp2[ans] >= Q) cout<<ans<<endl;
| ^~~
| abs
|
s659184477 | p00705 | C++ | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> l(101,0);
int main(){
int i,j,N,Q,M,d;
while(1){
scanf("%d %d",&N,&Q);
if(!N && !Q){break;}
l.fill(l.begin(),l.end(),0)
for(i=0;i<N;i++){
scanf("%d",&M);
for(j=0;j<M;j++){
scanf("%d",&d);
l[d]++;
}
}
auto maxit=max_element(l.begin(),l.end());
if(*maxit>=Q){
size_t midx=distance(l.begin(),maxit);
printf("%lu\n",midx);
}
else{
printf("0\n");
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:11: error: 'class std::vector<int>' has no member named 'fill'
13 | l.fill(l.begin(),l.end(),0)
| ^~~~
a.cc:14:24: error: expected ';' before ')' token
14 | for(i=0;i<N;i++){
| ^
| ;
|
s098124924 | p00705 | C++ | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> l(101,0);
int main(){
int i,j,N,Q,M,d;
while(1){
scanf("%d %d",&N,&Q);
if(!N && !Q){break;}
fill(l.begin(),l.end(),0)
for(i=0;i<N;i++){
scanf("%d",&M);
for(j=0;j<M;j++){
scanf("%d",&d);
l[d]++;
}
}
auto maxit=max_element(l.begin(),l.end());
if(*maxit>=Q){
size_t midx=distance(l.begin(),maxit);
printf("%lu\n",midx);
}
else{
printf("0\n");
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:34: error: expected ';' before 'for'
13 | fill(l.begin(),l.end(),0)
| ^
| ;
14 | for(i=0;i<N;i++){
| ~~~
a.cc:14:24: error: expected ';' before ')' token
14 | for(i=0;i<N;i++){
| ^
| ;
|
s373279298 | p00705 | C++ | include <iostream>
#include <vector>
using namespace std;
int main() {
int N, Q;
while (cin >> N >> Q, N && Q) {
int avail[100] = {};
for (int i = 0; i < N; i++) {
int M; cin >> M;
for (int j = 0; j < M; j++) {
int tmp; cin >> tmp;
avail[tmp-1] += 1;
}
}
int max = 0;
int idx = -1;
for (int i = 0; i < 100; i++) {
if (avail[i] >= Q && max < avail[i]) {
idx = i;
max = avail[i];
}
}
cout << (idx == -1 ? 0 : idx+1) << 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/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| |
s499484836 | p00705 | C++ | #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
using namespace std;
/*int main(){
int n,q;
while(1){
pair<int,int> data[101]={};
rep(i,0,101){
data[i].second=-i;
}
cin>>n>>q;
if(n==0 && q==0) break;
rep(i,0,n){
int m,d;
cin>>m;
rep(j,0,m){
cin>>d;
data[d].first++;
}
}
sort(data,data+101);
reverse(data,data+101);
if(data[0].first<q) cout<<0<<endl;
else cout<<-data[0].second<<endl;
}
}*/
int main(){
int n,q;
while(1){
cin>>n>>q;
if(n==0 && q==0) break;
map<int,int> dat;
rep(i,0,n){
int m,d;
cin>>m;
rep(j,0,m){
cin>>d;
dat[d]++;
}
}
for(map<int,int>::iterator it=dat.begin();it!=dat.end();it++)
if(it->second>Max){
max=it->second;
ans=it->first;
}
}
if(max<q) cout<<0<<endl;
else cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:46:39: error: 'Max' was not declared in this scope
46 | if(it->second>Max){
| ^~~
a.cc:47:41: error: overloaded function with no contextual type information
47 | max=it->second;
| ^~~~~~
a.cc:48:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
48 | ans=it->first;
| ^~~
| abs
a.cc:51:20: error: parse error in template argument list
51 | if(max<q) cout<<0<<endl;
| ^~~~~
a.cc:51:25: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
51 | if(max<q) cout<<0<<endl;
| ^
a.cc:52:28: error: 'ans' was not declared in this scope; did you mean 'abs'?
52 | else cout<<ans<<endl;
| ^~~
| abs
a.cc: At global scope:
a.cc:54:1: error: expected declaration before '}' token
54 | }
| ^
|
s508291869 | p00705 | C++ | #include<iostream>
using namespace std;
int main(){
int N,Q,M,a;
while(cin>>N>>Q){
if(N==0&&Q==0)break;
int max=0;
int b[51][101]={},c,d=100;
for(int i=0;i<N;i++){
cin>>M;
if(max<M)max=M;
for(int j=0;j<M;j++){
cin>>a;
b[i][j]=a;
}
}
for(int i=0;i<N;i++)
for(int j=0;b[i][j]!=0;j++)
int count=0;
for(int l=0;l<N;l++)
for(int k=0;b[l][k]!=0;k++)
if(b[i][j]==b[l][k]){
count1++;
if(Q<=count){
c=b[i][j];
if(d>c)d=c;
}
}
if(Q>count)cout<<0<<endl;
else cout<<d<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:18: error: 'i' was not declared in this scope
26 | if(b[i][j]==b[l][k]){
| ^
a.cc:26:21: error: 'j' was not declared in this scope
26 | if(b[i][j]==b[l][k]){
| ^
a.cc:27:15: error: 'count1' was not declared in this scope
27 | count1++;
| ^~~~~~
a.cc:28:21: error: 'count' was not declared in this scope
28 | if(Q<=count){
| ^~~~~
a.cc:34:10: error: 'count' was not declared in this scope
34 | if(Q>count)cout<<0<<endl;
| ^~~~~
|
s482576551 | p00705 | C++ | #include<iostream>
using namespace std;
int main(){
int N,Q,M,a;
while(cin>>N>>Q){
if(N==0&&Q==0)break;
int max=0;
int b[51][101]={},c,d=100;
for(int i=0;i<N;i++){
cin>>M;
if(max<M)max=M;
for(int j=0;j<M;j++){
cin>>a;
b[i][j]=a;
}
}
for(int i=0;i<N;i++)
for(int j=0;b[i][j]!=0;j++)
int count=0;
for(int l=0;l<N;l++)
for(int k=0;b[l][k]!=0;k++)
if(b[i][j]==b[l][k]){
count++;
if(Q<=count){
c=b[i][j];
if(d>c)d=c;
}
}
if(Q>count)cout<<0<<endl;
else cout<<d<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:18: error: 'i' was not declared in this scope
26 | if(b[i][j]==b[l][k]){
| ^
a.cc:26:21: error: 'j' was not declared in this scope
26 | if(b[i][j]==b[l][k]){
| ^
a.cc:27:15: error: 'count' was not declared in this scope
27 | count++;
| ^~~~~
a.cc:34:10: error: 'count' was not declared in this scope
34 | if(Q>count)cout<<0<<endl;
| ^~~~~
|
s344009208 | p00705 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#define rep(i,a,b) for(int i=(a);i<b;i++)
#define INF 1000000000
using namespace std;
bool debug=false;
int main(){
int n,q;
while(1){
cin>>n>>q;
if(n==0&&q==0)break;
map<int,int>mp;
for(int i=0;i<n;i++){
int x;
cin>>x;
if(x==0)for(int i=0;i<52;i++)mp[i]++;
for(int j=0;j<x;j++){
int a;
cin>>a;
mp[a]++;
}
}
for(int i=0;i<52;i++){
//cout<<i<<":"<<mp[i]<<endl;
if(mp[i]==n){
cout<<i<<endl;
break;
}else if(i==51){
cout<<0<<endl;
}
}
}
return | a.cc: In function 'int main()':
a.cc:46:9: error: expected primary-expression at end of input
46 | return
| ^
a.cc:46:9: error: expected ';' at end of input
46 | return
| ^
| ;
a.cc:46:9: error: expected '}' at end of input
a.cc:15:11: note: to match this '{'
15 | int main(){
| ^
|
s133131202 | p00705 | C++ | /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
| |
s115467459 | p00705 | C++ | /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
| |
s126913332 | p00705 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n, q,b,c,d,e;
int a[1001] = { };
while(1){
cin >> n >> q;
if(n==0 && q==0)break;
for(int i=0;i<1001;i++){
a[i] = 0;
}
for(int j=0;j<n;j++){
cin >> c;
for(int i=0;i<c;i++){
cin >> d;
a[d]++;
}
}
e=-1;
for(int i=1;i<1001;i++){
if(a[i] > e) e = i;
}
if (a[e] >= b) cout << e << endl;
else cout << 0 << endl;
}
}
}
| a.cc:46:1: error: expected declaration before '}' token
46 | }
| ^
|
s274188788 | p00705 | C++ | #include <stdio.h>
int main(){
int N, Q;
int M, data;
int i,j;
int maxMember,maxMemberdata;
while(1){
//int canAttend[100]={0,};
scanf("%d%d",&N,&Q);if(N==0&&Q==0) break;
maxMember=Q-1;
maxMemberdata=0;
for(j=0;j<100;j++) canAttend[j]=0;
for(i=0;i<N;i++){
scanf("%d", &M);
for(j=0;j<M;j++){
scanf("%d", &data);
canAttend[data]=canAttend[data]+1;
}
}
for(i=0;i<100;i++){
if(canAttend[i]>maxMember){
maxMember=canAttend[i];
maxMemberdata=i;
}
}
printf("%d\n",maxMemberdata);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:36: error: 'canAttend' was not declared in this scope
13 | for(j=0;j<100;j++) canAttend[j]=0;
| ^~~~~~~~~
a.cc:18:33: error: 'canAttend' was not declared in this scope
18 | canAttend[data]=canAttend[data]+1;
| ^~~~~~~~~
a.cc:22:28: error: 'canAttend' was not declared in this scope
22 | if(canAttend[i]>maxMember){
| ^~~~~~~~~
|
s106857540 | p00706 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigDecimal;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static final int INF=Integer.MAX_VALUE;
static final long LINF=Long.MAX_VALUE;
static void solve(){
while(true){
int n=ir.nextInt();
if(n==0) return;
int w=ir.nextInt();
int h=ir.nextInt();
int[][] map=new [w][h];
for(int i=0;i<n;i++){
int x=ir.nextInt()-1;
int y=ir.nextInt()-1;
map[x][y]++;
}
int s=ir.nextInt();
int t=ir.nextInt();
int[][] sum=new int[w+1][h+1];
for(int i=0;i<w;i++){
for(int j=0;j<h;j++){
sum[i+1][j+1]=map[i][j]+sum[i+1][j]+sum[i][j+1]-sum[i][j];
}
}
int ans=0;
for(int i=s;i<=w;i++){
for(int j=t;j<=h;j++){
ans=Math.max(ans,sum[i][j]-sum[i-s][j]-sum[i][j-t]+sum[i-s][j-t]);
}
}
out.println(ans);
}
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public BigInteger nextBigInteger(){return new BigInteger(next());}
public BigDecimal nextBigDecimal(){return new BigDecimal(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:25: error: <identifier> expected
int[][] map=new [w][h];
^
1 error
|
s490294472 | p00706 | C | #include <stdio.h>
int main() {
int n,w,h,s,t;
int board[100][100];
int i,j;
int x,y;
int max,cnt;
while(scanf("%d",&n),n){
scanf("%d%d",&w,&h);
for(i = 0;i < n;i++){
scanf("%d%d",&x,&y);
f[y][x] = 1;
}
scanf("%d%d",&s,&t);
for(max = 0,y = 1; y <= h; y++){
for(x = 1; x <= w; x++){
for(cnt = 0,i = 0; i < t; i++){
if(y + i > h)break;
for(j = 0; j < s; j++){
if(x + j > w)break;
cnt += f[y + i][x + j];
if(cnt > max)max = cnt;
}
}
}
}
printf("%d\n",max);
}
return 0;
} | main.c: In function 'main':
main.c:15:7: error: 'f' undeclared (first use in this function)
15 | f[y][x] = 1;
| ^
main.c:15:7: note: each undeclared identifier is reported only once for each function it appears in
|
s374183228 | p00706 | C | #include <stdio.h>
int main() {
int n,w,h,s,t;
int board[100][100];
int i,j;
int x,y;
int max,cnt;
while(scanf("%d",&n),n){
scanf("%d%d",&w,&h);
for(i = 0;i < n;i++){
scanf("%d%d",&x,&y);
f[y][x] = 1;
}
scanf("%d%d",&s,&t);
for(max = 0,y = 1; y <= h; y++){
for(x = 1; x <= w; x++){
for(cnt = 0,i = 0; i < t; i++){
if(y + i > h)break;
for(j = 0; j < s; j++){
if(x + j > w)break;
cnt += board[y + i][x + j];
if(cnt > max)max = cnt;
}
}
}
}
printf("%d\n",max);
}
return 0;
} | main.c: In function 'main':
main.c:15:7: error: 'f' undeclared (first use in this function)
15 | f[y][x] = 1;
| ^
main.c:15:7: note: each undeclared identifier is reported only once for each function it appears in
|
s819704083 | p00706 | C | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n)-1;i>=(m);--i)
#define repc(i,n) for(int i=0;i<=(n);++i)
#define repcn(i,m,n) for(int i=(m);i<=(n);++i)
#define repcd(i,n) for(int i=(n);i>=0;--i)
#define repcnd(i,m,n) for(int i=(n);i>=(m);--i)
#define repc0(i,n) for(i=0;i<=(n);++i)
#define repcn0(i,m,n) for(i=(m);i<=(n);++i)
#define repcd0(i,n) for(i=(n);i>=0;--i)
#define repcnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define p_queue(n) priority_queue<n,vector<n>,greater<n> >
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;
const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[]={1,-1,0,0,1,1,-1,-1,0};
const int dy[]={0,0,1,-1,1,-1,1,-1,0};
int dp[111][111];
int tree[111][111];
int main() {
int n, w, h, s, t, x, y;
IL {
cin >> n;
if (n == 0) break;
memset(dp, 0, sizeof(dp));
memset(tree, 0, sizeof(tree));
cin >> w >> h;
rep (i, n) {
cin >> x >> y;
tree[y][x] = 1;
}
cin >> s >> t;
repcn (i, 1, h) repcn (j, 1, w) {
dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1] + tree[i][j];
}
int res = 0;
rep (i, h - t + 1) rep (j, w - s + 1) {
chmax(res, dp[i + t][j + s] - dp[i][j + s] - dp[i + t][j] + dp[i][j]);
}
cout << res << endl;
}
return 0;
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s650411437 | p00706 | C | #include <stdio.h>
#define MAX(a,b) ((a) > (b) ? (a) : (b));
int countTree(int a,int b,int c,int d,int e[][]);
int main(){
int N;
int i,j;
while(1){
int maxNumber=0;
scanf("%d",&N); if(N==0) break;
scanf("%d%d",&W,&H);
int map[H][W]={};
for(i=0;i<N;i++){
scanf("%d%d",&x,&y);
map[x][y]=1;
}
scanf("%d%d",&S,&T);
for(i=0;i<H-T+1;i++){
for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
}
printf("%d\n",maxNumber);
}
}
int countTree(int a,int b,int c,int d,int e[][]){
int k,l;
int countSum=0;
for(k=0;k<i+T;i++){
for(l=0;l<l+S;l++){
if(e[k][l]==1) countSum++;
}
}
return countSum;
} | main.c:4:43: error: array type has incomplete element type 'int[]'
4 | int countTree(int a,int b,int c,int d,int e[][]);
| ^
main.c:4:43: note: declaration of 'e' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'main':
main.c:12:31: error: 'W' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:12:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:34: error: 'H' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:15:39: error: 'x' undeclared (first use in this function)
15 | scanf("%d%d",&x,&y);
| ^
main.c:15:42: error: 'y' undeclared (first use in this function)
15 | scanf("%d%d",&x,&y);
| ^
main.c:18:31: error: 'S' undeclared (first use in this function)
18 | scanf("%d%d",&S,&T);
| ^
main.c:18:34: error: 'T' undeclared (first use in this function)
18 | scanf("%d%d",&S,&T);
| ^
main.c:20:88: error: type of formal parameter 5 is incomplete
20 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
| ^~~
main.c:2:26: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c:20:88: error: type of formal parameter 5 is incomplete
20 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
| ^~~
main.c:2:38: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c: At top level:
main.c:26:43: error: array type has incomplete element type 'int[]'
26 | int countTree(int a,int b,int c,int d,int e[][]){
| ^
main.c:26:43: note: declaration of 'e' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'countTree':
main.c:29:19: error: 'i' undeclared (first use in this function)
29 | for(k=0;k<i+T;i++){
| ^
main.c:29:21: error: 'T' undeclared (first use in this function)
29 | for(k=0;k<i+T;i++){
| ^
main.c:30:29: error: 'S' undeclared (first use in this function)
30 | for(l=0;l<l+S;l++){
| ^
|
s684506412 | p00706 | C | #include <stdio.h>
#define MAX(a,b) ((a) > (b) ? (a) : (b));
int countTree(int a,int b,int c,int d,int e[][]);
int main(){
int N;
int i,j;
while(1){
int maxNumber=0;
scanf("%d",&N); if(N==0) break;
scanf("%d%d",&W,&H);
int map[H][W]={};
for(i=0;i<N;i++){
scanf("%d%d",&x,&y);
map[x][y]=1;
}
scanf("%d%d",&S,&T);
for(i=0;i<H-T+1;i++){
for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
}
printf("%d\n",maxNumber);
}
}
int countTree(int a,int b,int c,int d,int e[][]){
int k,l;
int countSum=0;
for(k=0;k<a+c;i++){
for(l=0;l<b+d;l++){
if(e[k][l]==1) countSum++;
}
}
return countSum;
} | main.c:4:43: error: array type has incomplete element type 'int[]'
4 | int countTree(int a,int b,int c,int d,int e[][]);
| ^
main.c:4:43: note: declaration of 'e' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'main':
main.c:12:31: error: 'W' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:12:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:34: error: 'H' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:15:39: error: 'x' undeclared (first use in this function)
15 | scanf("%d%d",&x,&y);
| ^
main.c:15:42: error: 'y' undeclared (first use in this function)
15 | scanf("%d%d",&x,&y);
| ^
main.c:18:31: error: 'S' undeclared (first use in this function)
18 | scanf("%d%d",&S,&T);
| ^
main.c:18:34: error: 'T' undeclared (first use in this function)
18 | scanf("%d%d",&S,&T);
| ^
main.c:20:88: error: type of formal parameter 5 is incomplete
20 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
| ^~~
main.c:2:26: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c:20:88: error: type of formal parameter 5 is incomplete
20 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
| ^~~
main.c:2:38: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c: At top level:
main.c:26:43: error: array type has incomplete element type 'int[]'
26 | int countTree(int a,int b,int c,int d,int e[][]){
| ^
main.c:26:43: note: declaration of 'e' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'countTree':
main.c:29:23: error: 'i' undeclared (first use in this function)
29 | for(k=0;k<a+c;i++){
| ^
|
s961241006 | p00706 | C | #include <stdio.h>
#define MAX(a,b) ((a) > (b) ? (a) : (b));
int countTree(int a,int b,int c,int d,int e[][]);
int main(){
int N;
int i,j;
while(1){
int maxNumber=0;
scanf("%d",&N); if(N==0) break;
scanf("%d%d",&W,&H);
int map[H][W]={};
int x,y;
for(i=0;i<N;i++){
scanf("%d%d",&x,&y);
map[x][y]=1;
}
scanf("%d%d",&S,&T);
for(i=0;i<H-T+1;i++){
for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
}
printf("%d\n",maxNumber);
}
}
int countTree(int a,int b,int c,int d,int e[][]){
int k,l;
int countSum=0;
for(k=0;k<a+c;i++){
for(l=0;l<b+d;l++){
if(e[k][l]==1) countSum++;
}
}
return countSum;
} | main.c:4:43: error: array type has incomplete element type 'int[]'
4 | int countTree(int a,int b,int c,int d,int e[][]);
| ^
main.c:4:43: note: declaration of 'e' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'main':
main.c:12:31: error: 'W' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:12:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:34: error: 'H' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:19:31: error: 'S' undeclared (first use in this function)
19 | scanf("%d%d",&S,&T);
| ^
main.c:19:34: error: 'T' undeclared (first use in this function)
19 | scanf("%d%d",&S,&T);
| ^
main.c:21:88: error: type of formal parameter 5 is incomplete
21 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
| ^~~
main.c:2:26: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c:21:88: error: type of formal parameter 5 is incomplete
21 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
| ^~~
main.c:2:38: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c: At top level:
main.c:27:43: error: array type has incomplete element type 'int[]'
27 | int countTree(int a,int b,int c,int d,int e[][]){
| ^
main.c:27:43: note: declaration of 'e' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'countTree':
main.c:30:23: error: 'i' undeclared (first use in this function)
30 | for(k=0;k<a+c;i++){
| ^
|
s873096279 | p00706 | C | #include <stdio.h>
#define MAX(a,b) ((a) > (b) ? (a) : (b));
int countTree(int a,int b,int c,int d,int e[][]);
int main(){
int N;
int i,j;
while(1){
int maxNumber=0;
scanf("%d",&N); if(N==0) break;
scanf("%d%d",&W,&H);
int map[H][W]={};
int x,y;
for(i=0;i<N;i++){
scanf("%d%d",&x,&y);
map[x][y]=1;
}
scanf("%d%d",&S,&T);
for(i=0;i<H-T+1;i++){
for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
}
printf("%d\n",maxNumber);
}
}
int countTree(int a,int b,int c,int d,int e[][]){
int k,l;
int countSum=0;
for(k=a;k<a+c;k++){
for(l=b;l<b+d;l++){
if(e[k][l]==1) countSum++;
}
}
return countSum;
} | main.c:4:43: error: array type has incomplete element type 'int[]'
4 | int countTree(int a,int b,int c,int d,int e[][]);
| ^
main.c:4:43: note: declaration of 'e' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'main':
main.c:12:31: error: 'W' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:12:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:34: error: 'H' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:19:31: error: 'S' undeclared (first use in this function)
19 | scanf("%d%d",&S,&T);
| ^
main.c:19:34: error: 'T' undeclared (first use in this function)
19 | scanf("%d%d",&S,&T);
| ^
main.c:21:88: error: type of formal parameter 5 is incomplete
21 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
| ^~~
main.c:2:26: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c:21:88: error: type of formal parameter 5 is incomplete
21 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,S,T,map));
| ^~~
main.c:2:38: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c: At top level:
main.c:27:43: error: array type has incomplete element type 'int[]'
27 | int countTree(int a,int b,int c,int d,int e[][]){
| ^
main.c:27:43: note: declaration of 'e' as multidimensional array must have bounds for all dimensions except the first
|
s984573582 | p00706 | C | #include <stdio.h>
#define MAX(a,b) ((a) > (b) ? (a) : (b));
int countTree(int a1,int b1,int c1,int d1,int e1[][]);
int main(){
int N;
int i,j;
while(1){
int maxNumber=0;
scanf("%d",&N); if(N==0) break;
scanf("%d%d",&W,&H);
int map[H][W]={};
int x,y;
for(i=0;i<N;i++){
scanf("%d%d",&x,&y);
map[y][x]=1;
}
scanf("%d%d",&S,&T);
for(i=0;i<H-T+1;i++){
for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,T,S,map));
}
printf("%d\n",maxNumber);
}
}
int countTree(int a1,int b1,int c1,int d1,int e1[][]){
int k,l;
int countSum=0;
for(k=a1;k<a1+c1;k++){
for(l=b1;l<b1+d1;l++){
if(e1[k][l]==1) countSum++;
}
}
return countSum;
} | main.c:4:47: error: array type has incomplete element type 'int[]'
4 | int countTree(int a1,int b1,int c1,int d1,int e1[][]);
| ^~
main.c:4:47: note: declaration of 'e1' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'main':
main.c:12:31: error: 'W' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:12:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:34: error: 'H' undeclared (first use in this function)
12 | scanf("%d%d",&W,&H);
| ^
main.c:19:31: error: 'S' undeclared (first use in this function)
19 | scanf("%d%d",&S,&T);
| ^
main.c:19:34: error: 'T' undeclared (first use in this function)
19 | scanf("%d%d",&S,&T);
| ^
main.c:21:88: error: type of formal parameter 5 is incomplete
21 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,T,S,map));
| ^~~
main.c:2:26: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c:21:88: error: type of formal parameter 5 is incomplete
21 | for(j=0;j<W-S+1;j++) maxNumber=MAX(maxNumber,countTree(i,j,T,S,map));
| ^~~
main.c:2:38: note: in definition of macro 'MAX'
2 | #define MAX(a,b) ((a) > (b) ? (a) : (b));
| ^
main.c: At top level:
main.c:27:47: error: array type has incomplete element type 'int[]'
27 | int countTree(int a1,int b1,int c1,int d1,int e1[][]){
| ^~
main.c:27:47: note: declaration of 'e1' as multidimensional array must have bounds for all dimensions except the first
|
s911554183 | p00706 | C++ | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
int main()
{
int i,j,k,l;
int n;
int w,h;
int ww,hh;
int ans,sum;
int a[100][100];
while(1)
{
scanf("%d",&n);
if(n==0){break;}
else
{
ans=0;
for(i=0;i<100;i++){for(j=0;j<100;j++){a[i][j]=0}}
for(i=0;i<n;i++)
{
int x,y;
scanf("%d %d",&x,&y);
a[x-1][y-1]=1;
}
scanf("%d %d",&ww,&hh);
for(i=0;i<(w-ww);i++)
{
for(j=0;j<(h-hh);j++)
{
sum=0;
for(k=i;k<(i+ww);k++)
{
for(l=j;l<(j+hh);l++)
{
sum+=a[k][l];
}
}
if(ans<sum){ans=sum;}
}
}
}
printf("%d\n",ans);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:72: error: expected ';' before '}' token
24 | for(i=0;i<100;i++){for(j=0;j<100;j++){a[i][j]=0}}
| ^
| ;
|
s383186427 | p00706 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
while(cin >> n, n) {
int w, h; cin >> w >> h;
bool field[110][110];
memset(field, false, sizeof(field));
for(int i = 0; i < n; i++) {
int x, y; cin >> x >> y;
field[y][x] = true;
}
int s, t; cin >> s >> t;
int ans = 0;
for(int i = 1; i < h-t+10; i++) {
for(int j = 1; j < w-s+10; j++) {
int sum = 0;
for(int k = 0; k < t; k++) {
for(int l = 0; l < s; l++) {
if(field[i+k][j+l]) sum++;
}
}
if(sum > ans) ans = sum;
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
10 | memset(field, false, sizeof(field));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s587451622 | p00706 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
while(cin >> n, n) {
int w, h; cin >> w >> h;
bool field[110][110];
memset(field, false, sizeof(field));
for(int i = 0; i < n; i++) {
int x, y; cin >> x >> y;
field[y][x] = true;
}
int s, t; cin >> s >> t;
int ans = 0;
for(int i = 1; i < h-t+10; i++) {
for(int j = 1; j < w-s+10; j++) {
int sum = 0;
for(int k = 0; k < t; k++) {
for(int l = 0; l < s; l++) {
if(field[i+k][j+l]) sum++;
}
}
if(sum > ans) ans = sum;
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
10 | memset(field, false, sizeof(field));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s248409140 | p00706 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
while(cin >> n, n) {
int w, h; cin >> w >> h;
bool field[110][110];
memset(field, false, sizeof(field));
for(int i = 0; i < n; i++) {
int x, y; cin >> x >> y;
field[y][x] = true;
}
int s, t; cin >> s >> t;
int ans = 0;
for(int i = 1; i < h-t+10; i++) {
for(int j = 1; j < w-s+10; j++) {
int sum = 0;
for(int k = 0; k < t; k++) {
for(int l = 0; l < s; l++) {
if(field[i+k][j+l]) sum++;
}
}
if(sum > ans) ans = sum;
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
10 | memset(field, false, sizeof(field));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s028172714 | p00706 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int d[101][101]={},s,t;
typedef pair<int,int> P;
vector<P> V;
int f(int x,int y){
int cnt=0;
for(int i=0;i<t;i++){
for(int j=0;j<s;j++){
if(y+j<=w && x+i<=h){s
if(d[y+j][x+i]){
cnt++;
}
}
}
}
return cnt;
}
int main(){
int n;
while(cin>>n,n){
int ans=0,w,h,x,y;
cin>>w>>h;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
d[i][j]=0;
}
}
for(int i=0;i<n;i++){
cin>>x>>y;
d[x][y]=1;
V.push_back(P(x,y));
}
cin>>s>>t;
for(int i=0;i<V.size();i++){
ans=max(ans,f(V[i].second,V[i].first));
}
cout<<ans<<endl;;
}
return 0;
} | a.cc: In function 'int f(int, int)':
a.cc:13:33: error: 'w' was not declared in this scope
13 | if(y+j<=w && x+i<=h){s
| ^
a.cc:13:43: error: 'h' was not declared in this scope
13 | if(y+j<=w && x+i<=h){s
| ^
a.cc:13:47: error: expected ';' before 'if'
13 | if(y+j<=w && x+i<=h){s
| ^
| ;
14 | if(d[y+j][x+i]){
| ~~
|
s315761342 | p00706 | C++ | #include "stdafx.h"
#include <iostream>
using namespace std;
int main(void){
int N;
int W, H;
bool pos[101][101];//pos[x][y];
int x, y;
int i, j,k,l;
int S, T;
int max, temp;
cin >> N;
while(N != 0)
{
cin >> W >> H;
while (N--){
cin >> x >> y;
pos[x][y] = true;
}
/* for (i = 1; i <= H; i++){
for (j = 1; j <= W; j++){
if (pos[j][i] == true) printf("@");
else printf("-");
}
putchar('\n');
}
*/
cin >> S >> T;
max = 0;
for (i = 1; i <= H - T; i++){
for (j = 1; j <= W - S; j++){
temp = 0;
for (k = 0; k < T; k++){
for (l = 0; l < S; l++){
if (pos[j+l][i+k] == true) temp++;
}
}
if (temp > max) max = temp;
}
}
cout << max << endl;
cin >> N;
}
return(0);
} | a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s113823865 | p00706 | C++ | #include<bits/stdc++.h>
int h,w,k,l,m,a,b,s,t,u,v,i,j,x[999][999];main(){while(1){memset(x,0,1<<21);v=0;std::cin>>k;if(!k){break;}std::cin>>w>>h;for(i=0;i<k;i++){cin>>a>>b;x[a][b]=1;}cin>>s>>t;for(i=1;i<=w;i++){for(j=1;j<=h;j++){u=0;for(l=0;l<s;l++){for(m=0;m<t;m++){if(x[i+l][j+m]){u++;}}}v=v>u?v:u;}}printf("%d\n",v);}} | a.cc:2:43: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | int h,w,k,l,m,a,b,s,t,u,v,i,j,x[999][999];main(){while(1){memset(x,0,1<<21);v=0;std::cin>>k;if(!k){break;}std::cin>>w>>h;for(i=0;i<k;i++){cin>>a>>b;x[a][b]=1;}cin>>s>>t;for(i=1;i<=w;i++){for(j=1;j<=h;j++){u=0;for(l=0;l<s;l++){for(m=0;m<t;m++){if(x[i+l][j+m]){u++;}}}v=v>u?v:u;}}printf("%d\n",v);}}
| ^~~~
a.cc: In function 'int main()':
a.cc:2:139: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
2 | int h,w,k,l,m,a,b,s,t,u,v,i,j,x[999][999];main(){while(1){memset(x,0,1<<21);v=0;std::cin>>k;if(!k){break;}std::cin>>w>>h;for(i=0;i<k;i++){cin>>a>>b;x[a][b]=1;}cin>>s>>t;for(i=1;i<=w;i++){for(j=1;j<=h;j++){u=0;for(l=0;l<s;l++){for(m=0;m<t;m++){if(x[i+l][j+m]){u++;}}}v=v>u?v:u;}}printf("%d\n",v);}}
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
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:2:160: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
2 | int h,w,k,l,m,a,b,s,t,u,v,i,j,x[999][999];main(){while(1){memset(x,0,1<<21);v=0;std::cin>>k;if(!k){break;}std::cin>>w>>h;for(i=0;i<k;i++){cin>>a>>b;x[a][b]=1;}cin>>s>>t;for(i=1;i<=w;i++){for(j=1;j<=h;j++){u=0;for(l=0;l<s;l++){for(m=0;m<t;m++){if(x[i+l][j+m]){u++;}}}v=v>u?v:u;}}printf("%d\n",v);}}
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s266092575 | p00706 | C++ | #include<bits/stdc++.h>
int h,w,k,l,m,a,b,s,t,u,v,i,j,x[999][999];main(){while(1){memset(x,0,1<<21);v=0;std::cin>>k;if(!k){break;}std::cin>>w>>h;for(i=0;i<k;i++){cin>>a>>b;x[a][b]=1;}std::cin>>s>>t;for(i=1;i<=w;i++){for(j=1;j<=h;j++){u=0;for(l=0;l<s;l++){for(m=0;m<t;m++){if(x[i+l][j+m]){u++;}}}v=v>u?v:u;}}printf("%d\n",v);}} | a.cc:2:43: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | int h,w,k,l,m,a,b,s,t,u,v,i,j,x[999][999];main(){while(1){memset(x,0,1<<21);v=0;std::cin>>k;if(!k){break;}std::cin>>w>>h;for(i=0;i<k;i++){cin>>a>>b;x[a][b]=1;}std::cin>>s>>t;for(i=1;i<=w;i++){for(j=1;j<=h;j++){u=0;for(l=0;l<s;l++){for(m=0;m<t;m++){if(x[i+l][j+m]){u++;}}}v=v>u?v:u;}}printf("%d\n",v);}}
| ^~~~
a.cc: In function 'int main()':
a.cc:2:139: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
2 | int h,w,k,l,m,a,b,s,t,u,v,i,j,x[999][999];main(){while(1){memset(x,0,1<<21);v=0;std::cin>>k;if(!k){break;}std::cin>>w>>h;for(i=0;i<k;i++){cin>>a>>b;x[a][b]=1;}std::cin>>s>>t;for(i=1;i<=w;i++){for(j=1;j<=h;j++){u=0;for(l=0;l<s;l++){for(m=0;m<t;m++){if(x[i+l][j+m]){u++;}}}v=v>u?v:u;}}printf("%d\n",v);}}
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s715656110 | p00706 | C++ | #include <iostream>
using namespace std;
int main() {
int n, w, h, s, t;
int f[100][100]; // field
while (cin >> n, n) {
cin >> w >> h;
memset(f, 0, sizeof(f));
int x, y;
for (int i=0; i<n; i++) {
cin >> x >> y;
f[y][x] = 1;
}
cin >> s >> t;
int max = 0;
for (int y=1; y<=h; y++) {
for (int x=1; x<=w; x++) {
int cnt = 0;
for (int y2=0; y2<t; y2++) {
if (y+y2 > h) { break; }
for (int x2=0; x2<s; x2++) {
if (x+x2 > w) { break; }
cnt += f[y+y2][x+x2];
if (cnt > max) { max = cnt; }
}
}
}
}
cout << max << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:5: error: 'memset' was not declared in this scope
12 | memset(f, 0, sizeof(f));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 |
|
s939048504 | p00706 | C++ | #include <iostream>
using namespace std;
int N, W, H, X, Y, S, T, r[100][100];
int main()
{
while (true)
{
scanf("%d", &N);
if (N == 0) break;
memset(r, 0, sizeof(r));
scanf("%d", &W);
scanf("%d", &H);
for (int i = 0; i < N; i++)
{
scanf("%d", &X);
scanf("%d", &Y);
r[Y - 1][X - 1] = 1;
}
scanf("%d", &S);
scanf("%d", &T);
int ret = 0;
for (int i = 0; i < H - T; i++)
{
for (int j = 0; j < W - S; j++)
{
int res = 0;
for (int k = i; k < i + T; k++)
{
for (int l = j; l < j + S; l++)
{
res += r[k][l];
}
}
ret = ret > res ? ret : res;
}
}
printf("%d\n", ret);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
15 | memset(r, 0, sizeof(r));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 |
|
s184899542 | p00706 | C++ |
int main(){
int n;
while(1){
cin>>n;
if(n==0)break;
int w,h;
cin>>w>>h;
int d[101][101];
for(int i=0;i<101;i++)for(int j=0;j<101;j++)d[i][j]=0;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
d[y][x]=1;
}
if(debug){
for(int i=0;i<=h;i++){
for(int j=0;j<=w;j++){
cout<<d[i][j]<<" ";
}
cout<<endl;
}
}
int maxi=0;
int s,t;
cin>>s>>t;
for(int i=0;i<=h-t+1;i++){
for(int j=0;j<=w-s+1;j++){
int cnt=0;
for(int k=0;k<t;k++){
for(int l=0;l<s;l++){
if(d[k+i][l+j]==1)cnt++;
}
}
maxi=max(maxi,cnt);
}
}
cout<<maxi<<endl;
}
return 0;
}
int main(){
int n;
while(1){
cin>>n;
if(n==0)break;
int w,h;
cin>>w>>h;
int d[101][101];
for(int i=0;i<101;i++)for(int j=0;j<101;j++)d[i][j]=0;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
d[y][x]=1;
}
if(debug){
for(int i=0;i<=h;i++){
for(int j=0;j<=w;j++){
cout<<d[i][j]<<" ";
}
cout<<endl;
}
}
int maxi=0;
int s,t;
cin>>s>>t;
for(int i=0;i<=h-t+1;i++){
for(int j=0;j<=w-s+1;j++){
int cnt=0;
for(int k=0;k<t;k++){
for(int l=0;l<s;l++){
if(d[k+i][l+j]==1)cnt++;
}
}
maxi=max(maxi,cnt);
}
}
cout<<maxi<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
5 | cin>>n;
| ^~~
a.cc:18:8: error: 'debug' was not declared in this scope
18 | if(debug){
| ^~~~~
a.cc:21:11: error: 'cout' was not declared in this scope
21 | cout<<d[i][j]<<" ";
| ^~~~
a.cc:23:9: error: 'cout' was not declared in this scope
23 | cout<<endl;
| ^~~~
a.cc:23:15: error: 'endl' was not declared in this scope
23 | cout<<endl;
| ^~~~
a.cc:38:14: error: 'max' was not declared in this scope; did you mean 'maxi'?
38 | maxi=max(maxi,cnt);
| ^~~
| maxi
a.cc:41:5: error: 'cout' was not declared in this scope
41 | cout<<maxi<<endl;
| ^~~~
a.cc:41:17: error: 'endl' was not declared in this scope
41 | cout<<maxi<<endl;
| ^~~~
a.cc: At global scope:
a.cc:45:5: error: redefinition of 'int main()'
45 | int main(){
| ^~~~
a.cc:2:5: note: 'int main()' previously defined here
2 | int main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:48:5: error: 'cin' was not declared in this scope
48 | cin>>n;
| ^~~
a.cc:61:8: error: 'debug' was not declared in this scope
61 | if(debug){
| ^~~~~
a.cc:64:11: error: 'cout' was not declared in this scope
64 | cout<<d[i][j]<<" ";
| ^~~~
a.cc:66:9: error: 'cout' was not declared in this scope
66 | cout<<endl;
| ^~~~
a.cc:66:15: error: 'endl' was not declared in this scope
66 | cout<<endl;
| ^~~~
a.cc:81:14: error: 'max' was not declared in this scope; did you mean 'maxi'?
81 | maxi=max(maxi,cnt);
| ^~~
| maxi
a.cc:84:5: error: 'cout' was not declared in this scope
84 | cout<<maxi<<endl;
| ^~~~
a.cc:84:17: error: 'endl' was not declared in this scope
84 | cout<<maxi<<endl;
| ^~~~
|
s477498922 | p00706 | C++ | #include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(void) {
while(true) {
int N, W, H;
cin>>N;
if(N == 0) break;
cin>>W>>H;
vector<vector<bool> > m(H, vector<bool>(W, false));
vector<vector<int> > wa(H + 1, vector<int>(W + 1, 0));
REP(i, N) {
int x, y;
cin>>x>>y;
--x;
--y;
m[y][x] = true;
}
REP(i, H) {
REP(j, W) {
wa[i + 1][j + 1] += wa[i + 1][j] + (int)m[i][j];
}
}
REP(i, H) {
REP(j, W) {
wa[i + 1][j + 1] += [i][j + 1];
}
}
int S, T;
cin>>S>>T;
int ans = 0;
REP(i, H - T + 1) {
REP(j, W - S + 1) {
ans = max(ans, wa[T + i][S + j] - wa[T + i][j] - wa[i][S + j] + wa[i][j]);
}
}
cout<<ans<<endl;
}
} | a.cc: In lambda function:
a.cc:45:56: error: expected '{' before '[' token
45 | wa[i + 1][j + 1] += [i][j + 1];
| ^
a.cc: In function 'int main()':
a.cc:45:56: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'll' {aka 'long long int'})
|
s916552263 | p00706 | C++ | #include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<functional>
using namespace std;
#define INF 1<<21
#define MOD 1000000007
int main() {
int N;
int W, H;
int a, b;
int S, T;
int table[105][105];
int maxx;
while (1) {
cin >> N;
if (N == 0) {
return 0;
}
cin >> W >> H;
memset(table, 0, sizeof(table));
maxx = 0;
for (int i = 0; i < N; i++) {
cin >> a >> b;
table[b][a] = 1;
}
cin >> S >> T;
for (int i = 1; i <= H - T + 1; i++) {
for (int j =1 ; j <= W - S + 1; j++) {
int cnt = 0;
for (int k = i; k < i + T; k++) {
for (int l = j; l < j + S; l++) {
if (table[k][l] == 1)cnt++;
}
}
maxx = max(cnt, maxx);
}
}
cout << maxx << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'memset' was not declared in this scope
26 | memset(table, 0, sizeof(table));
| ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include<functional>
+++ |+#include <cstring>
8 | using namespace std;
|
s469004856 | p00706 | C++ | #include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<functional>
using namespace std;
#define INF 1<<21
#define MOD 1000000007
int main() {
int N;
int W, H;
int a, b;
int S, T;
int table[105][105];
int maxx;
while (1) {
cin >> N;
if (N == 0) {
return 0;
}
cin >> W >> H;
memset(table, 0, sizeof(table));
maxx = 0;
for (int i = 0; i < N; i++) {
cin >> a >> b;
table[b][a] = 1;
}
cin >> S >> T;
for (int i = 1; i <= H - T + 1; i++) {
for (int j =1 ; j <= W - S + 1; j++) {
int cnt = 0;
for (int k = i; k < i + T; k++) {
for (int l = j; l < j + S; l++) {
if (table[k][l] == 1)cnt++;
}
}
maxx = max(cnt, maxx);
}
}
cout << maxx << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'memset' was not declared in this scope
26 | memset(table, 0, sizeof(table));
| ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include<functional>
+++ |+#include <cstring>
8 | using namespace std;
|
s799465201 | p00706 | C++ | #include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<functional>
using namespace std;
#define INF 1<<21
#define MOD 1000000007
int main() {
int N;
int W, H;
int a, b;
int S, T;
int table[105][105];
int maxx;
while (1) {
cin >> N;
if (N == 0) {
return 0;
}
cin >> W >> H;
memset(table, 0, sizeof(table));
maxx = 0;
for (int i = 0; i < N; i++) {
cin >> a >> b;
table[b][a] = 1;
}
cin >> S >> T;
for (int i = 1; i <= H - T + 1; i++) {
for (int j =1 ; j <= W - S + 1; j++) {
int cnt = 0;
for (int k = i; k < i + T; k++) {
for (int l = j; l < j + S; l++) {
if (table[k][l] == 1)cnt++;
}
}
maxx = max(cnt, maxx);
}
}
cout << maxx << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'memset' was not declared in this scope
26 | memset(table, 0, sizeof(table));
| ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include<functional>
+++ |+#include <cstring>
8 | using namespace std;
|
s395952690 | p00706 | C++ | #include<iostream>
using namespace std;
bool tree[1000][1000];
int s[1000][1000];
int main(){
int n, w, h;
int x, y, S, T;
while(cin >> n && n){
memset(s, 0, sizeof(s));
memset(tree, false, sizeof(tree));
cin >> w >> h;
for(int i = 0; i < n; i++){
cin >> x >> y;
tree[x][y] = true;
}
cin >> S >> T;
for(int i = 1; i <= w; i++){
for(int j = 1; j <= h; j++){
s[i][j] = s[i-1][j] + s[i][j-1] - s[i-1][j-1];
if(tree[i][j]) s[i][j]++;
}
}
int res = 0;
for(int i = 1; i <= w - S + 1; i++){
for(int j = 1; j <= h - T + 1; j++){
int num = s[i+S-1][j+T-1] - s[i][j+T-1] - s[j+S-1][j] + s[i][j];
res = max(num, res);
}
}
cout << res << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:5: error: 'memset' was not declared in this scope
11 | memset(s, 0, sizeof(s));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s147277293 | p00706 | C++ |
#include <memory>
#include <memory.h>
using namespace std;
bool tree[1000][1000];
int s[1000][1000];
int main(){
int n, w, h;
int x, y, S, T;
while(cin >> n && n){
memset(s, 0, sizeof(s));
memset(tree, false, sizeof(tree));
cin >> w >> h;
for(int i = 0; i < n; i++){
cin >> x >> y;
tree[x][y] = true;
}
cin >> S >> T;
for(int i = 1; i <= w; i++){
for(int j = 1; j <= h; j++){
s[i][j] = s[i-1][j] + s[i][j-1] - s[i-1][j-1];
if(tree[i][j]) s[i][j]++;
}
}
int res = 0;
for(int i = 1; i <= w - S + 1; i++){
for(int j = 1; j <= h - T + 1; j++){
int num = s[i+S-1][j+T-1] - s[i][j+T-1] - s[j+S-1][j] + s[i][j];
res = max(num, res);
}
}
cout << res << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
12 | while(cin >> n && n){
| ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <memory.h>
+++ |+#include <iostream>
4 | using namespace std;
a.cc:34:5: error: 'cout' was not declared in this scope
34 | cout << res << endl;
| ^~~~
a.cc:34:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:20: error: 'endl' was not declared in this scope
34 | cout << res << endl;
| ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
3 | #include <memory.h>
+++ |+#include <ostream>
4 | using namespace std;
|
s433549158 | p00706 | C++ | #include<iostream>
using namespace std;
int main(){
int N=0,W=0,H=0,S=0,T=0;
int tree_exist[100][100]={0};
while(cin >> N,N){
cin >> W >> H;
memset(tree_exist,0,sizeof(tree_exist));
int x,y;
for(int i=0;i<N;i++){
cin >> x >> y;
tree_exist[y][x] = 1;
}
cin >> S >> T;
int max=0;
for(int y=1;y<=H;y++){ // ðÚ®³¹é
for(int x=1;x<=W;x++){
int cnt=0;
for(int y2=0;y2<T;y2++){ // ÌÌØÌ{ð²×é
if(y+y2 > H) break;
for(int x2=0;x2<S;x2++){
if(x+x2 > W) break;
cnt += tree_exist[y+y2][x+x2];
if(cnt>max) max = cnt;
}
}
}
}
cout << max << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:17: error: 'memset' was not declared in this scope
12 | memset(tree_exist,0,sizeof(tree_exist));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s365033649 | p00706 | C++ | #include<iostream>
using namespace std;
int main(){
int N=0,W=0,H=0,S=0,T=0;
int tree_exist[100][100]={0};
while(cin >> N,N){
cin >> W >> H;
memset(tree_exist,0,sizeof(tree_exist));
int x,y;
for(int i=0;i<N;i++){
cin >> x >> y;
tree_exist[y][x] = 1;
}
cin >> S >> T;
int max=0;
for(int y=1;y<=H;y++){ // ðÚ®³¹é
for(int x=1;x<=W;x++){
int cnt=0;
for(int y2=0;y2<T;y2++){ // ÌÌØÌ{ð²×é
if(y+y2 > H) break;
for(int x2=0;x2<S;x2++){
if(x+x2 > W) break;
cnt += tree_exist[y+y2][x+x2];
if(cnt>max) max = cnt;
}
}
}
}
cout << max << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:17: error: 'memset' was not declared in this scope
12 | memset(tree_exist,0,sizeof(tree_exist));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s461135173 | p00706 | C++ | #include <iostream>
using namespace std;
int main() {
int n, w, h, s, t;
int f[100][100]; // field
while (cin >> n, n) {
cin >> w >> h;
memset(f, 0, sizeof(f));
int x, y;
for (int i=0; i<n; i++) {
cin >> x >> y;
f[y][x] = 1;
}
cin >> s >> t;
int max = 0;
for (int y=1; y<=h; y++) {
for (int x=1; x<=w; x++) {
int cnt = 0;
for (int y2=0; y2<t; y2++) {
if (y+y2 > h) { break; }
for (int x2=0; x2<s; x2++) {
if (x+x2 > w) { break; }
cnt += f[y+y2][x+x2];
if (cnt > max) { max = cnt; }
}
}
}
}
cout << max << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:5: error: 'memset' was not declared in this scope
12 | memset(f, 0, sizeof(f));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 |
|
s163080986 | p00706 | C++ | #include<iostream>
using namespace std;
int main(){
int N=0,W=0,H=0,S=0,T=0;
int tree_exist[100][100]={0};
while(cin >> N&&N!=0){
cin >> W >> H;
memset(tree_exist,0,sizeof(tree_exist));
int x,y;
for(int i=0;i<N;i++){
cin >> x >> y;
tree_exist[y][x] = 1;
}
cin >> S >> T;
int max=0;
for(int y=1;y<=H;y++){ // ðÚ®³¹é
for(int x=1;x<=W;x++){
int cnt=0;
for(int y2=0;y2<T;y2++){ // ÌÌØÌ{ð²×é
if(y+y2 > H) break;
for(int x2=0;x2<S;x2++){
if(x+x2 > W) break;
cnt += tree_exist[y+y2][x+x2];
if(cnt>max) max = cnt;
}
}
}
}
cout << max << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:17: error: 'memset' was not declared in this scope
12 | memset(tree_exist,0,sizeof(tree_exist));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s276959566 | p00706 | C++ | #include<iostream>
using namespace std;
int main(){
int N=0,W=0,H=0,S=0,T=0;
int tree_exist[100][100]={0};
while(1){
cin >> N;
if(N==0) break;
cin >> W >> H;
memset(tree_exist,0,sizeof(tree_exist));
int x,y;
for(int i=0;i<N;i++){
cin >> x >> y;
tree_exist[y][x] = 1;
}
cin >> S >> T;
int max=0;
for(int y=1;y<=H;y++){ // ðÚ®³¹é
for(int x=1;x<=W;x++){
int cnt=0;
for(int y2=0;y2<T;y2++){ // ÌÌØÌ{ð²×é
if(y+y2 > H) break;
for(int x2=0;x2<S;x2++){
if(x+x2 > W) break;
cnt += tree_exist[y+y2][x+x2];
if(cnt>max) max = cnt;
}
}
}
}
cout << max << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:17: error: 'memset' was not declared in this scope
14 | memset(tree_exist,0,sizeof(tree_exist));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s564770218 | p00706 | C++ | #include <iostream>
using namespace std;
#define N_MAX 1000;
int main(void)
{
int n;
int w,h;
int x,y;
int s,t;
cin >> n;
cin >> w;
cin >> h;
int f[N_MAX][N_MAX];
int count;
int max;
int i1,i2,i3,i4;
/* syoki*/
for (i1=0;i1<h;i1++){
for (i2=0;i2<w;i2++){
f[i1][i2]=0;
}
}
/* tree */
for (i1=0;i1<n;i1++){
cin >> x;
cin >> y;
f[y-1][x-1] = 1;
cout << endl;
for (i3=0;i3<h;i3++){
for (i2=0;i2<w;i2++){
cout << f[i3][i2] << " ";
}
cout << endl;
}
}
cin >> s;
cin >> t;
max = 0;
for(i1=0;i1<=h-t;i1++){
for(i2=0;i2<=w-s;i2++){
count = 0;
for(i3=i1;i3<t+i1;i3++){
for(i4=i2;i4<s+i2;i4++){
if (f[i3][i4]==1){
count++;
}
}
}
//cout << count << " ";
if (max < count){
max = count;
}
}
}
//cout << endl;
/* print */
/* for (i1=0;i1<h;i1++){
for (i2=0;i2<w;i2++){
cout << f[i1][i2] << " ";
}
cout << endl;
}
*/
cout << max << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:5:19: error: expected ']' before ';' token
5 | #define N_MAX 1000;
| ^
a.cc:21:15: note: in expansion of macro 'N_MAX'
21 | int f[N_MAX][N_MAX];
| ^~~~~
a.cc:21:20: error: expected primary-expression before ']' token
21 | int f[N_MAX][N_MAX];
| ^
a.cc:21:27: error: expected primary-expression before ']' token
21 | int f[N_MAX][N_MAX];
| ^
a.cc:32:25: error: 'f' was not declared in this scope
32 | f[i1][i2]=0;
| ^
a.cc:41:17: error: 'f' was not declared in this scope
41 | f[y-1][x-1] = 1;
| ^
a.cc:69:45: error: 'f' was not declared in this scope
69 | if (f[i3][i4]==1){
| ^
|
s326009538 | p00706 | C++ | cout << i << " " << j << endl; | a.cc:1:17: error: 'cout' does not name a type
1 | cout << i << " " << j << endl;
| ^~~~
|
s654476831 | p00706 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> P;
void p(vi v){
rep(i, v.size()){
cout << v[i] << ' ';
}
cout << endl;
}
int field[200][200];
int main(){
int n;
while(cin >> n, n){
memset(field, 0, sizeof(field));
int w, h;
cin >> w >> h;
vector<P> p(n);
rep(i, n){
int x, y;
cin >> x >> y;
p[i] = P(x, y);
}
int s, t;
cin >> s >> t;
rep(i, n){
int x, y;
x = p[i].first;
y = p[i].second;
rep(j, s){
rep(k, t){
field[100+y-k][100+x-j]++;
}
}
}
int maxim = 0;
rep(j, 100-s){
rep(k, 100-t){
maxim = max(maxim, field[100+k][100+j]);
}
}
cout << maxim << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:30:17: error: 'memset' was not declared in this scope
30 | memset(field, 0, sizeof(field));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <map>
+++ |+#include <cstring>
7 |
|
s362459569 | p00706 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int N;
while( cin >> N, N ){
int i, j, k, l;
int W, H, S, T;
cin >> W >> H;
char field[100][100];
memset(field, '.', sizeof(field));
for( i = 0; i < N; i++ ){
int X, Y;
cin >> X >> Y;
field[X][Y] = '*';
}
cin >> S >> T;
int max = 0;
for( i = 0; i < W; i++ ){
for( j = 0; j < H; j++ ){
int sum = 0;
for( k = 0; k < S; k++ ){
for( l = 0; l < T; l++ ){
if( field[i+k][j+l] == '*' ){
sum++;
}
}
}
if( max < sum ){ max = sum; }
}
}
cout << max << endl;
}
} | a.cc: In function 'int main()':
a.cc:11:17: error: 'memset' was not declared in this scope
11 | memset(field, '.', sizeof(field));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | using namespace std;
|
s660990272 | p00706 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int N;
while( cin >> N, N ){
int i, j, k, l;
int W, H, S, T;
cin >> W >> H;
char field[100][100];
memset(field, '.', sizeof(field));
for( i = 0; i < N; i++ ){
int X, Y;
cin >> X >> Y;
field[X][Y] = '*';
}
cin >> S >> T;
int max = 0;
for( i = 0; i < W; i++ ){
for( j = 0; j < H; j++ ){
int sum = 0;
for( k = 0; k < S; k++ ){
for( l = 0; l < T; l++ ){
if( field[i+k][j+l] == '*' ){
sum++;
}
}
}
if( max < sum ){ max = sum; }
}
}
cout << max << endl;
}
} | a.cc: In function 'int main()':
a.cc:11:17: error: 'memset' was not declared in this scope
11 | memset(field, '.', sizeof(field));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
|
s913157579 | p00707 | Java | import java.math.BigInteger;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Main {
MyScanner sc = new MyScanner();
Scanner sc2 = new Scanner(System.in);
int mod = 1000000007;
int[] dx = { 1, 0 };
int[] dy = { 0, 1 };
void run() {
for (;;) {
int W = sc.nextInt();
int H = sc.nextInt();
if ((W | H) == 0) {
return;
}
char[][] field = new char[H][W];
boolean[][] visit = new boolean[H][W];
BigInteger[][] maxHist = new BigInteger[H][W];
for (int i = 0; i < H; i++) {
String input = sc.next();
for (int j = 0; j < W; j++) {
field[i][j] = input.charAt(j);
maxHist[i][j] = new BigInteger("0");
}
}
Queue<Point> que = new LinkedList<Point>();
BigInteger ans = new BigInteger("0");
BigInteger tmp = new BigInteger("0");
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (Character.isDigit(field[i][j]) && !visit[i][j]) {
que.add(new Point(j, i, (field[i][j] + "")));
while (!que.isEmpty()) {
int size = que.size();
for (int k = 0; k < size; k++) {
Point now = que.poll();
tmp = new BigInteger(now.number);
if(tmp.compareTo(maxHist[now.h][now.w]) <=0) {
continue;
}
ans = ans.max(tmp);
maxHist[now.h][now.w] = ans;
int nowH = now.h;
int nowW = now.w;
visit[nowH][nowW] = true;
String nowNum = now.number;
for (int l = 0; l < 2; l++) {
int nextH = nowH + dy[l];
int nextW = nowW + dx[l];
if (nextH < H
&& nextW < W
&& Character
.isDigit(field[nextH][nextW])) {
que.add(new Point(nextW, nextH, nowNum
+ "" + field[nextH][nextW]));
}
}
}
}
}
}
}
System.out.println(ans);
}
}
class Point {
int w;
int h;
String number;
/**
* @param w
* @param h
*/
public Point(int w, int h, String number) {
super();
this.w = w;
this.h = h;
this.number = number;
}
}
public static void main(String[] args) {
new AOJ_1126().run();
}
void debug(Object... o) {
System.out.println(Arrays.deepToString(o));
}
void debug2(char[][] array) {
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.print(array[i][j]);
}
System.out.println();
}
}
class MyScanner {
int nextInt() {
try {
int c = System.in.read();
while (c != '-' && (c < '0' || '9' < c))
c = System.in.read();
if (c == '-')
return -nextInt();
int res = 0;
do {
res *= 10;
res += c - '0';
c = System.in.read();
} while ('0' <= c && c <= '9');
return res;
} catch (Exception e) {
return -1;
}
}
double nextDouble() {
return Double.parseDouble(next());
}
String next() {
try {
StringBuilder res = new StringBuilder("");
int c = System.in.read();
while (Character.isWhitespace(c))
c = System.in.read();
do {
res.append((char) c);
} while (!Character.isWhitespace(c = System.in.read()));
return res.toString();
} catch (Exception e) {
return null;
}
}
}
} | Main.java:94: error: cannot find symbol
new AOJ_1126().run();
^
symbol: class AOJ_1126
location: class Main
1 error
|
s244136981 | p00707 | Java | public class Main {
MyScanner sc = new MyScanner();
Scanner sc2 = new Scanner(System.in);
int mod = 1000000007;
int[] dx = { 1, 0 };
int[] dy = { 0, 1 };
void run() {
for (;;) {
int W = sc.nextInt();
int H = sc.nextInt();
if ((W | H) == 0) {
return;
}
char[][] field = new char[H][W];
boolean[][] visit = new boolean[H][W];
BigInteger[][] maxHist = new BigInteger[H][W];
for (int i = 0; i < H; i++) {
String input = sc.next();
for (int j = 0; j < W; j++) {
field[i][j] = input.charAt(j);
maxHist[i][j] = new BigInteger("0");
}
}
Queue<Point> que = new LinkedList<Point>();
BigInteger ans = new BigInteger("0");
BigInteger tmp = new BigInteger("0");
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (Character.isDigit(field[i][j]) && !visit[i][j]) {
que.add(new Point(j, i, (field[i][j] + "")));
while (!que.isEmpty()) {
int size = que.size();
for (int k = 0; k < size; k++) {
Point now = que.poll();
tmp = new BigInteger(now.number);
if(tmp.compareTo(maxHist[now.h][now.w]) <=0) {
continue;
}
ans = ans.max(tmp);
maxHist[now.h][now.w] = ans;
int nowH = now.h;
int nowW = now.w;
visit[nowH][nowW] = true;
String nowNum = now.number;
for (int l = 0; l < 2; l++) {
int nextH = nowH + dy[l];
int nextW = nowW + dx[l];
if (nextH < H
&& nextW < W
&& Character
.isDigit(field[nextH][nextW])) {
que.add(new Point(nextW, nextH, nowNum
+ "" + field[nextH][nextW]));
}
}
}
}
}
}
}
System.out.println(ans);
}
}
class Point {
int w;
int h;
String number;
/**
* @param w
* @param h
*/
public Point(int w, int h, String number) {
super();
this.w = w;
this.h = h;
this.number = number;
}
}
public static void main(String[] args) {
new Main().run();
}
void debug(Object... o) {
System.out.println(Arrays.deepToString(o));
}
void debug2(char[][] array) {
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.print(array[i][j]);
}
System.out.println();
}
}
class MyScanner {
int nextInt() {
try {
int c = System.in.read();
while (c != '-' && (c < '0' || '9' < c))
c = System.in.read();
if (c == '-')
return -nextInt();
int res = 0;
do {
res *= 10;
res += c - '0';
c = System.in.read();
} while ('0' <= c && c <= '9');
return res;
} catch (Exception e) {
return -1;
}
}
double nextDouble() {
return Double.parseDouble(next());
}
String next() {
try {
StringBuilder res = new StringBuilder("");
int c = System.in.read();
while (Character.isWhitespace(c))
c = System.in.read();
do {
res.append((char) c);
} while (!Character.isWhitespace(c = System.in.read()));
return res.toString();
} catch (Exception e) {
return null;
}
}
}
} | Main.java:3: error: cannot find symbol
Scanner sc2 = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner sc2 = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:19: error: cannot find symbol
BigInteger[][] maxHist = new BigInteger[H][W];
^
symbol: class BigInteger
location: class Main
Main.java:19: error: cannot find symbol
BigInteger[][] maxHist = new BigInteger[H][W];
^
symbol: class BigInteger
location: class Main
Main.java:24: error: cannot find symbol
maxHist[i][j] = new BigInteger("0");
^
symbol: class BigInteger
location: class Main
Main.java:27: error: cannot find symbol
Queue<Point> que = new LinkedList<Point>();
^
symbol: class Queue
location: class Main
Main.java:27: error: cannot find symbol
Queue<Point> que = new LinkedList<Point>();
^
symbol: class LinkedList
location: class Main
Main.java:28: error: cannot find symbol
BigInteger ans = new BigInteger("0");
^
symbol: class BigInteger
location: class Main
Main.java:28: error: cannot find symbol
BigInteger ans = new BigInteger("0");
^
symbol: class BigInteger
location: class Main
Main.java:29: error: cannot find symbol
BigInteger tmp = new BigInteger("0");
^
symbol: class BigInteger
location: class Main
Main.java:29: error: cannot find symbol
BigInteger tmp = new BigInteger("0");
^
symbol: class BigInteger
location: class Main
Main.java:38: error: cannot find symbol
tmp = new BigInteger(now.number);
^
symbol: class BigInteger
location: class Main
Main.java:92: error: cannot find symbol
System.out.println(Arrays.deepToString(o));
^
symbol: variable Arrays
location: class Main
13 errors
|
s092101473 | p00707 | Java | import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class AOJ_1126
{
int W;
int H;
String[] C;
int[][] table;
List<String> ansList;
private boolean isNum(char ch)
{
if(ch >= '0' && ch <= '9')return true;
return false;
}
private boolean isStrNum(String s)
{
if(s.charAt(0) == '0')return false;
return true;
}
private int strNumComp(char[] charA,char[] charB)
{
if(charA.length > charB.length)return 1;
if(charA.length < charB.length)return -1;
for(int i = 0;i < charA.length;i++)
{
if(charA[i] == charB[i])continue;
if(charA[i] > charB[i])return 1;
if(charA[i] < charB[i])return -1;
}
return 0;
}
private int strNumComp(String a,String b)
{
char[] charA = a.toCharArray();
char[] charB = b.toCharArray();
if(charA.length > charB.length)return 1;
if(charA.length < charB.length)return -1;
for(int i = 0;i < charA.length;i++)
{
if(charA[i] == charB[i])continue;
if(charA[i] > charB[i])return 1;
if(charA[i] < charB[i])return -1;
}
return 0;
}
private void dfs(int h,int w,String S)
{
/*if((table[h][w] == 0 || (h >= H - 1 && w >= W - 1))&& !S.isEmpty())
{
System.out.println("aaa");
ansList.add(S);
return;
}*/
if(h + 1 < H && table[h + 1][w] > 0)
{
dfs(h + 1,w,S + C[h + 1].charAt(w));
}
if(w + 1 < W && table[h][w + 1] > 0)
{
dfs(h, w + 1,S + C[h].charAt(w + 1));
}
if(h + 1 < H && w + 1 < W && table[h + 1][w + 1] > 0)
{
dfs(h + 1,w + 1,S + C[h + 1].charAt(w + 1));
}
//System.out.println(S);
ansList.add(S);
return;
}
public void solve()
{
Scanner cin = new Scanner(System.in);
while(true)
{
W = cin.nextInt();
H = cin.nextInt();
if(W == 0 && H == 0)break;
C = new String[H];
for(int i = 0;i < H;i++)
{
C[i] = cin.next();
}
table = new int[H][W];
for(int i = 0;i < H;i++)
{
for(int j = 0;j < W;j++)
{
if(C[i].charAt(j) >= '0' && C[i].charAt(j) <= '9')table[i][j] = 1;
}
}
int[] bin = new int[500];
for(int i = 0;i < H;i++)
{
for(int j = 0;j < W;j++)
{
char ch = C[i].charAt(j);
if(isNum(ch))
{
if(j + 1 < W && isNum(C[i].charAt(j + 1)))
{
table[i][j + 1] = Math.max(table[i][j] + 1,table[i][j + 1]);
}
if(i + 1 < H && isNum(C[i + 1].charAt(j)))
{
table[i + 1][j] = Math.max(table[i][j] + 1,table[i + 1][j]);
}
if(i + 1 < H && j + 1 < W && isNum(C[i + 1].charAt(j + 1)))
{
table[i + 1][j + 1] = Math.max(table[i][j] + 1,table[i + 1][j + 1]);
}
}
}
}
ansList = new ArrayList<String>();
for(int i = 0;i < H;i++)
{
for(int j = 0;j < W;j++)
{
if(table[i][j] == 0)continue;
if(isNum(C[i].charAt(j)))
{
dfs(i,j,C[i].charAt(j) + "");
}
}
}
//System.out.println(ansList.size());
String ans = "";
for(String s : ansList)
{
if(!isStrNum(s))continue;
if(ans == "")
{
ans = s;
continue;
}
if(strNumComp(ans,s) == -1)
{
ans = s;
}
//System.out.println(s);
}
System.out.println(ans);
/*for(int i = 0;i < H;i++)
{
for(int j = 0;j < W;j++)
{
System.out.print(table[i][j] + " ");
}
System.out.println();
}*/
}
}
public static void main(String[] args)
{
new AOJ_1126().solve();
}
} | Main.java:4: error: class AOJ_1126 is public, should be declared in a file named AOJ_1126.java
public class AOJ_1126
^
1 error
|
s060793104 | p00707 | Java | import java.util.Scanner;
public class TheSecretNumberDP {
int m, n;
char[][] map;
Scanner in = new Scanner(System.in);
String remove_zero(String s) {
int k;
for (k = 0; k < s.length(); k++) {
if (s.charAt(k) != '0') break;
}
return s.substring(k, s.length());
}
boolean compare(String s1, String s2) {
if (s1.length() > s2.length()) return true;
else if (s1.length() < s2.length()) return false;
else {
for (int i = 0; i < s1.length(); i++) {
if (s1.charAt(i) > s2.charAt(i)) return true;
else if (s1.charAt(i) < s2.charAt(i)) return false;
}
}
return true;
}
public TheSecretNumberDP() {
while (true) {
int m = in.nextInt();
int n = in.nextInt();
if (m == 0 && n == 0) break;
map = new char[n+1][m+1];
for (int i = 1; i <= n; i++) {
String s = in.next();
for (int j = 0; j < m; j++) {
map[i][j+1] = s.charAt(j);
}
}
String[][] dp = new String[n+1][m+1];
for (int i = 0; i <= n; i++)
for (int j = 0; j <= m; j++)
dp[i][j] = "";
String ans = "";
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (map[i][j] >= 'A' && map[i][j] <= 'Z' || map[i][j] == 0)
continue;
else if (map[i][j] == '0' && dp[i][j-1] == "" && dp[i-1][j] == "")
continue;
else {
dp[i][j] = (compare(dp[i][j-1] + map[i][j], dp[i][j])) ? dp[i][j-1] + map[i][j] : dp[i][j];
dp[i][j] = (compare(dp[i-1][j] + map[i][j], dp[i][j])) ? dp[i-1][j] + map[i][j] : dp[i][j];
}
ans = compare(dp[i][j], ans) ? dp[i][j] : ans;
}
}
System.out.println(ans);
}
}
public static void main(String[] args) {
new TheSecretNumberDP();
}
} | Main.java:4: error: class TheSecretNumberDP is public, should be declared in a file named TheSecretNumberDP.java
public class TheSecretNumberDP {
^
1 error
|
s888792895 | p00707 | C | // Aizu 1126: The Secret Number
// 2017.9.15 bal4u@uu
#include <stdio.h>
#include <ctype.h>
#include < string.h>
char d[72][72], s[72][72][72];
int a[72][72];
char ans[72]; int len;
int main()
{
int w, h, r, c;
while (scanf("%d%d", &w, &h) && w) {;
memset(a, 0, sizeof(a));
for (r = 0; r < h; r++) scanf("%s", d[r]);
for (r = 0; r < h; r++) for (c = 0; c < w; c++) {
if (!isdigit(d[r][c])) continue;
a[r][c] = 0;
if (c > 0 && isdigit(d[r][c-1]))
a[r][c] = a[r][c-1], memcpy(s[r][c], s[r][c-1], a[r][c]);
if (r > 0 && isdigit(d[r-1][c])) {
if (a[r-1][c] > a[r][c] || (a[r-1][c] == a[r][c] && memcmp(s[r-1][c], s[r][c], a[r][c]) > 0))
a[r][c] = a[r-1][c], memcpy(s[r][c], s[r-1][c], a[r][c]);
}
if (a[r][c] == 0 && d[r][c] == '0') continue;
s[r][c][a[r][c]] = d[r][c], a[r][c]++;
}
for (len = 0, r = 0; r < h; r++) for (c = 0; c < w; c++) {
if (a[r][c] > len || (a[r][c] == len && memcmp(s[r][c], ans, len) > 0)) len = a[r][c], memcpy(ans, s[r][c], len);
}
ans[len] = 0;
puts(ans);
}
return 0;
} | main.c:6:10: fatal error: string.h: No such file or directory
6 | #include < string.h>
| ^~~~~~~~~~~
compilation terminated.
|
s504003654 | p00707 | C | #define M 100
char m[M][M],s[M][M][M],r[M],*z;
cmp(char *p,char *q){
int r=0;
for(;*p=='0';p++);
for(;*q=='0';q++);
if(r=strlen(p)-strlen(q))return r;
return strcmp(p,q);
}
main(w,h,i,j,k,l){
for(;scanf("%d%d",&w,&h),w;puts(z)){
memset(m,0xff,sizeof(m));
memset(s,0,sizeof(s));
memset(r,0,sizeof(r));
for(j=1;j<=h;j++)scanf("%s",m[j]+1);
for(i=1;i<=w+1;i++)for(j=1;j<=h;j++)if(m[j][i]<'0'||'9'<m[j][i])m[j][i]=-1;
//for(k=1;k<M;k++){
for(i=1;i<=w;i++)
//for(j=i=k;i<=w;i++){
for(j=1;j<=h;j++){
if(m[j][i]==-1)continue;
if(cmp(s[j][i-1],s[j-1][i])>0)strcpy(s[j][i],s[j][i-1]),s[j][i][strlen(s[j][i])]=m[j][i];
else strcpy(s[j][i],s[j-1][i]),s[j][i][strlen(s[j][i])]=m[j][i];
if(cmp(s[j][i],r)>0)strcpy(r,s[j][i]);
}
/*
for(j=i=k;j<=h;j++){
if(m[j][i]==-1)continue;
if(cmp(s[j][i-1],s[j-1][i])>0)strcpy(s[j][i],s[j][i-1]),s[j][i][strlen(s[j][i])]=m[j][i];
else strcpy(s[j][i],s[j-1][i]),s[j][i][strlen(s[j][i])]=m[j][i];
if(cmp(s[j][i],r)>0)strcpy(r,s[j][i]);
}
*/
}
for(z=r;*z=='0';z++);
}
return 0;} | main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | cmp(char *p,char *q){
| ^~~
main.c: In function 'cmp':
main.c:7:8: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
7 | if(r=strlen(p)-strlen(q))return r;
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen'
+++ |+#include <string.h>
1 | #define M 100
main.c:7:8: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
7 | if(r=strlen(p)-strlen(q))return r;
| ^~~~~~
main.c:7:8: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:8:10: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
8 | return strcmp(p,q);
| ^~~~~~
main.c:8:10: note: include '<string.h>' or provide a declaration of 'strcmp'
main.c: At top level:
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
10 | main(w,h,i,j,k,l){
| ^~~~
main.c: In function 'main':
main.c:10:1: error: type of 'w' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'h' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'k' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'l' defaults to 'int' [-Wimplicit-int]
main.c:11:14: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
11 | for(;scanf("%d%d",&w,&h),w;puts(z)){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define M 100
main.c:11:14: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
11 | for(;scanf("%d%d",&w,&h),w;puts(z)){
| ^~~~~
main.c:11:14: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:11:36: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
11 | for(;scanf("%d%d",&w,&h),w;puts(z)){
| ^~~~
main.c:11:36: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c:12:17: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
12 | memset(m,0xff,sizeof(m));
| ^~~~~~
main.c:12:17: note: include '<string.h>' or provide a declaration of 'memset'
main.c:12:17: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
main.c:12:17: note: include '<string.h>' or provide a declaration of 'memset'
main.c:22:63: error: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration]
22 | if(cmp(s[j][i-1],s[j-1][i])>0)strcpy(s[j][i],s[j][i-1]),s[j][i][strlen(s[j][i])]=m[j][i];
| ^~~~~~
main.c:22:63: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:22:63: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
main.c:22:63: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:22:97: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
22 | if(cmp(s[j][i-1],s[j-1][i])>0)strcpy(s[j][i],s[j][i-1]),s[j][i][strlen(s[j][i])]=m[j][i];
| ^~~~~~
main.c:22:97: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:23:38: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
23 | else strcpy(s[j][i],s[j-1][i]),s[j][i][strlen(s[j][i])]=m[j][i];
| ^~~~~~
main.c:23:38: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:23:72: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
23 | else strcpy(s[j][i],s[j-1][i]),s[j][i][strlen(s[j][i])]=m[j][i];
| ^~~~~~
main.c:23:72: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:24:53: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
24 | if(cmp(s[j][i],r)>0)strcpy(r,s[j][i]);
| ^~~~~~
main.c:24:53: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c: At top level:
main.c:37:1: error: expected identifier or '(' before 'return'
37 | return 0;}
| ^~~~~~
main.c:37:10: error: expected identifier or '(' before '}' token
37 | return 0;}
| ^
|
s049468622 | p00707 | C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#define MAX(a,b) ((a) > (b) ? (a) : (b));
main(){
int W,H;
while(1){
scanf("%d%d",&W,&H);
if(W+H==0) break;
int ward,m[70][70];
int maxcode;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
ward=getchar();
if(isdigit(ward)){
if(i+j==0) m[i][j]=ward; //0行0列目ならば.
else if(i>0&&j==0){
if(isdigit(m[i-1][j])) m[i][j]=ward+m[i-1][j]*10;
else m[i][j]=ward;
}else if(j>0&&i==0){
if(isdigit(m[i][j-1])) m[i][j]=ward+m[i][j-1]*10;
else m[i][j]=ward;
}else{
int up=0,right=0;
if(isdigit(m[i-1][j])) up=m[i-1][j];
if(isdigit(m[i][j-1])) right=[i-1][j];
m[i][j]=ward+MAX(up,right)*10;
}
}else m[i][j]=ward;
maxcode=MAX(maxcode,m[i][j]);
}
}
printf("%d",maxcode);
}
} | main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
6 | main(){
| ^~~~
main.c: In function 'main':
main.c:13:21: error: 'i' undeclared (first use in this function)
13 | for(i=0;i<H;i++){
| ^
main.c:13:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:29: error: 'j' undeclared (first use in this function)
14 | for(j=0;j<W;j++){
| ^
main.c:27:78: error: expected expression before '[' token
27 | if(isdigit(m[i][j-1])) right=[i-1][j];
| ^
main.c:28:75: error: invalid type argument of unary '*' (have 'int')
28 | m[i][j]=ward+MAX(up,right)*10;
| ^~~
|
s830565563 | p00707 | C++ | const int INF = 100000000;
typedef double D;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;
/** Problem1126 : The Secret Number **/
const int MAX_W = 70;
int W, H;
char field[MAX_W][MAX_W];
string dp[MAX_W][MAX_W];
bool big(string s1, string s2) {
if (s1.length() > s2.length()) {
return true;
} else if (s2.length() > s1.length()) {
return false;
} else {
return (s1>s2?true:false);
}
}
bool big2(string s1, string s2) {
while (s1[0]=='0') s1.erase(s1.begin());
while (s2[0]=='0') s2.erase(s2.begin());
return big(s1, s2);
}
string rec(int x, int y)
{
if (!('0' <= field[y][x] && field[y][x] <= '9'))
return dp[y][x] = "";
string s1 = field[y][x] + dp[y][x+1];
string s2 = field[y][x] + dp[y+1][x];
return dp[y][x] = (big(s1, s2)?s1:s2);
}
int main()
{
while (cin>>W>>H, W||H) {
fill(dp[0], dp[0]+W*H, "");
rep(i, H) {
rep(j, W) {
cin>>field[i][j];
}
}
string ans = "0";
rep(y, H) {
rep(x, W) {
string tmp = rec(W-x-1, H-y-1);
ans = (big2(ans, tmp)?ans:tmp);
}
}
while (ans[0]=='0') ans.erase(ans.begin());
cout << (ans!=""?ans:"0") << endl;
}
} | a.cc:7:9: error: 'pair' does not name a type
7 | typedef pair<int, int> P;
| ^~~~
a.cc:13:1: error: 'string' does not name a type
13 | string dp[MAX_W][MAX_W];
| ^~~~~~
a.cc:15:10: error: 'string' was not declared in this scope
15 | bool big(string s1, string s2) {
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | const int INF = 100000000;
a.cc:15:21: error: 'string' was not declared in this scope
15 | bool big(string s1, string s2) {
| ^~~~~~
a.cc:15:21: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:15:30: error: expression list treated as compound expression in initializer [-fpermissive]
15 | bool big(string s1, string s2) {
| ^
a.cc:25:11: error: 'string' was not declared in this scope
25 | bool big2(string s1, string s2) {
| ^~~~~~
a.cc:25:11: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:25:22: error: 'string' was not declared in this scope
25 | bool big2(string s1, string s2) {
| ^~~~~~
a.cc:25:22: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:25:31: error: expression list treated as compound expression in initializer [-fpermissive]
25 | bool big2(string s1, string s2) {
| ^
a.cc:31:1: error: 'string' does not name a type
31 | string rec(int x, int y)
| ^~~~~~
a.cc: In function 'int main()':
a.cc:44:16: error: 'cin' was not declared in this scope
44 | while (cin>>W>>H, W||H) {
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | const int INF = 100000000;
a.cc:45:22: error: 'dp' was not declared in this scope; did you mean 'dy'?
45 | fill(dp[0], dp[0]+W*H, "");
| ^~
| dy
a.cc:45:17: error: 'fill' was not declared in this scope
45 | fill(dp[0], dp[0]+W*H, "");
| ^~~~
a.cc:47:21: error: 'i' was not declared in this scope
47 | rep(i, H) {
| ^
a.cc:47:17: error: 'rep' was not declared in this scope
47 | rep(i, H) {
| ^~~
a.cc:53:17: error: 'string' was not declared in this scope
53 | string ans = "0";
| ^~~~~~
a.cc:53:17: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:54:21: error: 'y' was not declared in this scope; did you mean 'dy'?
54 | rep(y, H) {
| ^
| dy
a.cc:61:24: error: 'ans' was not declared in this scope
61 | while (ans[0]=='0') ans.erase(ans.begin());
| ^~~
a.cc:63:17: error: 'cout' was not declared in this scope
63 | cout << (ans!=""?ans:"0") << endl;
| ^~~~
a.cc:63:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:63:26: error: 'ans' was not declared in this scope
63 | cout << (ans!=""?ans:"0") << endl;
| ^~~
a.cc:63:46: error: 'endl' was not declared in this scope
63 | cout << (ans!=""?ans:"0") << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | const int INF = 100000000;
|
s583811328 | p00707 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int w,h;
vector<string> data;
int dx[2]={1,0};
int dy[2]={0,1};
bool inrange(int x,int y){
if(x<0||y<0||x>h-1||y>w-1) return false;
else return true;
}
long long int conv(string str){
if(str=="") return -1;
REP(i,str.size()) {
if(str[i]<'0'||str[i]>'9') {
return -1;
}
}
cout << str << endl;
return stoll(str);
}
string getbigger(string a,string b){
if(a.size()!=b.size()){
if(a.size()>b.size()) return a;
else return b;
}
else{
REP(i,a.size()){
if(a[i]==b[i]) continue;
if(a[i]>b[i]) return a;
else return b;
}
return a;//eq
}
}
string solve(int px,int py,bool sudeni[100][100]){
string rst = "";
if(!inrange(px,py)) return "";
if(sudeni[px][py]==false && '0'<=data[px][py] && data[px][py]<='9') {
rst+=data[px][py];
sudeni[px][py] = true;
}
vector<string> tmp;
REP(i,2){
tmp.pb("");
int nx = px + dx[i];
int ny = py + dy[i];
if(inrange(nx,ny) && sudeni[nx][ny]==false && '0'<=data[nx][ny] && data[nx][ny]<='9') {
tmp[i]=solve(nx,ny,sudeni);
}
}
rst += getbigger(tmp[0],tmp[1]);
return rst;
}
int main(){
while(1){
cin >> w >> h;
if(w==0&&h==0) break;
data.clear();
REP(i,h){
string tmp;
cin >> tmp;
data.pb(tmp);
}
string ans = "-1";
REP(i,h){
REP(j,w){
bool s[100][100];
REP(i,100) REP(j,100) s[i][j]=false;
ans = getbigger(solve(i,j,s),ans);
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'std::string solve(int, int, bool (*)[100])':
a.cc:66:42: error: reference to 'data' is ambiguous
66 | if(sudeni[px][py]==false && '0'<=data[px][py] && data[px][py]<='9') {
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:66:58: error: reference to 'data' is ambiguous
66 | if(sudeni[px][py]==false && '0'<=data[px][py] && data[px][py]<='9') {
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:67:22: error: reference to 'data' is ambiguous
67 | rst+=data[px][py];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:75:68: error: reference to 'data' is ambiguous
75 | if(inrange(nx,ny) && sudeni[nx][ny]==false && '0'<=data[nx][ny] && data[nx][ny]<='9') {
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:75:84: error: reference to 'data' is ambiguous
75 | if(inrange(nx,ny) && sudeni[nx][ny]==false && '0'<=data[nx][ny] && data[nx][ny]<='9') {
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc: In function 'int main()':
a.cc:87:17: error: reference to 'data' is ambiguous
87 | data.clear();
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:91:25: error: reference to 'data' is ambiguous
91 | data.pb(tmp);
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
|
s185075540 | p00707 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int w,h;
vector<string> data;
int dx[2]={1,0};
int dy[2]={0,1};
bool inrange(int x,int y){
if(x<0||y<0||x>h-1||y>w-1) return false;
else return true;
}
long long int conv(string str){
if(str=="") return -1;
REP(i,str.size()) {
if(str[i]<'0'||str[i]>'9') {
return -1;
}
}
cout << str << endl;
return stoll(str);
}
string getbigger(string a,string b){
if(a.size()!=b.size()){
if(a.size()>b.size()) return a;
else return b;
}
else{
REP(i,a.size()){
if(a[i]==b[i]) continue;
if(a[i]>b[i]) return a;
else return b;
}
return a;//eq
}
}
string solve(int px,int py,bool sudeni[100][100]){
string rst = "";
if(!inrange(px,py)) return "";
if(sudeni[px][py]==false && '0'<=data[px][py] && data[px][py]<='9') {
rst+=data[px][py];
sudeni[px][py] = true;
}
vector<string> tmp;
REP(i,2){
tmp.pb("");
int nx = px + dx[i];
int ny = py + dy[i];
if(inrange(nx,ny) && sudeni[nx][ny]==false && '0'<=data[nx][ny] && data[nx][ny]<='9') {
tmp[i]=solve(nx,ny,sudeni);
}
}
rst += getbigger(tmp[0],tmp[1]);
return rst;
}
int main(){
while(1){
cin >> w >> h;
if(w==0&&h==0) break;
data.clear();
REP(i,h){
string tmp;
cin >> tmp;
data.pb(tmp);
}
string ans = "-1";
REP(i,h){
REP(j,w){
bool s[100][100];
REP(i,100) REP(j,100) s[i][j]=false;
ans = getbigger(solve(i,j,s),ans);
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'std::string solve(int, int, bool (*)[100])':
a.cc:66:42: error: reference to 'data' is ambiguous
66 | if(sudeni[px][py]==false && '0'<=data[px][py] && data[px][py]<='9') {
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:66:58: error: reference to 'data' is ambiguous
66 | if(sudeni[px][py]==false && '0'<=data[px][py] && data[px][py]<='9') {
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:67:22: error: reference to 'data' is ambiguous
67 | rst+=data[px][py];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:75:68: error: reference to 'data' is ambiguous
75 | if(inrange(nx,ny) && sudeni[nx][ny]==false && '0'<=data[nx][ny] && data[nx][ny]<='9') {
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:75:84: error: reference to 'data' is ambiguous
75 | if(inrange(nx,ny) && sudeni[nx][ny]==false && '0'<=data[nx][ny] && data[nx][ny]<='9') {
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc: In function 'int main()':
a.cc:87:17: error: reference to 'data' is ambiguous
87 | data.clear();
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
a.cc:91:25: error: reference to 'data' is ambiguous
91 | data.pb(tmp);
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:27:16: note: 'std::vector<std::__cxx11::basic_string<char> > data'
27 | vector<string> data;
| ^~~~
|
s450955323 | p00707 | C++ | #include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
string b[70];
string memo[70][70];
bool comp(string& s1, string& s2) {
if(s1.size() == s2.size()) return s1 < s2;
return s1.size() < s2.size();
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int W, H;
while(cin >> W >> H, W | H) {
for(int i = 0; i < H; i++) {
cin >> b[i];
}
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
memo[i][j] = "";
if('1' <= b[i][j] && b[i][j] <= '9') memo[i][j] += b[i][j];
}
}
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
if('0' <= b[i][j] && b[i][j] <= '9') {
if(i + 1 < H) {
if('0' <= b[i + 1][j] && b[i + 1][j] <= '9') {
if(comp(memo[i + 1][j], memo[i][j] + b[i + 1][j]))
memo[i + 1][j] = memo[i][j] + b[i + 1][j];
}
}
if(j + 1 < W) {
if('0' <= b[i][j + 1] && b[i][j + 1] <= '9') {
if(comp(memo[i][j + 1], memo[i][j] + b[i][j + 1]))
memo[i][j + 1] = memo[i][j] + b[i][j + 1];
}
}
}
}
}
string ans = "0";
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
if(comp(ans, memo[i][j])) ans = memo[i][j];
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:38:92: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
38 | if(comp(memo[i + 1][j], memo[i][j] + b[i + 1][j]))
a.cc:12:31: note: initializing argument 2 of 'bool comp(std::string&, std::string&)'
12 | bool comp(string& s1, string& s2) {
| ~~~~~~~~^~
a.cc:44:92: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
44 | if(comp(memo[i][j + 1], memo[i][j] + b[i][j + 1]))
a.cc:12:31: note: initializing argument 2 of 'bool comp(std::string&, std::string&)'
12 | bool comp(string& s1, string& s2) {
| ~~~~~~~~^~
|
s853838730 | p00707 | C++ | #include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
string b[70];
string memo[70][70];
bool comp(string& s1, string& s2) {
if(s1.size() == s2.size()) return s1 < s2;
return s1.size() < s2.size();
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int W, H;
while(cin >> W >> H, W | H) {
for(int i = 0; i < H; i++) {
cin >> b[i];
}
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
memo[i][j] = "";
if('1' <= b[i][j] && b[i][j] <= '9') memo[i][j] += b[i][j];
}
}
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
if('0' <= b[i][j] && b[i][j] <= '9') {
if(i + 1 < H) {
if('0' <= b[i + 1][j] && b[i + 1][j] <= '9') {
if(comp(memo[i + 1][j], memo[i][j] + b[i + 1][j]))
memo[i + 1][j] = memo[i][j] + b[i + 1][j];
}
}
if(j + 1 < W) {
if('0' <= b[i][j + 1] && b[i][j + 1] <= '9') {
if(comp(memo[i][j + 1], memo[i][j] + b[i][j + 1]))
memo[i][j + 1] = memo[i][j] + b[i][j + 1];
}
}
}
}
}
string ans = "0";
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
if(comp(ans, memo[i][j])) ans = memo[i][j];
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:38:92: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
38 | if(comp(memo[i + 1][j], memo[i][j] + b[i + 1][j]))
a.cc:12:31: note: initializing argument 2 of 'bool comp(std::string&, std::string&)'
12 | bool comp(string& s1, string& s2) {
| ~~~~~~~~^~
a.cc:44:92: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
44 | if(comp(memo[i][j + 1], memo[i][j] + b[i][j + 1]))
a.cc:12:31: note: initializing argument 2 of 'bool comp(std::string&, std::string&)'
12 | bool comp(string& s1, string& s2) {
| ~~~~~~~~^~
|
s240595100 | p00707 | C++ | #include <bits/stdc++.h>
using namespace std;
#define LOG(...) fprintf(stderr, __VA_ARGS__)
// #define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for(int i = (int)(n - 1); i >= 0; --i)
#define RFOR(i, a, b) for(int i = (int)(b - 1); i >= (int)(a); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)
#define BIT(x, i) (((x) >> (i)) & 1)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vc> vvc;
typedef vector<vll> vvll;
char field[70][70];
string dp[70][70];
string strmax(string a, string b) {
if (a.length() > b.length()) return a;
if (a.length() < b.length()) return b;
return max(a, b);
}
int dx[] = {-1, 0};
int dy[] = {0, -1};
int main() {
int w, h;
while(cin >> w >> h, w) {
fill_n((char*)field, 70 * 70, ' ');
fill_n((string*)dp, 70 * 70, "");
REP(y, h) REP(x, w) {
cin >> field[y][x];
}
dp[h - 1][w - 1] = field[h - 1][w - 1];
string maxs = "";
RREP(y, h) RREP(x, w) {
REP(i, 2){
int sx = x + dx[i];
int sy = y + dy[i];
if (sx < 0 || sx >= w || sy < 0 || sy >= h) continue;
if (isnumber(field[y][x]) && isnumber(field[sy][sx])) {
dp[sy][sx] = strmax(dp[sy][sx], field[sy][sx] + dp[y][x]);
// maxs = strmax(maxs, dp[sy][sx]);
}
}
}
REP(y, h) REP(x, w) {
while(*dp[y][x].begin() == '0') dp[y][x].erase(dp[y][x].begin());
maxs = strmax(maxs, dp[y][x]);
}
cout << maxs << endl;
}
} | a.cc: In function 'int main()':
a.cc:62:13: error: 'isnumber' was not declared in this scope
62 | if (isnumber(field[y][x]) && isnumber(field[sy][sx])) {
| ^~~~~~~~
|
s423818967 | p00707 | C++ | #include <bits/stdc++.h>
using namespace std;
#define LOG(...) fprintf(stderr, __VA_ARGS__)
// #define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for(int i = (int)(n - 1); i >= 0; --i)
#define RFOR(i, a, b) for(int i = (int)(b - 1); i >= (int)(a); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)
#define BIT(x, i) (((x) >> (i)) & 1)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vc> vvc;
typedef vector<vll> vvll;
char field[70][70];
string dp[70][70];
string strmax(string a, string b) {
if (a.length() > b.length()) return a;
if (a.length() < b.length()) return b;
return max(a, b);
}
int dx[] = {-1, 0};
int dy[] = {0, -1};
int main() {
int w, h;
while(cin >> w >> h, w) {
fill_n((char*)field, 70 * 70, ' ');
fill_n((string*)dp, 70 * 70, "");
REP(y, h) REP(x, w) {
cin >> field[y][x];
}
dp[h - 1][w - 1] = field[h - 1][w - 1];
string maxs = "";
RREP(y, h) RREP(x, w) {
REP(i, 2){
int sx = x + dx[i];
int sy = y + dy[i];
if (sx < 0 || sx >= w || sy < 0 || sy >= h) continue;
if (isnumber(field[y][x]) && isnumber(field[sy][sx])) {
dp[sy][sx] = strmax(dp[sy][sx], field[sy][sx] + dp[y][x]);
// maxs = strmax(maxs, dp[sy][sx]);
}
}
}
REP(y, h) REP(x, w) {
while(*dp[y][x].begin() == '0') dp[y][x].erase(dp[y][x].begin());
maxs = strmax(maxs, dp[y][x]);
}
cout << maxs << endl;
}
} | a.cc: In function 'int main()':
a.cc:62:13: error: 'isnumber' was not declared in this scope
62 | if (isnumber(field[y][x]) && isnumber(field[sy][sx])) {
| ^~~~~~~~
|
s216591307 | p00707 | C++ | #include <bits/stdc++.h>
using namespace std;
#define LOG(...) fprintf(stderr, __VA_ARGS__)
// #define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for(int i = (int)(n - 1); i >= 0; --i)
#define RFOR(i, a, b) for(int i = (int)(b - 1); i >= (int)(a); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)
#define BIT(x, i) (((x) >> (i)) & 1)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vc> vvc;
typedef vector<vll> vvll;
char field[70][70];
string dp[70][70];
string strmax(string a, string b) {
if (a.length() > b.length()) return a;
if (a.length() < b.length()) return b;
return max(a, b);
}
int dx[] = {-1, 0};
int dy[] = {0, -1};
int main() {
int w, h;
while(cin >> w >> h, w) {
fill_n((char*)field, 70 * 70, ' ');
fill_n((string*)dp, 70 * 70, "");
REP(y, h) REP(x, w) {
cin >> field[y][x];
}
dp[h - 1][w - 1] = field[h - 1][w - 1];
string maxs = "";
RREP(y, h) RREP(x, w) {
REP(i, 2){
int sx = x + dx[i];
int sy = y + dy[i];
if (sx < 0 || sx >= w || sy < 0 || sy >= h) continue;
if (isdigit(field[y][x]) && isnumber(field[sy][sx])) {
dp[sy][sx] = strmax(dp[sy][sx], field[sy][sx] + dp[y][x]);
// maxs = strmax(maxs, dp[sy][sx]);
}
}
}
REP(y, h) REP(x, w) {
while(*dp[y][x].begin() == '0') dp[y][x].erase(dp[y][x].begin());
maxs = strmax(maxs, dp[y][x]);
}
cout << maxs << endl;
}
} | a.cc: In function 'int main()':
a.cc:62:37: error: 'isnumber' was not declared in this scope
62 | if (isdigit(field[y][x]) && isnumber(field[sy][sx])) {
| ^~~~~~~~
|
s105472698 | p00707 | C++ | #include <vector>
int main(){
vector<int> a(1000000000);
} | a.cc: In function 'int main()':
a.cc:3:1: error: 'vector' was not declared in this scope
3 | vector<int> a(1000000000);
| ^~~~~~
a.cc:3:1: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:1:
/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:3:8: error: expected primary-expression before 'int'
3 | vector<int> a(1000000000);
| ^~~
|
s915335040 | p00707 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef pair<int, int>P;
char c[80][80];
struct str {
string s;
str(string s = "") :s(s) {}
}d[80][80];
bool operator<(str a, str b) {
if (a.s.size() == b.s.size())return a.s < b.s;
return a.s.size() < b.s.size();
}
int main() {
int w, h;
while (scanf("%d%d", &w, &h), w) {
rep(i, h)scanf("%s", c[i]);
str Max = "0";
rep(i, h)rep(j, w) {
if ('0' <= c[i][j] && c[i][j] <= '9') {
d[i][j] = to_string(c[i][j] - '0');
if (i)d[i][j] = max(d[i][j], str(d[i - 1][j].s + c[i][j]));
if (j)d[i][j] = max(d[i][j], str(d[i][j - 1].s + c[i][j]));
str s = d[i][j];
while (!s.s.empty() && s.s.front() == '0')s = s.s.substr(1);
Max = max(Max, s);
}
else d[i][j] = (string)"";
}
cout << Max.s << endl;
}
} | a.cc: In function 'int main()':
a.cc:19:27: error: conversion from 'const char [2]' to non-scalar type 'str' requested
19 | str Max = "0";
| ^~~
|
s512084232 | p00707 | C++ | #include "bits/stdc++.h"
using namespace std;
#define ll long long
#define INF (1<<30)
#define LINF (1LL<<60)
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1126
#define MAXH 75
#define MAXW 75
vector<vector<string>> dp(MAXH, vector<string>(MAXW));
vector<vector<int>> f(MAXH, vector<int>(MAXW));
string ans;
int W, H;
inline bool str_check(string& a, string&b) {
if (a.size() > b.size()) return true;
else if (a.size() < b.size()) return false;
else {
int Size = a.size();
for (int i = 0; i < Size;i++) {
if (a[i] != b[i]) return a[i] > b[i] ? true : false;
}
}
return false;
}
void dfs(int h, int w, vector<vector<char>>& C) {
f[h][w] = 1;
bool dfs_f = false;
if (f[h][w - 1] == 0 && C[h][w - 1] < 'A') {
if (dp[h][w - 1] == "-") {
dp[h][w - 1] = C[h][w - 1] + dp[h][w];
dfs(h, w - 1, C);
dfs_f = true;
}
else {
if (str_check(C[h][w - 1] + dp[h][w], dp[h][w - 1])) {
dp[h][w - 1] = C[h][w - 1] + dp[h][w];
dfs(h, w - 1, C);
dfs_f = true;
}
}
}
if (f[h - 1][w] == 0 && C[h - 1][w] < 'A') {
if (dp[h - 1][w] == "-") {
dp[h - 1][w] = C[h - 1][w] + dp[h][w];
dfs(h - 1, w, C);
dfs_f = true;
}
else {
if (str_check(C[h - 1][w] + dp[h][w], dp[h - 1][w])) {
dp[h - 1][w] = C[h - 1][w] + dp[h][w];
dfs(h - 1, w, C);
dfs_f = true;
}
}
}
if (!dfs_f) {
if (str_check(dp[h][w], ans)) {
ans = dp[h][w];
}
}
}
int main() {
cin.tie(0); ios::sync_with_stdio(false);
while (cin >> W >> H) {
if (W == 0 && H == 0) break;
ans = "0";
for (int i = 0; i < MAXH; i++) for (int j = 0; j < MAXW;j++) {
dp[i][j] = "-";
f[i][j] = 0;
}
vector<vector<char>> C(H + 2, vector<char>(W + 2, 'A'));
for (int i = 1; i <= H;i++) for (int j = 1; j <= W;j++) cin >> C[i][j];
for (int i = H; i > 0; i--) {
for (int j = W; j > 0;j--) {
if (f[i][j] == 0 && C[i][j] < 'A') {
dp[i][j] = C[i][j];
dfs(i, j, C);
}
}
}
bool zefo_flag = true;
for (int i = 0; i < ans.length();i++) {
if (ans[i] == '0' && zefo_flag == true) continue;
if (ans[i] != '0') zefo_flag = false;
cout << ans[i];
}
cout << endl;
}
} | a.cc: In function 'void dfs(int, int, std::vector<std::vector<char> >&)':
a.cc:41:51: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
41 | if (str_check(C[h][w - 1] + dp[h][w], dp[h][w - 1])) {
a.cc:16:31: note: initializing argument 1 of 'bool str_check(std::string&, std::string&)'
16 | inline bool str_check(string& a, string&b) {
| ~~~~~~~~^
a.cc:58:51: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
58 | if (str_check(C[h - 1][w] + dp[h][w], dp[h - 1][w])) {
a.cc:16:31: note: initializing argument 1 of 'bool str_check(std::string&, std::string&)'
16 | inline bool str_check(string& a, string&b) {
| ~~~~~~~~^
|
s523423835 | p00707 | C++ | #include "bits/stdc++.h"
using namespace std;
#define ll long long
#define INF (1<<30)
#define LINF (1LL<<60)
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1126
#define MAXH 75
#define MAXW 75
vector<vector<string>> dp(MAXH, vector<string>(MAXW));
vector<vector<int>> f(MAXH, vector<int>(MAXW));
string ans;
int W, H;
inline bool str_check(const string& a,const string&b) {
if (a.size() > b.size()) return true;
else if (a.size() < b.size()) return false;
else {
int Size = a.size();
for (int i = 0; i < Size;i++) {
if (a[i] != b[i]) return a[i] > b[i] ? true : false;
}
}
return false;
}
void dfs(int h, int w, vector<vector<char>>& C) {
f[h][w] = 1;
bool dfs_f = false;
if (f[h][w - 1] == 0 && C[h][w - 1] < 'A') {
if (dp[h][w - 1] == "-") {
dp[h][w - 1] = C[h][w - 1] + dp[h][w];
dfs(h, w - 1, C);
dfs_f = true;
}
else {
if (str_check(C[h][w - 1] + dp[h][w], dp[h][w - 1])) {
dp[h][w - 1] = C[h][w - 1] + dp[h][w];
dfs(h, w - 1, C);
dfs_f = true;
}
}
}
if (f[h - 1][w] == 0 && C[h - 1][w] < 'A') {
if (dp[h - 1][w] == "-") {
dp[h - 1][w] = C[h - 1][w] + dp[h][w];
dfs(h - 1, w, C);
dfs_f = true;
}
else {
if (str_check(C[h - 1][w] + dp[h][w], dp[h - 1][w])) {
dp[h - 1][w] = C[h - 1][w] + dp[h][w];
dfs(h - 1, w, C);
dfs_f = true;
}
}
}
if (!dfs_f) {
if (str_check(dp[h][w], ans)) {
ans = dp[h][w];
}
}
}
int main() {
cin.tie(0); ios::sync_with_stdio(false);
while (cin >> W >> H) {
if (W == 0 && H == 0) break;
ans = "0";
for (int i = 0; i < MAXH; i++) for (int j = 0; j < MAXW;j++) {
dp[i][j] = "-";
f[i][j] = 0;
}
vector<vector<char>> C(H + 2, vector<char>(W + 2, 'A'));
for (int i = 1; i <= H;i++) for (int j = 1; j <= W;j++) cin >> C[i][j];
for (int i = H; i > 0; i--) {
for (int j = W; j > 0;j--) {
if (f[i][j] == 0 && C[i][j] < 'A') {
dp[i][j] = C[i][j];
dfs(i, j, C);
}
}
}
bool zefo_flag = true;
for (int i = 0; i < ans.length();i++) {
if (ans[i] == '0' && zefo_flag == true) continue;
if (ans[i] != '0') zefo_flag = false;
cout << ans[i];
}
cout << endl;
}
}
void dfs(int h, int w, vector<vector<char>>& C) {
f[h][w] = 1;
bool dfs_f = false;
if (f[h][w - 1] == 0 && C[h][w - 1] < 'A') {
if (dp[h][w - 1] == "-") {
dp[h][w - 1] = C[h][w - 1] + dp[h][w];
dfs(h, w - 1, C);
dfs_f = true;
}
else {
if (str_check(C[h][w - 1] + dp[h][w], dp[h][w - 1])) {
dp[h][w - 1] = C[h][w - 1] + dp[h][w];
dfs(h, w - 1, C);
dfs_f = true;
}
}
}
if (f[h - 1][w] == 0 && C[h - 1][w] < 'A') {
if (dp[h - 1][w] == "-") {
dp[h - 1][w] = C[h - 1][w] + dp[h][w];
dfs(h - 1, w, C);
dfs_f = true;
}
else {
if (str_check(C[h - 1][w] + dp[h][w], dp[h - 1][w])) {
dp[h - 1][w] = C[h - 1][w] + dp[h][w];
dfs(h - 1, w, C);
dfs_f = true;
}
}
}
if (!dfs_f) {
if (str_check(dp[h][w], ans)) {
ans = dp[h][w];
}
}
}
int main() {
cin.tie(0); ios::sync_with_stdio(false);
while (cin >> W >> H) {
if (W == 0 && H == 0) break;
ans = "0";
for (int i = 0; i < MAXH; i++) for (int j = 0; j < MAXW;j++) {
dp[i][j] = "-";
f[i][j] = 0;
}
vector<vector<char>> C(H + 2, vector<char>(W + 2, 'A'));
for (int i = 1; i <= H;i++) for (int j = 1; j <= W;j++) cin >> C[i][j];
for (int i = H; i > 0; i--) {
for (int j = W; j > 0;j--) {
if (f[i][j] == 0 && C[i][j] < 'A') {
dp[i][j] = C[i][j];
dfs(i, j, C);
}
}
}
bool zefo_flag = true;
for (int i = 0; i < ans.length();i++) {
if (ans[i] == '0' && zefo_flag == true) continue;
if (ans[i] != '0') zefo_flag = false;
cout << ans[i];
}
cout << endl;
}
} | a.cc:105:6: error: redefinition of 'void dfs(int, int, std::vector<std::vector<char> >&)'
105 | void dfs(int h, int w, vector<vector<char>>& C) {
| ^~~
a.cc:28:6: note: 'void dfs(int, int, std::vector<std::vector<char> >&)' previously defined here
28 | void dfs(int h, int w, vector<vector<char>>& C) {
| ^~~
a.cc:151:5: error: redefinition of 'int main()'
151 | int main() {
| ^~~~
a.cc:74:5: note: 'int main()' previously defined here
74 | int main() {
| ^~~~
|
s229522750 | p00707 | C++ | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int W, H;
vector<string> vs(70);
string ans;
bool checked[70][70];
bool calc(string a, string b) {
checked[h][w] = true;
if(a.length() > b.length()) return true;
if(a.length() < b.length()) return false;
else return a > b;
}
void dfs(int h, int w, string s) {
if(h < 0 || h >= H || w < 0 || w >= W || !isdigit(vs[h][w])) {
if(calc(s, ans)) ans = s;
return;
}
s += vs[h][w];
dfs(h+1,w,s);
dfs(h,w+1,s);
return;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
while(cin>>W>>H,W||H) {
FOR(i,0,H) cin >> vs[i];
ans = "";
CLR(checked);
FOR(h,0,H) {
FOR(w,0,W) {
if(checked[h][w]) continue;
checked[h][w] = true;
dfs(h, w, "");
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'bool calc(std::string, std::string)':
a.cc:25:9: error: 'h' was not declared in this scope
25 | checked[h][w] = true;
| ^
a.cc:25:12: error: 'w' was not declared in this scope
25 | checked[h][w] = true;
| ^
|
s780289777 | p00707 | C++ | #include <bits/stdc++.h>
#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VVVVI vector<vector<vector<vector<int>>>>
#define VL vector<LL>
#define VVL vector<vector<LL>>
#define VVVL vector<vector<vector<LL>>>
#define VVVVL vector<vector<vector<vector<LL>>>>
#define VB vector<bool>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14
template<class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> void print(T x) { std::cout << x << std::endl; }
inline bool inside(int y, int x, int H, int W) { return 0 <= y and y < H and 0 <= x and x < W; }
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy = { 0, 1, 0, -1 }, dx = { 1, 0, -1, 0 }; // 4近傍(右, 下, 左, 上)
using namespace std;
string big(string a, string b) {
if (a.size() < b.size()) { return b; }
if (a.size() > b.size()) { return a; }
return a > b ? a : b;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
while (true) {
int W, H;
cin >> W >> H;
if (W == 0 and H == 0) { break; }
vector<vector<int>> field(H, vector<int>(W, -1));
FOR(i, 0, H) {
string s;
cin >> s;
FOR(j, 0, s.size()) {
if (s[j] < 'A') {
field[i][j] = (s[j] - '0');
}
}
}
vector<vector<string>> dp(H, vector<string>(W));
FOR(y, 0, H) {
FOR(x, 0, W) {
if (field[y][x] == -1) {
continue;
}
// 0 startはだめ
if (dp[y][x].empty() and field[y][x] == 0) {
continue;
}
// start
if (dp[y][x].empty()) {
dp[y][x] = to_string(field[y][x]);
}
if (y + 1 < field.size() and field[y + 1][x] != -1) {
string new_c = dp[y][x] + to_string(field[y + 1][x]);
dp[y + 1][x] = big(dp[y + 1][x], new_c);
}
if (x + 1 < field[0].size() and field[y][x + 1] != -1) {
string new_c = dp[y][x] + to_string(field[y][x + 1]);
dp[y][x + 1] = big(dp[y][x + 1], new_c);
}
}
}
string ans = "";
FOR(y, 0, dp.size()) {
FOR(x, 0, dp[0].size()) {
ans = big(ans, dp[y][x]0;
}
}
print(ans);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:93:40: error: expected ')' before numeric constant
93 | ans = big(ans, dp[y][x]0;
| ~ ^
| )
|
s616552815 | p00707 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
int w, h;
string s[70];
string dp[70][70];
bool check(int i, int j, string &prev) {
if (i >= h || j >= w) return false;
if (prev.length() > 0) {
return '0' <= s[i][j] && s[i][j] <= '9';
}
return '1' <= s[i][j] && s[i][j] <= '9';
}
string Max(string &a, string &b) {
if (a.length() > b.length()) return a;
if (b.length() > a.length()) return b;
return max(a, b);
}
int main() {
int i, j;
while (cin >> w >> h) {
if (!w) break;
rep(i, h) cin >> s[i];
rep(i, h) {
rep(j, w) {
if ('1' <= s[i][j] && s[i][j] <= '9') dp[i][j] = s[i][j];
else dp[i][j] = "";
}
}
rep(i, h) {
rep(j, w) {
if (check(i + 1, j, dp[i][j])) dp[i + 1][j] = Max(dp[i + 1][j], dp[i][j] + s[i + 1][j]);
if (check(i, j + 1, dp[i][j])) dp[i][j + 1] = Max(dp[i][j + 1], dp[i][j] + s[i][j + 1]);
}
}
string ans = "";
rep(i, h) {
rep(j, w) {
ans = Max(ans, dp[i][j]);
}
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:40:106: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
40 | if (check(i + 1, j, dp[i][j])) dp[i + 1][j] = Max(dp[i + 1][j], dp[i][j] + s[i + 1][j]);
a.cc:19:31: note: initializing argument 2 of 'std::string Max(std::string&, std::string&)'
19 | string Max(string &a, string &b) {
| ~~~~~~~~^
a.cc:41:106: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
41 | if (check(i, j + 1, dp[i][j])) dp[i][j + 1] = Max(dp[i][j + 1], dp[i][j] + s[i][j + 1]);
a.cc:19:31: note: initializing argument 2 of 'std::string Max(std::string&, std::string&)'
19 | string Max(string &a, string &b) {
| ~~~~~~~~^
|
s979095824 | p00707 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
int w, h;
string s[70];
string dp[70][70];
bool check(int i, int j, string &prev) {
if (i >= h || j >= w) return false;
if (prev.length() > 0) {
return '0' <= s[i][j] && s[i][j] <= '9';
}
return '1' <= s[i][j] && s[i][j] <= '9';
}
string Max(string &a, string &b) {
if (a.length() > b.length()) return a;
if (b.length() > a.length()) return b;
return max(a, b);
}
int main() {
int i, j;
while (cin >> w >> h) {
if (!w) break;
rep(i, h) cin >> s[i];
rep(i, h) {
rep(j, w) {
if ('1' <= s[i][j] && s[i][j] <= '9') dp[i][j] = s[i][j];
else dp[i][j] = "";
}
}
rep(i, h) {
rep(j, w) {
if (check(i + 1, j, dp[i][j])) dp[i + 1][j] = Max(dp[i + 1][j], dp[i][j] + s[i + 1][j]);
if (check(i, j + 1, dp[i][j])) dp[i][j + 1] = Max(dp[i][j + 1], dp[i][j] + s[i][j + 1]);
}
}
string ans = "";
rep(i, h) {
rep(j, w) {
ans = Max(ans, dp[i][j]);
}
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:40:106: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
40 | if (check(i + 1, j, dp[i][j])) dp[i + 1][j] = Max(dp[i + 1][j], dp[i][j] + s[i + 1][j]);
a.cc:19:31: note: initializing argument 2 of 'std::string Max(std::string&, std::string&)'
19 | string Max(string &a, string &b) {
| ~~~~~~~~^
a.cc:41:106: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
41 | if (check(i, j + 1, dp[i][j])) dp[i][j + 1] = Max(dp[i][j + 1], dp[i][j] + s[i][j + 1]);
a.cc:19:31: note: initializing argument 2 of 'std::string Max(std::string&, std::string&)'
19 | string Max(string &a, string &b) {
| ~~~~~~~~^
|
s926574856 | p00707 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
using namespace std;
#define MAX 72
string ans;
char b[MAX][MAX];
int w,h;
vector<vector<string> > m;
static inline string maxstr(const string &a,const string &b){
if(a.length()!=b.length()){
if(a.length()>b.length()) return a;
else return b;
}else return max(a,b);
}
string memo(int x,int y,int d){
if(x>=w||y>=h) return "";
if(!isdigit(b[y][x])) return "";
if(!m[y][x].empty()) return m[y][x];
if(b[y][x]!='0') d++;
m[y][x]=b[y][x]+maxstr(memo(x+1,y,d),memo(x,y+1,d));
if(d==1&&b[y][x]!='0') ans=maxstr(ans,m[y][x]);
return m[y][x];
}
int main(){
while(scanf("%d%d ",&w,&h),w+h){
m=vector<vector<string> >(h,vector<string>(w));
for(int i=0;i<h;i++)
gets(b[i]);
ans="";
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(!isdigit(b[i][j])||!m[i][j].empty()||(h-i+w-j)<ans.length())
continue;
memo(j,i,0);
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:36:7: error: 'gets' was not declared in this scope; did you mean 'getw'?
36 | gets(b[i]);
| ^~~~
| getw
|
s450446677 | p00708 | Java | #include<iostream>
#include<cmath>
using namespace std;
double x[100], y[100], z[100], r[100],sum,mn,maxd=99999999.9;
int n,m,mx=(1<<20),a,b,c,t,hozon;
double map[100][100];
double sumcor;
int p[100];
double d[100];
int visited[100];
double compute(int i, int j) {
double ret;
ret = sqrt((x[i]-x[j]) * (x[i]-x[j]) + (y[i]-y[j]) * (y[i]-y[j]) + (z[i]-z[j]) * (z[i]-z[j]));
return ret;
}
int main(){
while(1){
cin>>n;
if(n==0)break;
for(int i=0;i<n;i++) {
cin>>x[i]; cin>>y[i]; cin>>z[i]; cin>>r[i];
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
map[i][j]=maxd;
}
p[i]=0;
d[i]=maxd;
visited[i]=0;
}
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
if(i==j) continue;
map[i][j] = compute(i, j);
map[i][j]-=(r[i]+r[j]);
if(map[i][j]<0)map[i][j]=0;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
// cout<<map[i][j]<<endl;
}
}
sumcor=0.0;
d[0]=0.0;
while(1){
mn=maxd;
for(int i=0;i<n;i++){
if(d[i]<mn&&visited[i]==0){
mn=d[i];
t=i;
}
}
if(mn==maxd)break;
visited[t]=1;
for(int v=0;v<n;v++){
if(map[t][v]<d[v]&&visited[v]==0){
d[v]=map[t][v];
p[v]=t;
}
}
}
for(int i=0;i<n;i++)if(map[i][p[i]]!=maxd)sumcor+=map[i][p[i]];
printf("%4.3f\n",sumcor);
}
return 0;
} | Main.java:1: error: illegal character: '#'
#include<iostream>
^
Main.java:2: error: illegal character: '#'
#include<cmath>
^
Main.java:5: error: class, interface, enum, or record expected
double x[100], y[100], z[100], r[100],sum,mn,maxd=99999999.9;
^
Main.java:6: error: class, interface, enum, or record expected
int n,m,mx=(1<<20),a,b,c,t,hozon;
^
Main.java:7: error: class, interface, enum, or record expected
double map[100][100];
^
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
double sumcor;
^
(use --enable-preview to enable unnamed classes)
Main.java:9: error: class, interface, enum, or record expected
int p[100];
^
Main.java:10: error: class, interface, enum, or record expected
double d[100];
^
Main.java:11: error: class, interface, enum, or record expected
int visited[100];
^
Main.java:23: error: not a statement
cin>>n;
^
Main.java:27: error: not a statement
cin>>x[i]; cin>>y[i]; cin>>z[i]; cin>>r[i];
^
Main.java:27: error: not a statement
cin>>x[i]; cin>>y[i]; cin>>z[i]; cin>>r[i];
^
Main.java:27: error: not a statement
cin>>x[i]; cin>>y[i]; cin>>z[i]; cin>>r[i];
^
Main.java:27: error: not a statement
cin>>x[i]; cin>>y[i]; cin>>z[i]; cin>>r[i];
^
14 errors
|
s684730544 | p00708 | C | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
double cost[101][101];
double mincost[101];
bool used[101];
double x[101], y[101], z[101], r[101];
double INF = numeric_limits<double>::max();
int main(void){
int n;
while(cin >> n && n) {
rep(i, n) {
cin >> x[i] >> y[i] >> z[i] >> r[i];
}
rep(i, n) rep(j, n) {
cost[i][j] = max(sqrt(pow(x[i]-x[j], 2.0) + pow(y[i]-y[j], 2.0) + pow(z[i]-z[j], 2.0)) - r[i] - r[j], 0.0);
}
// prim
rep(i, n) {
mincost[i] = INF;
used[i] = false;
}
mincost[0] = 0;
double res = 0;
while(true) {
int v = -1;
rep(u, n) {
if(!used[u] && (v==-1 || mincost[u] < mincost[v])) v = u;
}
if(v == -1) break;
used[v] = true;
res += mincost[v];
rep(u, n) {
mincost[u] = min(mincost[u], cost[v][u]);
}
}
printf("%.3lf\n", res);
}
}
| main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s347015954 | p00708 | C | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long int ll;
using namespace std;
struct UnionFind {
vector<int> par;
vector<int> rank;
UnionFind(int n) : par(n), rank(n, 1) {
for(int i=0; i<n; ++i) par[i] = i;
}
int find(int x) {
if (x == par[x]) return x;
return par[x] = find(par[x]);
}
void unite(int x, int y) {
x = find(x);
y = find(y);
if (x == y) return;
if (rank[x] < rank[y]) swap(x, y);
par[y] = x;
rank[x] += rank[y];
}
bool same(int x, int y) {
return find(x) == find(y);
}
};
typedef double Cost;
struct edge{
int src, dst; Cost cost;
edge(int s, int t, Cost c) : src(s), dst(t), cost(c) {}
bool operator < (const edge &rhs) const {return cost < rhs.cost;}
};
Cost kruskal(int V, vector<edge> &edges) {
UnionFind uf(V);
sort(edges.begin(), edges.end());
Cost ans = 0;
for(auto e : edges) {
if(!uf.same(e.src, e.dst)) {
uf.unite(e.src, e.dst);
ans += e.cost;
}
}
return ans;
}
int main(void) {
int n;
while(cin >> n && n) {
vector<double> x(n), y(n), z(n), r(n);
vector<edge> edges;
REP(i, n) {
cin >> x[i] >> y[i] >> z[i] >> r[i];
}
REP(i, n) {
REP(j, n) {
if(i == j) continue;
double c = sqrt(pow(x[i]-x[j], 2.0) + pow(y[i]-y[j], 2.0) + pow(z[i]-z[j], 2.0)) - r[i] - r[j];
edges.push_back(edge(i, j, max(0.0, c)));
}
}
printf("%.3f\n", kruskal(n, edges));
}
}
| main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s369880505 | p00708 | C | /**********************
*@Name:
*
*@Author: Nervending
*@Describtion:
*@DateTime: 2017-10-16 19:48:25
***********************/
#include <iostream>
#include <string.h>
#include <algorithm>
#include <math.h>
using namespace std;
const int maxn=1e2+10;
const int maxm=1e4+1000;
int root[maxn];
struct node {
int from,to;
double cost;
}e[maxm];
bool cmp (node &a,node &b){
return a.cost<b.cost;
}
int find (int a){
if(root[a]==a)return a;
else return root[a]=find(root[a]);
}
#define same(a,b) (find(a)==find(b))
void unite(int a,int b){
a=find(a);
b=find(b);
root[a]=b;
}
double x[maxn],y[maxn],z[maxn],r[maxn];
int n,m,nume;
double ans;
void init(){
memset(e,0,sizeof e);
for(int i=0;i<maxn;i++){
root[i]=i;
}
ans=0;
nume=0;
}
void kruskal(){
for(int i=0;i<nume;i++){
int a=e[i].from,b=e[i].to;
if(!same(a,b)){
unite(a,b);
ans+=e[i].cost;
}
}
}
double dst(int a,int b){
double dx=(x[a]-x[b]);
double dy=(y[a]-y[b]);
double dz=(z[a]-z[b]);
double d=sqrt(dx*dx+dy*dy+dz*dz);
double dr=r[a]+r[b];
if(d>=dr)return d-dr;
else return -1;
}
int main(){
// freopen("in.txt","r",stdin);
while(~scanf("%d",&n)&&n){
init();
for(int i=0;i<n;i++){
scanf("%lf%lf%lf%lf",&x[i],&y[i],&z[i],&r[i]);
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
double cost=dst(i,j);
if(cost>0){
node t={i,j,cost};
e[nume++]=t;
}
else {
node t={i,j,0};
e[nume++]=t;
}
}
}
sort(e,e+nume,cmp);
kruskal();
printf("%.3lf\n",ans);
}
} | main.c:8:10: fatal error: iostream: No such file or directory
8 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s050126103 | p00708 | C | //kruskal tree
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 9999
int parent[M],a[M],b[M];
pair<double,int>node[M];
int root(int a){return parent[a]==a?a:parent[a]=root(parent[a]);}
int unite(int a,int b){
int x=root(a),y=root(b);
if(x==y)return 0;
parent[x]=y;
return 1;
}
int main(){
int i,j,k,m,n;
double x,y,z,r;
for(;cin>>n,n;){
vector<vector<double> >v;
for(i=0;i<n;i++)cin>>x>>y>>z>>r,v.push_back({x,y,z,r});
for(i=0;i<n;i++)parent[i]=i;
for(m=i=0;i<n;i++)for(j=i+1;j<n;j++){
for(x=k=0;k<3;k++)x+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
x=sqrt(x)-v[i][3]-v[j][3];
if(x<=0)unite(i,j);
else a[m]=i,b[m]=j,node[m].first=x,node[m].second=m++;
}
sort(node,node+m);
for(x=i=0;i<m;i++)if(unite(a[node[i].second],b[node[i].second]))x+=std::max(.0,node[i].first);
cout<<x<<endl;
}
} | main.c:2:10: fatal error: iostream: No such file or directory
2 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s480093454 | p00708 | C | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct {
double x, y, z, r;
} Coord;
typedef struct {
int from, to;
double weight;
} Edge;
Coord coord[ 100 ];
int parent[ 100 ];
Edge edge[ 4950 ];
int compare( const void *a, const void *b ) {
double at = (*(Edge *)a).weight, bt = (*(Edge *)b).weight;
if ( at < bt )
return -1;
else
return 1;
}
int find( int x ) {
if ( parent[ x ] == x )
return x;
else
return parent[ x ] = find( parent[ x ] );
}
void union( int x, int y ) {
parent[ find( y ) ] = find( x );
}
int kruskal( int v, int e ) {
int i;
double sum;
qsort( edge, e, sizeof(Edge), &compare );
for ( i = 0; i < v; i++ )
parent[ i ] = i;
sum = 0.0;
for ( i = 0; i < e; i++ )
if ( find( edge[ i ].from ) != find( edge[ i ].to ) ) {
union( edge[ i ].from, edge[ i ].to );
sum += edge[ i ].weight;
}
return sum;
}
int main( void ) {
int i, j;
int n;
while ( scanf( "%d", &n ), n ) {
int cnt;
double sum;
for ( i = 0; i < n; i++ )
scanf( "%lf %lf %lf %lf", &coord[ i ].x, &coord[ i ].y, &coord[ i ].z, &coord[ i ].r );
cnt = 0;
for ( i = 0; i < n; i++ )
for ( j = i + 1; j < n; j++ ) {
edge[ cnt ].from = i;
edge[ cnt ].to = j;
edge[ cnt ].weight = fmax( hypot( hypot( coord[ i ].x - coord[ j ].x, coord[ i ].y - coord[ j ].y ), coord[ i ].z - coord[ j ].z ) - coord[ i ].r - coord[ j ].r, 0.0 );
cnt++;
}
printf( "%.3f\n", kruskal( n, cnt ) );
}
return 0;
} | main.c:33:11: error: expected '{' before '(' token
33 | void union( int x, int y ) {
| ^
main.c:33:6: error: two or more data types in declaration specifiers
33 | void union( int x, int y ) {
| ^~~~~
main.c: In function 'kruskal':
main.c:49:30: error: expected '{' before '(' token
49 | union( edge[ i ].from, edge[ i ].to );
| ^
|
s983224595 | p00708 | C++ | 3
10.000 10.000 50.000 10.000
40.000 10.000 50.000 10.000
40.000 40.000 50.000 10.000
2
30.000 30.000 30.000 20.000
40.000 40.000 40.000 20.000
5
5.729 15.143 3.996 25.837
6.013 14.372 4.818 10.671
80.115 63.292 84.477 15.120
64.095 80.924 70.029 14.881
39.472 85.116 71.369 5.553
0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 3
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.