submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s940978013 | p00088 | C++ | #include <iostream>
#include <string>
std::string encode(char c){
if(c == ' ') return "101";
if(c == '\'') return "000000";
if(c == ',') return "000011";
if(c == '-') return "10010001";
if(c == '.') return "010001";
if(c == '?') return "000001";
if(c == 'A') return "100101";
if(c == 'B') return "10011010";
if(c == 'C') return "0101";
if(c == 'D') return "0001";
if(c == 'E') return "110";
if(c == 'F') return "01001";
if(c == 'G') return "10011011";
if(c == 'H') return "010000";
if(c == 'I') return "0111";
if(c == 'J') return "10011000";
if(c == 'K') return "0110";
if(c == 'L') return "00100";
if(c == 'M') return "10011001";
if(c == 'N') return "10011110";
if(c == 'O') return "00101";
if(c == 'P') return "111";
if(c == 'Q') return "10011111";
if(c == 'R') return "1000";
if(c == 'S') return "00110";
if(c == 'T') return "00111";
if(c == 'U') return "10011100";
if(c == 'V') return "10011101";
if(c == 'W') return "000010";
if(c == 'X') return "10010010";
if(c == 'Y') return "10010011";
if(c == 'Z') return "10010000";
return "";
}
std::string encode2(std::string s){
if(s == "00000") return "A";
if(s == "00001") return "B";
if(s == "00010") return "C";
if(s == "00011") return "D";
if(s == "00100") return "E";
if(s == "00101") return "F";
if(s == "00110") return "G";
if(s == "00111") return "H";
if(s == "01000") return "I";
if(s == "01001") return "J";
if(s == "01010") return "K";
if(s == "01011") return "L";
if(s == "01100") return "M";
if(s == "01101") return "N";
if(s == "01110") return "O";
if(s == "01111") return "P";
if(s == "10000") return "Q"
if(s == "10001") return "R";
if(s == "10010") return "S";
if(s == "10011") return "T";
if(s == "10100") return "U";
if(s == "10101") return "V";
if(s == "10110") return "W";
if(s == "10111") return "X";
if(s == "11000") return "Y";
if(s == "11001") return "Z";
if(s == "11010") return " ";
if(s == "11011") return ".";
if(s == "11100") return ",";
if(s == "11101") return "-";
if(s == "11110") return "'";
if(s == "11111") return "?";
return "";
}
int main(){
std::string str, tmp, ans;
while(getline(std::cin, str)){
tmp = "", ans = "";
for(int i = 0; i < str.size(); i++){
tmp += encode(str[i]);
}
int n = 5 - (tmp.size() % 5);
for(int i = 0; i < n; i++) tmp += "0";
for(int i = 0; i < tmp.size() / 5; i++){
ans += encode2(tmp.substr(i * 5, 5));
}
std::cout << ans << std::endl;
}
return 0;
} | a.cc: In function 'std::string encode2(std::string)':
a.cc:58:32: error: expected ';' before 'if'
58 | if(s == "10000") return "Q"
| ^
| ;
59 | if(s == "10001") return "R";
| ~~
|
s134308359 | p00088 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
string DoctorTableAD(char c){
string s;
switch( c ){
case ' ': s = "101"; break;
case 0x27: s = "000000"; break;
case ',': s = "000011"; break;
case '-': s = "10010001"; break;
case '.': s = "010001"; break;
case '?': s = "000001"; break;
case 'A': s = "100101"; break;
case 'B': s = "10011010"; break;
case 'C': s = "0101"; break;
case 'D': s = "0001"; break;
case 'E': s = "110"; break;
case 'F': s = "01001"; break;
case 'G': s = "10011011"; break;
case 'H': s = "010000"; break;
case 'I': s = "0111"; break;
case 'J': s = "10011000"; break;
case 'K': s = "0110"; break;
case 'L': s = "00100"; break;
case 'M': s = "10011001"; break;
case 'N': s = "10011110"; break;
case 'O': s = "00101"; break;
case 'P': s = "111"; break;
case 'Q': s = "10011111"; break;
case 'R': s = "1000"; break;
case 'S': s = "00110"; break;
case 'T': s = "00111"; break;
case 'U': s = "10011100"; break;
case 'V': s = "10011101"; break;
case 'W': s = "000010"; break;
case 'X': s = "10010010"; break;
case 'Y': s = "10010011"; break;
case 'Z': s = "10010000"; break;
}
return s;
}
int myatoi(string bin_s){
int ret = 0;
while( bin_s.length() > 0 ){
ret += (int)((bin_s[0] - '0') * pow(2.0, (double)(bin_s.length() - 1)));
bin_s.erase(0,1);
}
return ret;
}
char DoctorTableDA(string &s){
int d = myatoi(s);
char ac[] = " .,-'?";
for(int i = 0; i < 'Z' - 'A'; i++) if(d == i) return i + 'A';
for(int i = 0; i < sizeof(ac)/sizeof(*ac); i++) if(i + 26 == d) return ac[i];
return ' ';
}
string DoctorLovedEncode(string &raw){
string s;
string ret;
for(unsigned int i = 0; i < raw.length(); i++){
s += DoctorTableAD(raw[i]);
}
// padding
while( s.length() % 5 != 0 ) s += '0';
for(unsigned int i = 0; i < s.length() / 5; i++){
ret += DoctorTableDA( s.substr(i*5,5) );
}
return ret;
}
int main(void){
while(true){
string s;
while( true ){
char c;
c = cin.get();
if( cin.eof() ) return 0;
if( c == '\n') break;
else s += c;
}
cout << DoctorLovedEncode( s ) << endl;
}
return 0;
} | a.cc: In function 'std::string DoctorLovedEncode(std::string&)':
a.cc:72:47: 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>'
72 | ret += DoctorTableDA( s.substr(i*5,5) );
| ~~~~~~~~^~~~~~~
a.cc:54:28: note: initializing argument 1 of 'char DoctorTableDA(std::string&)'
54 | char DoctorTableDA(string &s){
| ~~~~~~~~^
|
s236447256 | p00088 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <map>
using namespace std;
string mkzero(int len) {
char str[80];
sprintf(str, "%0*d", len, 0);
return string(str);
}
int main() {
const char * fromA = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char * toA[] = {
"101",
"000000",
"000011",
"10010001",
"010001",
"000001",
"100101",
"10011010",
"0101",
"0001",
"110",
"01001",
"10011011",
"010000",
"0111",
"10011000",
"0110",
"00100",
"10011001",
"10011110",
"00101",
"111",
"1001111",
"1000",
"00110",
"00111",
"10011100",
"10011101",
"000010",
"10010010",
"10010011",
"10010000",
""
};
const char * fromB[] = {
"00000",
"00001",
"00010",
"00011",
"00100",
"00101",
"00110",
"00111",
"01000",
"01001",
"01010",
"01011",
"01100",
"01101",
"01110",
"01111",
"10000",
"10001",
"10010",
"10011",
"10100",
"10101",
"10110",
"10111",
"11000",
"11001",
"11010",
"11011",
"11100",
"11101",
"11110",
"11111",
""
};
const char * toB = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
map<char, string> enc;
for(int i = 0, len = strlen(fromA); i < len; i++) {
enc.insert(make_pair(fromA[i], string(toA[i])));
}
map<string, char> dec;
for(int i = 0, len = strlen(toB); i < len; i++) {
dec.insert(make_pair(string(fromB[i]), toB[i]));
}
#if 0
for(map<char, string>::const_iterator it = enc.begin(); it != enc.end(); ++it) {
cerr << it->first << " -> " << it->second << endl;
}
for(map<string, char>::const_iterator it = dec.begin(); it != dec.end(); ++it) {
cerr << it->first << " -> " << it->second << endl;
}
#endif
for(string line; getline(cin, line); ) {
ostringstream ss;
for(int i = 0; i < (int)line.length(); i++)
ss << enc[line[i]];
if(ss.str().size() % 5 > 0) ss << mkzero(5 - ss.str().size() % 5);
for(int i = 0; i < (int)ss.str().size() / 5; i++) {
cout << dec[ss.str().substr(5*i, 5)];
}
cout << endl;
}
} | a.cc: In function 'int main()':
a.cc:91:26: error: 'strlen' was not declared in this scope
91 | for(int i = 0, len = strlen(fromA); i < len; i++) {
| ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <map>
+++ |+#include <cstring>
6 | using namespace std;
a.cc:96:26: error: 'strlen' was not declared in this scope
96 | for(int i = 0, len = strlen(toB); i < len; i++) {
| ^~~~~~
a.cc:96:26: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s612698260 | p00088 | C++ | include <iostream>
#include <string>
using namespace std;
int main(){
string map[1000];
map['A']="100101"; map['B']="10011010"; map['C']="0101"; map['D']="0001";
map['E']="110"; map['F']="01001"; map['G']="10011011"; map['H']="010000";
map['I']="0111"; map['J']="10011000"; map['K']="0110"; map['L']="00100";
map['M']="10011001"; map['N']="10011110"; map['O']="00101"; map['P']="111";
map['Q']="10011111"; map['R']="1000"; map['S']="00110"; map['T']="00111";
map['U']="10011100"; map['V']="10011101"; map['W']="000010"; map['X']="10010010";
map['Y']="10010011"; map['Z']="1001000"; map[' ']="101"; map['\'']="000000";
map[',']="000011"; map['-']="10010001"; map['.']="010001",map['?']="000001";
string alpha[]={"00000","00001","00010","00011","00100","00101","00110","00111",
"01000","01001","01010","01011","01100","01101","01110","01111",
"10000","10001","10010","10011","10100","10101","10110","10111",
"11000","11001","11010","11011","11100","11101","11110","11111"};
string altmp="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
string line,chli,ans;
getline(cin,line);
for(int i=0;i<line.size();i++){
chli += map[line[i]];
}
if(chli.size() % 5 != 0) chli.append(5-chli.size()%5,'0');
for(int i=0;i<chli.size();i+=5){
string tmp = chli.substr(i,5);
for(int j=0;j<32;j++){
if(tmp == alpha[j]) ans += altmp[j];
}
}
cout<< ans << endl;
} | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/char_traits.h:50:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~
| __n
/usr/include/c++/14/bits/char_traits.h: At global scope:
/usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type
198 | _GLIBCXX14_CONSTEXPR std::size_t
| |
s117621216 | p00089 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
static int[][] diamond = null;
static int[][] max = null;
static int[] tmpMax = null;
static int height = -1;
static int width = -1;
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> array = new ArrayList<String>();
try {
String str = null;
while ((str = br.readLine()) != null && !str.equals("")) {
array.add(str);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
width = array.size() / 2 + 1;
height = array.size();
diamond = new int[height][width];
max = new int[height][width];
for (int i = 0; i < height; i++) {
String s = array.get(i);
String[] data = s.split(",");
for (int j = 0; j < data.length; j++) {
diamond[i][j] = Integer.parseInt(data[j]);
}
}
bfs();
System.out.println(max[height - 1][0]);
}
private static void bfs() {
max[0][0] = diamond[0][0];
//前半
for (int i = 1; i < width; i++) {
for (int j = 0; j <= i; j++) {
if (j == 0)
max[i][j] = diamond[i][j] + max[i - 1][j];
else if (j == i)
max[i][j] = diamond[i][j] + max[i - 1][j - 1];
else {
max[i][j] = diamond[i][j]
+ Math.max(max[i - 1][j], max[i - 1][j - 1]);
}
}
}
//後半
for (int i = width; i < height; i++) {
for (int j = 0; j <= (height - i - 1); j++) {
max[i][j] = diamond[i][j]
+ Math.max(max[i - 1][j], max[i - 1][j + 1]);
}
}
}
} | Main.java:6: error: illegal character: '\u3000'
public class?Main {
^
1 error
|
s930827282 | p00089 | C | t[55],y[55],n,x,z,i;
main(){
for(;n-2||!z++;){
for(i=1;i<2||getchar()==44;scanf("%d",y+i++));
if(i>n)
for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]);
else
for(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]);
}
n=!printf("%d\n",t[1]);
} | main.c:1:1: warning: data definition has no type or storage class
1 | t[55],y[55],n,x,z,i;
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
main.c:1:7: error: type defaults to 'int' in declaration of 'y' [-Wimplicit-int]
1 | t[55],y[55],n,x,z,i;
| ^
main.c:1:13: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
1 | t[55],y[55],n,x,z,i;
| ^
main.c:1:15: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
1 | t[55],y[55],n,x,z,i;
| ^
main.c:1:17: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int]
1 | t[55],y[55],n,x,z,i;
| ^
main.c:1:19: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
1 | t[55],y[55],n,x,z,i;
| ^
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(){
| ^~~~
main.c: In function 'main':
main.c:4:30: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
4 | for(i=1;i<2||getchar()==44;scanf("%d",y+i++));
| ^~~~~~~
main.c:1:1: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
+++ |+#include <stdio.h>
1 | t[55],y[55],n,x,z,i;
main.c:4:44: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
4 | for(i=1;i<2||getchar()==44;scanf("%d",y+i++));
| ^~~~~
main.c:4:44: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:4:44: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:4:44: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:6:47: error: implicit declaration of function 'fmax' [-Wimplicit-function-declaration]
6 | for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]);
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'fmax'
+++ |+#include <math.h>
1 | t[55],y[55],n,x,z,i;
main.c:6:47: warning: incompatible implicit declaration of built-in function 'fmax' [-Wbuiltin-declaration-mismatch]
6 | for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]);
| ^~~~
main.c:6:47: note: include '<math.h>' or provide a declaration of 'fmax'
main.c:6:64: error: expected ')' before ';' token
6 | for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]);
| ~ ^
| )
main.c:11:1: error: expected expression before '}' token
11 | }
| ^
main.c:11:1: error: expected declaration or statement at end of input
|
s165614181 | p00089 | C | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);} | main.c:1:1: warning: data definition has no type or storage class
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
main.c:1:7: error: type defaults to 'int' in declaration of 'y' [-Wimplicit-int]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^
main.c:1:13: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^
main.c:1:15: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^
main.c:1:17: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^
main.c:1:19: error: return type defaults to 'int' [-Wimplicit-int]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^~~~
main.c: In function 'main':
main.c:1:19: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:57: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^~~~~~~
main.c:1:1: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
+++ |+#include <stdio.h>
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
main.c:1:71: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^~~~~
main.c:1:71: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:71: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:1:71: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:119: error: implicit declaration of function 'fmax' [-Wimplicit-function-declaration]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'fmax'
+++ |+#include <math.h>
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
main.c:1:119: warning: incompatible implicit declaration of built-in function 'fmax' [-Wbuiltin-declaration-mismatch]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^~~~
main.c:1:119: note: include '<math.h>' or provide a declaration of 'fmax'
main.c:1:138: error: implicit declaration of function 'elsefor' [-Wimplicit-function-declaration]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^~~~~~~
main.c:1:153: error: expected ')' before ';' token
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ~ ^
| )
main.c:1:193: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | t[55],y[55],n,x,z;main(i){for(;n-2||!z++;){for(i=1;i<2||getchar()==44;scanf("%d",y+i++));if(i>n)for(n=i;--i;t[i]=y[i]+fmax(t[i],t[i-1]));elsefor(n=i,i=0;i++<n;t[i]=y[i]+fmax(t[i],t[i+1]));}n=!printf("%d\n",t[1]);}
| ^~~~~~
main.c:1:193: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:193: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:193: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s124132497 | p00089 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> v;
int ret = 0;
void f(int n, int x, int y){
if(x == v.size()-1) ret = max(ret, n+v[x][y]);
else {
for(int i=0; i <= 1; i++){
if(0 <= y+i && y+i < v[x+1].size()) f(n+v[x][y], x+1, y+i);
}
}
}
int main(){
string s;
int m = 0;
while(cin >> s){
vector<int> a;
while(s.size() != 0){
if(s.find(",") == -1){a.push_back(stoi(s)); break;}
else {a.push_back(stoi(s.substr(0, s.find(",")))); s = s.substr(s.find(",")+1);}
}
m = max(m, (int)a.size());
if(a.size() < m){
int p = a.size();
for(int i=0; i < m-p; i++) a.push_back(0);
for(int i=p-1; 0 <= i; i--) a[i+(m-p)] = a[i];
for(int i=0; i < m-p; i++) a[i] = 0;
}
v.push_back(a);
}
for(int i=0; i < v.size(); i++){
for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
cout << endl;
}
f(0, 0, 0);
cout << ret << endl;
} | a.cc: In function 'int main()':
a.cc:37:60: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'const char [2]')
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~ ~~~
| |
| const char [2]
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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [2]'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [2]'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h: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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bi |
s383584357 | p00089 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> v;
int ret = 0;
void f(int n, int x, int y){
if(x == v.size()-1) ret = max(ret, n+v[x][y]);
else {
for(int i=0; i <= 1; i++){
if(0 <= y+i && y+i < v[x+1].size()) f(n+v[x][y], x+1, y+i);
}
}
}
int main(){
string s;
int m = 0;
while(cin >> s){
vector<int> a;
while(s.size() != 0){
if(s.find(",") == -1){a.push_back(stoi(s)); break;}
else {a.push_back(stoi(s.substr(0, s.find(",")))); s = s.substr(s.find(",")+1);}
}
m = max(m, (int)a.size());
if(a.size() < m){
int p = a.size();
for(int i=0; i < m-p; i++) a.push_back(0);
for(int i=p-1; 0 <= i; i--) a[i+(m-p)] = a[i];
for(int i=0; i < m-p; i++) a[i] = 0;
}
v.push_back(a);
}
for(int i=0; i < v.size(); i++){
for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
cout << endl;
}
f(0, 0, 0);
cout << ret << endl;
} | a.cc: In function 'int main()':
a.cc:37:60: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'const char [2]')
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~ ~~~
| |
| const char [2]
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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [2]'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [2]'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h: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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
/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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
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:37:63: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>'
37 | for(int j=0; j < v[i].size(); j++) cout << v[i][j] == " ";
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bi |
s080373404 | p00089 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int d[10000];
int dp[100];
int dpw[100];
char w[1000];
int main()
{
int n = 0;
while(NULL != gets(w))
{
char* p = strtok(w,",");
d[n] = atoi(p);
n++;
while(NULL != (p = strtok(NULL,",")))
{
d[n] = atoi(p);
n++;
}
}
int k;
int now = 0;
for(int i = 1; i <= 50; i++)
{
if(now + i == n)
{
k = i;
break;
}
now += i * 2;
}
dp[0] = d[0];
now = 1;
for(int i = 2; i <= k; i++)
{
dpw[0] = dp[0] + d[now];
for(int j = 1; j < i - 1; j++) dpw[j] = max(dp[j - 1] + d[now + j],dp[j] + d[now + j]);
dpw[i - 1] = dp[i - 2] + d[now + i - 1];
for(int j = 0; j < i; j++) dp[j] = dpw[j];
now += i;
}
for(int i = k - 1; i > 0; i--)
{
for(int j = 0; j < i; j++) dpw[j] = max(dp[j] + d[now + j],dp[j + 1] + d[now + j]);
for(int j = 0; j < i; j++) dp[j] = dpw[j];
now += i;
}
printf("%d\n",dp[0]);
return 0;
} | a.cc: In function 'int main()':
a.cc:17:23: error: 'gets' was not declared in this scope; did you mean 'getw'?
17 | while(NULL != gets(w))
| ^~~~
| getw
a.cc:19:27: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
19 | char* p = strtok(w,",");
| ^~~~~~
| strtoq
|
s878271437 | p00089 | C++ | using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Threading;
class Program
{
public const int Inf = 1 << 29;
private static int[,] dp = new int[100,100];
private static int[,] arrayList = new int[100,100];
private static int cnt = 0;
static void Main()
{
int now = 0;
string line;
for (int i = 0; i < 100; ++i) {
for (int j = 0; j < 100; j++) {
dp[i, j] = -1;
arrayList[i, j] = -1;
}
}
while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
string[] s = line.Split(',');
for (int i = 0; i < s.Length; i++)
{
arrayList[cnt, i] = int.Parse(s[i]);
}
cnt++;
}
Console.WriteLine(solve(0, 0));
}
static int solve(int a, int b)
{
if (cnt == a)
{
return 0;
}
if (b < 0 || arrayList[a,b] == -1)
{
return 0;
}
if (dp[a,b] >= 0)
{
return dp[a,b];
}
int res = 0;
if (cnt / 2 >= a)
{
res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
}
else
{
res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
}
return dp[a,b] = res;
}
} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Text;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Collections;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Collections.Generic;
| ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
6 | using System.Linq;
| ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'System'
7 | using System.Text.RegularExpressions;
| ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'System'
8 | using System.Diagnostics;
| ^~~~~~
a.cc:9:7: error: expected nested-name-specifier before 'System'
9 | using System.Threading;
| ^~~~~~
a.cc:14:15: error: expected ':' before 'const'
14 | public const int Inf = 1 << 29;
| ^~~~~~
| :
a.cc:15:16: error: expected ':' before 'static'
15 | private static int[,] dp = new int[100,100];
| ^~~~~~~
| :
a.cc:15:27: error: expected unqualified-id before '[' token
15 | private static int[,] dp = new int[100,100];
| ^
a.cc:16:16: error: expected ':' before 'static'
16 | private static int[,] arrayList = new int[100,100];
| ^~~~~~~
| :
a.cc:16:27: error: expected unqualified-id before '[' token
16 | private static int[,] arrayList = new int[100,100];
| ^
a.cc:17:16: error: expected ':' before 'static'
17 | private static int cnt = 0;
| ^~~~~~~
| :
a.cc:17:28: error: ISO C++ forbids in-class initialization of non-const static member 'Program::cnt'
17 | private static int cnt = 0;
| ^~~
a.cc:68:2: error: expected ';' after class definition
68 | }
| ^
| ;
a.cc: In static member function 'static void Program::Main()':
a.cc:22:17: error: 'string' was not declared in this scope
22 | string line;
| ^~~~~~
a.cc:25:33: error: 'dp' was not declared in this scope
25 | dp[i, j] = -1;
| ^~
a.cc:26:33: error: 'arrayList' was not declared in this scope
26 | arrayList[i, j] = -1;
| ^~~~~~~~~
a.cc:29:46: error: 'line' was not declared in this scope
29 | while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
| ^~~~
a.cc:29:53: error: 'Console' was not declared in this scope
29 | while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
| ^~~~~~~
a.cc:30:32: error: expected primary-expression before ']' token
30 | string[] s = line.Split(',');
| ^
a.cc:32:45: error: 's' was not declared in this scope
32 | for (int i = 0; i < s.Length; i++)
| ^
a.cc:34:33: error: 'arrayList' was not declared in this scope
34 | arrayList[cnt, i] = int.Parse(s[i]);
| ^~~~~~~~~
a.cc:34:53: error: expected primary-expression before 'int'
34 | arrayList[cnt, i] = int.Parse(s[i]);
| ^~~
a.cc:39:17: error: 'Console' was not declared in this scope
39 | Console.WriteLine(solve(0, 0));
| ^~~~~~~
a.cc: In static member function 'static int Program::solve(int, int)':
a.cc:49:30: error: 'arrayList' was not declared in this scope
49 | if (b < 0 || arrayList[a,b] == -1)
| ^~~~~~~~~
a.cc:53:21: error: 'dp' was not declared in this scope
53 | if (dp[a,b] >= 0)
| ^~
a.cc:60:31: error: 'Math' was not declared in this scope
60 | res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
| ^~~~
a.cc:60:58: error: 'arrayList' was not declared in this scope
60 | res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
| ^~~~~~~~~
a.cc:64:31: error: 'Math' was not declared in this scope
64 | res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
| ^~~~
a.cc:64:58: error: 'arrayList' was not declared in this scope
64 | res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
| ^~~~~~~~~
a.cc:66:24: error: 'dp' was not declared in this scope
66 | return dp[a,b] = res;
| ^~
|
s285009278 | p00089 | C++ | using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Threading;
class Program
{
public const int Inf = 1 << 29;
private static int[,] dp = new int[100,100];
private static int[,] arrayList = new int[100,100];
private static int cnt = 0;
static void Main()
{
string line;
for (int i = 0; i < 100; ++i) {
for (int j = 0; j < 100; j++) {
dp[i, j] = -1;
arrayList[i, j] = -1;
}
}
while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
string[] s = line.Split(',');
for (int i = 0; i < s.Length; i++)
{
arrayList[cnt, i] = int.Parse(s[i]);
}
cnt++;
}
Console.WriteLine(solve(0, 0));
}
static int solve(int a, int b)
{
if (cnt == a)
{
return 0;
}
if (b < 0 || arrayList[a,b] == -1)
{
return 0;
}
if (dp[a,b] >= 0)
{
return dp[a,b];
}
int res = 0;
if (cnt / 2 >= a)
{
res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
}
else
{
res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
}
return dp[a,b] = res;
}
} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Text;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Collections;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Collections.Generic;
| ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
6 | using System.Linq;
| ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'System'
7 | using System.Text.RegularExpressions;
| ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'System'
8 | using System.Diagnostics;
| ^~~~~~
a.cc:9:7: error: expected nested-name-specifier before 'System'
9 | using System.Threading;
| ^~~~~~
a.cc:14:15: error: expected ':' before 'const'
14 | public const int Inf = 1 << 29;
| ^~~~~~
| :
a.cc:15:16: error: expected ':' before 'static'
15 | private static int[,] dp = new int[100,100];
| ^~~~~~~
| :
a.cc:15:27: error: expected unqualified-id before '[' token
15 | private static int[,] dp = new int[100,100];
| ^
a.cc:16:16: error: expected ':' before 'static'
16 | private static int[,] arrayList = new int[100,100];
| ^~~~~~~
| :
a.cc:16:27: error: expected unqualified-id before '[' token
16 | private static int[,] arrayList = new int[100,100];
| ^
a.cc:17:16: error: expected ':' before 'static'
17 | private static int cnt = 0;
| ^~~~~~~
| :
a.cc:17:28: error: ISO C++ forbids in-class initialization of non-const static member 'Program::cnt'
17 | private static int cnt = 0;
| ^~~
a.cc:66:2: error: expected ';' after class definition
66 | }
| ^
| ;
a.cc: In static member function 'static void Program::Main()':
a.cc:20:17: error: 'string' was not declared in this scope
20 | string line;
| ^~~~~~
a.cc:23:33: error: 'dp' was not declared in this scope
23 | dp[i, j] = -1;
| ^~
a.cc:24:33: error: 'arrayList' was not declared in this scope
24 | arrayList[i, j] = -1;
| ^~~~~~~~~
a.cc:27:46: error: 'line' was not declared in this scope
27 | while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
| ^~~~
a.cc:27:53: error: 'Console' was not declared in this scope
27 | while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
| ^~~~~~~
a.cc:28:32: error: expected primary-expression before ']' token
28 | string[] s = line.Split(',');
| ^
a.cc:30:45: error: 's' was not declared in this scope
30 | for (int i = 0; i < s.Length; i++)
| ^
a.cc:32:33: error: 'arrayList' was not declared in this scope
32 | arrayList[cnt, i] = int.Parse(s[i]);
| ^~~~~~~~~
a.cc:32:53: error: expected primary-expression before 'int'
32 | arrayList[cnt, i] = int.Parse(s[i]);
| ^~~
a.cc:37:17: error: 'Console' was not declared in this scope
37 | Console.WriteLine(solve(0, 0));
| ^~~~~~~
a.cc: In static member function 'static int Program::solve(int, int)':
a.cc:47:30: error: 'arrayList' was not declared in this scope
47 | if (b < 0 || arrayList[a,b] == -1)
| ^~~~~~~~~
a.cc:51:21: error: 'dp' was not declared in this scope
51 | if (dp[a,b] >= 0)
| ^~
a.cc:58:31: error: 'Math' was not declared in this scope
58 | res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
| ^~~~
a.cc:58:58: error: 'arrayList' was not declared in this scope
58 | res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]);
| ^~~~~~~~~
a.cc:62:31: error: 'Math' was not declared in this scope
62 | res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
| ^~~~
a.cc:62:58: error: 'arrayList' was not declared in this scope
62 | res = Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
| ^~~~~~~~~
a.cc:64:24: error: 'dp' was not declared in this scope
64 | return dp[a,b] = res;
| ^~
|
s413859239 | p00089 | C++ | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string s; vector<vector<int> > v; int s[100][100], dp[100][100];
vector<int> parse(string s) {
vector<int> ret; int v = 0;
for(int i = 0; i < s.size(); i++) {
if(s[i] == ',') ret.push_back(v), v = 0;
else v = v * 10 + s[i] - 48;
}
ret.push_back(v);
return ret;
}
int main() {
while(cin >> s) v.push_back(parse(s));
int n = v.size() / 2 + 1;
for(int i = 0; i < n; i++) {
for(int j = 0; j < v[i].size(); j++) {
s[i - j][j] = v[i][j];
}
}
for(int i = n; i < v.size(); i++) {
for(int j = 0; j < v[i].size(); j++) {
s[i - (j + n - v[i].size())][j + n - v[i].size()] = v[i][j];
}
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(i + j) dp[i][j] = 999999999;
if(i) dp[i][j] = dp[i - 1][j];
if(j) dp[i][j] = min(dp[i][j], dp[i][j - 1]);
}
}
cout << dp[n - 1][n - 1] << endl;
} | a.cc:6:39: error: conflicting declaration 'int s [100][100]'
6 | string s; vector<vector<int> > v; int s[100][100], dp[100][100];
| ^
a.cc:6:8: note: previous declaration as 'std::string s'
6 | string s; vector<vector<int> > v; int s[100][100], dp[100][100];
| ^
a.cc: In function 'int main()':
a.cc:21:33: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
21 | s[i - j][j] = v[i][j];
| ^
a.cc:26:53: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[std::vector<int>::size_type {aka long unsigned int}]' for array subscript
26 | s[i - (j + n - v[i].size())][j + n - v[i].size()] = v[i][j];
| ^
|
s120193941 | p00089 | C++ | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string s; vector<vector<int> > v; int t[100][100], dp[100][100];
vector<int> parse(string s) {
vector<int> ret; int v = 0;
for(int i = 0; i < s.size(); i++) {
if(s[i] == ',') ret.push_back(v), v = 0;
else v = v * 10 + s[i] - 48;
}
ret.push_back(v);
return ret;
}
int main() {
while(cin >> s) v.push_back(parse(s));
int n = v.size() / 2 + 1;
for(int i = 0; i < n; i++) {
for(int j = 0; j < v[i].size(); j++) {
t[i - j][j] = v[i][j];
}
}
for(int i = n; i < v.size(); i++) {
for(int j = 0; j < v[i].size(); j++) {
t[i - (j + n - v[i].size())][j + n - v[i].size()] = v[i][j];
}
}
dp[i][j] = s[i][j];
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(i) dp[i][j] = dp[i - 1][j] + t[i][j];
if(j) dp[i][j] = max(dp[i][j], dp[i][j - 1] + t[i][j]);
}
}
cout << dp[n - 1][n - 1] << endl;
} | a.cc: In function 'int main()':
a.cc:29:12: error: 'i' was not declared in this scope
29 | dp[i][j] = s[i][j];
| ^
a.cc:29:15: error: 'j' was not declared in this scope
29 | dp[i][j] = s[i][j];
| ^
|
s362286381 | p00089 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
??
int cnt[100];
int d[100][100];
int dp[100][100];
??
int main() {
????????string s;
????????int n;
????????for (n = 0; cin >> s; n++) {
????????????????s += ',';
????????????????stringstream ss(s);
????????????????char c;
????????????????for (; ss >> d[n][cnt[n]] >> c; cnt[n]++);
????????}
????????dp[0][0] = d[0][0];
????????for (int i = 1; i < n; i++) {
????????????????rep(j, cnt[i]) {
????????????????????????if (i < n / 2) {
????????????????????????????????if (!j)dp[i][j] = dp[i - 1][j] + d[i][j];
????????????????????????????????else dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - 1]) + d[i][j];
????????????????????????}
????????????????????????else {
????????????????????????????????if (j == cnt[i] - 1)dp[i][j] = dp[i - 1][j] + d[i][j];
????????????????????????????????else dp[i][j] = max(dp[i - 1][j], dp[i - 1][j + 1]) + d[i][j];
????????????????????????}
????????????????}
????????}
????????printf("%d\n", dp[n - 1][0]);
} | a.cc:4:1: error: expected unqualified-id before '?' token
4 | ??
| ^
a.cc:8:1: error: expected unqualified-id before '?' token
8 | ??
| ^
|
s497422418 | p00089 | C++ | import java.util.*;
class Main{
public static void main(String args[]){
int table[][]=new int[100][100];
int dp[][]=new int[100][100];
Scanner s=new Scanner(System.in);
int count=0;
for(int i=0;i<100;i++)
for(int j=0;j<100;j++)
table[i][j]=dp[i][j]=0;
while(s.hasNext()){
String str=s.next();
String[] dat=str.split(",");
for(int i=0;i<dat.length;i++){
table[count][i]=Integer.parseInt(dat[i]);
}
count++;
}
dp[0][0]=table[0][0];
for(int i=1;i<count;i++){
for(int j=0;j<count;j++){
if(i<count/2){
if(j==0)dp[i][j]=dp[i-1][j]+table[i][j];
else dp[i][j]=Math.max(dp[i-1][j],dp[i-1][j-1])+table[i][j];
}else{
dp[i][j]=Math.max(dp[i-1][j],dp[i-1][j+1])+table[i][j];
}
}
}
System.out.println(dp[count-1][0]);
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:15: error: expected ':' before 'static'
3 | public static void main(String args[]){
| ^~~~~~~
| :
a.cc:3:33: error: 'String' has not been declared
3 | public static void main(String args[]){
| ^~~~~~
a.cc:33:2: error: expected ';' after class definition
33 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:4:21: error: declaration of 'table' as multidimensional array must have bounds for all dimensions except the first
4 | int table[][]=new int[100][100];
| ^~~~~
a.cc:5:21: error: declaration of 'dp' as multidimensional array must have bounds for all dimensions except the first
5 | int dp[][]=new int[100][100];
| ^~
a.cc:6:17: error: 'Scanner' was not declared in this scope
6 | Scanner s=new Scanner(System.in);
| ^~~~~~~
a.cc:10:33: error: 'table' was not declared in this scope; did you mean 'mutable'?
10 | table[i][j]=dp[i][j]=0;
| ^~~~~
| mutable
a.cc:10:45: error: 'dp' was not declared in this scope
10 | table[i][j]=dp[i][j]=0;
| ^~
a.cc:12:23: error: 's' was not declared in this scope
12 | while(s.hasNext()){
| ^
a.cc:13:25: error: 'String' was not declared in this scope
13 | String str=s.next();
| ^~~~~~
a.cc:14:32: error: expected primary-expression before ']' token
14 | String[] dat=str.split(",");
| ^
a.cc:15:39: error: 'dat' was not declared in this scope
15 | for(int i=0;i<dat.length;i++){
| ^~~
a.cc:16:33: error: 'table' was not declared in this scope; did you mean 'mutable'?
16 | table[count][i]=Integer.parseInt(dat[i]);
| ^~~~~
| mutable
a.cc:16:49: error: 'Integer' was not declared in this scope
16 | table[count][i]=Integer.parseInt(dat[i]);
| ^~~~~~~
a.cc:20:17: error: 'dp' was not declared in this scope
20 | dp[0][0]=table[0][0];
| ^~
a.cc:20:26: error: 'table' was not declared in this scope; did you mean 'mutable'?
20 | dp[0][0]=table[0][0];
| ^~~~~
| mutable
a.cc:25:55: error: 'Math' was not declared in this scope
25 | else dp[i][j]=Math.max(dp[i-1][j],dp[i-1][j-1])+table[i][j];
| ^~~~
a.cc:27:50: error: 'Math' was not declared in this scope
27 | dp[i][j]=Math.max(dp[i-1][j],dp[i-1][j+1])+table[i][j];
| ^~~~
a.cc:31:17: error: 'System' was not declared in this scope
31 | System.out.println(dp[count-1][0]);
| ^~~~~~
|
s778589898 | p00089 | 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>
using namespace std;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair
template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
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; }
int in() { int x; scanf("%d", &x); return x; }
int mtx[210][110];
int dp[210][110];
int main() {
char s[1000];
int x,y;
for(y=0;gets(s);y++){
int len=strlen(s);
int i;
x=0;
//cout<<s<<endl;
//cout<<len<<endl;
//cout<<s[0]-'0'<<endl;
for(i=0;i<len;){
if('0'<=s[i]&&s[i]<='9'){
if(i+1<len&&'0'<=s[i+1]&&s[i+1]<='9'){
mtx[y][x++]=(s[i]-'0')*10+s[i+1]-'0';
i+=3;
}else{
mtx[y][x]=s[i]-'0';
//cout<<y<<" "<<x<<" "<<s[i]<<endl;
x++;
i+=2;
}
}
}
}
int maxy=y;
/*for(y=0;y<maxy;y++){
for(x=0;x<min(y+1,maxy-y);x++){
cout<<mtx[y][x]<<" ";
}
cout<<endl;
}
*/
for(y=0;y<maxy;y++){
if(y==0)dp[0][0]=mtx[0][0];
else if(y<maxy/2+1){
for(x=0;x<=y;x++){
dp[y][x]=max(dp[y-1][x],x==0?0:dp[y-1][x-1])+mtx[y][x];
}
}else{
for(x=0;x<maxy-y;x++){
dp[y][x]=max(dp[y-1][x],x==maxy-y-1?0:dp[y-1][x+1])+mtx[y][x];
}
}
}
cout<<dp[maxy-1][0]<<endl;
/*for(y=0;y<maxy;y++){
for(x=0;x<min(y+1,maxy-y);x++){
cout<<dp[y][x]<<" ";
}
cout<<endl;
}*/
return 0;
} | a.cc: In function 'int main()':
a.cc:37:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
37 | for(y=0;gets(s);y++){
| ^~~~
| getw
|
s482492678 | p00089 | C++ | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int data[100][100];
int main()
{
memset(data, 0, sizeof(data));
char buf[512];
int yy = 0;
while (!cin.eof())
{
cin.getline(buf, sizeof(buf));
if (strlen(buf) == 0)
break;
int xx = 1;
for (char* p = strtok(buf, ","); p != NULL; p = strtok(NULL, ","), ++xx)
data[yy][xx] = atoi(p);
++yy;
}
for (int i = 1; i < yy; ++i)
{
int a = -1;
int b = 0;
if (i > (yy+1)/2)
{
a = 0;
b = 1;
}
for (int j = 1; j < (yy+1)/2; ++j)
data[i][j] += max(data[i-1][j+a], data[i-1][j+b]);
}
printf("%d\n", data[yy-1][1]);
return 0;
} | a.cc: In function 'int main()':
a.cc:12:16: error: reference to 'data' is ambiguous
12 | memset(data, 0, sizeof(data));
| ^~~~
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:3:
/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:8:5: note: 'int data [100][100]'
8 | int data[100][100];
| ^~~~
a.cc:12:32: error: reference to 'data' is ambiguous
12 | memset(data, 0, sizeof(data));
| ^~~~
/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:8:5: note: 'int data [100][100]'
8 | int data[100][100];
| ^~~~
a.cc:23:25: error: reference to 'data' is ambiguous
23 | data[yy][xx] = atoi(p);
| ^~~~
/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:8:5: note: 'int data [100][100]'
8 | int data[100][100];
| ^~~~
a.cc:37:25: error: reference to 'data' is ambiguous
37 | data[i][j] += max(data[i-1][j+a], data[i-1][j+b]);
| ^~~~
/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:8:5: note: 'int data [100][100]'
8 | int data[100][100];
| ^~~~
a.cc:37:43: error: reference to 'data' is ambiguous
37 | data[i][j] += max(data[i-1][j+a], data[i-1][j+b]);
| ^~~~
/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:8:5: note: 'int data [100][100]'
8 | int data[100][100];
| ^~~~
a.cc:37:59: error: reference to 'data' is ambiguous
37 | data[i][j] += max(data[i-1][j+a], data[i-1][j+b]);
| ^~~~
/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:8:5: note: 'int data [100][100]'
8 | int data[100][100];
| ^~~~
a.cc:40:24: error: reference to 'data' is ambiguous
40 | printf("%d\n", data[yy-1][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:8:5: note: 'int data [100][100]'
8 | int data[100][100];
| ^~~~
|
s153232474 | p00089 | C++ | #include <iostream>
#include <string>
#include <sstream>
using namespace std;
const int SIZE = 50;
int main(){
char c;
string s;
int n, max = 0;
int* table = new int[ SIZE + 1 ]();
while ( cin >> s ){
int* input = new int[ SIZE + 1 ]();
bool isInt = true;
int cnt = 0;
istringstream is( s );
while ( !is.eof() ){
if ( isInt ){
is >> n;
input[ ++cnt ] = n;
}else{
is >> c;
}
isInt = !isInt;
}
if ( cnt > max ){
max = cnt;
}
for ( int i = 0, p = max; i < cnt; ++i, --p ){
table [ p ] = input[ cnt - i ] + ( table[ p - 1 ] > table[ p ] ? table[ p - 1 ] : table[ p ] );
}
if ( cnt == 1 ){
isEnd = !isEnd;
}
delete[] input;
}
cout << table[ max ] << endl;
delete[] table;
return 0;
} | a.cc: In function 'int main()':
a.cc:39:25: error: 'isEnd' was not declared in this scope
39 | isEnd = !isEnd;
| ^~~~~
|
s439241114 | p00089 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<vector>
#include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int dp[101][101];
int hisi[101][101];
int main()
{
int temp=0;
char t;
string s;
vector<int> nums;
while(cin>>s)
{
if(cin.eof())break;
int len = s.size();
for(int i=0;i<len;i++)
{
if(s[i]==','){nums.push_back(temp);temp=0;}
else{temp= temp*10 +(int) s[i]-'0';}
}
nums.push_back(temp);
temp=0;
}
//cout << nums.size()<<endl;
int hen = (int)sqrt((double)nums.size());
int dan = 0;
int k=0,x=0,y=0;
for(dan=0;dan<hen;dan++)
{
x=0;
y=dan;
while(1)
{
hisi[x][y] = nums[k];
//cout << x<<","<<y << endl;
k++;
x++;
y--;
if(y<0)break;
}
}
for(dan=hen;dan<2*hen-1;dan++)
{
y = hen -1;
x = dan-hen+1; | a.cc: In function 'int main()':
a.cc:52:23: error: expected '}' at end of input
52 | x = dan-hen+1;
| ^
a.cc:50:5: note: to match this '{'
50 | {
| ^
a.cc:52:23: error: expected '}' at end of input
52 | x = dan-hen+1;
| ^
a.cc:13:1: note: to match this '{'
13 | {
| ^
|
s474643202 | p00089 | C++ | //============================================================================
// Name : TopCoderCompetition.cpp
// Author : taguchi
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <numeric>
using namespace std;
#define P pair<int,int>
#define rep(i,n) for(int i = 0;i<n;i++)
#define pb(n) push_back(n)
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
struct edge{int cost,to;};
vector<string> split(string &in,char delimiter){
vector<string> re; uint cur = 0,next;
while((next = in.find_first_of(delimiter,cur)) != string::npos){
re.pb(string(in,cur,next-cur));
cur = next + 1;
}
re.pb(string(in,cur,in.size()-cur));
return re;
}
vector<int> split_int(string &in, char delimiter){
vector<string> str = split(in,delimiter);
vector<int> re;
rep(i,str.size()){
re.pb(strtol(str[i].c_str(),NULL,10));
}
return re;
}
int main(){
vector<int> in[110];
int dp[110][110];
memset(dp,0,sizeof(dp));
string s;
int cnt = 0;
while(!((getline(cin,s),s.length()) == 1 && cnt != 0)){
in[cnt] = split_int(s,',');
cnt++;
}
in[cnt] = split_int(s,',');
cnt++;
dp[0][0] = in[0][0];
for(int i = 1;i<110;i++)rep(j,in[i].size()){
if(i <= cnt / 2){
if(j-1<0){
dp[i][j] = dp[i-1][j] + in[i][j];
continue;
}
dp[i][j] = max(dp[i-1][j] + in[i][j],dp[i-1][j-1] + in[i][j]);
}else{
dp[i][j] = max(dp[i-1][j] + in[i][j],dp[i-1][j+1] + in[i][j]);
}
}
int res = 0;
rep(i,110){
res = max(res,dp[i][0]);
}
cout << res@ endl;
return 0;
} | a.cc:75:17: error: extended character is not valid in an identifier
75 | cout << res@ endl;
| ^
a.cc:75:21: error: stray '@' in program
75 | cout << res@ endl;
| ^
a.cc:75:22: error: extended character is not valid in an identifier
75 | cout << res@ endl;
| ^
a.cc:75:22: error: extended character is not valid in an identifier
a.cc:75:22: error: extended character is not valid in an identifier
a.cc:75:22: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:75:17: error: 'res\302\201' was not declared in this scope; did you mean 'res'?
75 | cout << res@ endl;
| ^~~~
| res
|
s560078907 | p00089 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <numeric>
using namespace std;
#define P pair<int,int>
#define rep(i,n) for(int i = 0;i<n;i++)
#define pb(n) push_back(n)
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
struct edge{int cost,to;};
vector<string> split(string &in,char delimiter){
vector<string> re; uint cur = 0,next;
while((next = in.find_first_of(delimiter,cur)) != string::npos){
re.pb(string(in,cur,next-cur));
cur = next + 1;
}
re.pb(string(in,cur,in.size()-cur));
return re;
}
vector<int> split_int(string &in, char delimiter){
vector<string> str = split(in,delimiter);
vector<int> re;
rep(i,str.size()){
re.pb(strtol(str[i].c_str(),NULL,10));
}
return re;
}
int main(){
vector<int> in[110];
int dp[110][110];
memset(dp,0,sizeof(dp));
string s;
int cnt = 0;
while(!((getline(cin,s),s.length()) == 1 && cnt != 0)){ | a.cc: In function 'int main()':
a.cc:45:64: error: expected '}' at end of input
45 | while(!((getline(cin,s),s.length()) == 1 && cnt != 0)){
| ~^
a.cc:45:64: error: expected '}' at end of input
a.cc:39:11: note: to match this '{'
39 | int main(){
| ^
|
s280725373 | p00089 | C++ | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {
char c[202];
char *cp;
int n[102][102],i,j,k,m=0,p,an=0;
memset(n,0,sizeof(n));
while(gets(c)!=NULL) {
cp=c; k=1; p=0;
while(p<strlen(c)) {
n[m+1][k++]=atoi(cp);
while(c[p]!=',' && p<strlen(c)) p++;
p++; cp=&c[p];
}
m++;
}
for (i=1;i<=m/2+1;i++) for (j=1;j<=i;j++) {
n[i][j]+=max(n[i-1][j],n[i-1][j-1]);
n[m-i+1][j]+=max(n[m-i+2][j],n[m-i+2][j-1]);
if (i==m/2+1) an=max(an,n[i][j]);
}
cout << an << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | while(gets(c)!=NULL) {
| ^~~~
| getw
|
s699543538 | p00089 | C++ | #include <iostream>
#include <cstdlib>
#include <sstream>
#include <algorithm>
using namespace std;
int d[50][100],dp[50][100];
int main() {
string str;
int l=0;
memset(d,-1,sizeof(d));
memset(dp,-1,sizeof(d));
while(cin>>str) {
replace(str.begin(),str.end(),',',' ');
stringstream sstr(str);
int i=0;
while(sstr>>d[i++][l]);
l++;
}
dp[0][0]=d[0][0];
for(int i=1;i<l;i++) {
for(int j=0;d[j][i]!=-1;j++) {
if((l/2)<i) {
dp[j][i]=max(dp[j][i-1],j<50?dp[j+1][i-1]:-1);
}else {
dp[j][i]=max(dp[j][i-1],j>=0?dp[j-1][i-1]:-1);
}
dp[j][i]+=d[j][i];
}
}
cout<<dp[0][l-1]<<endl;
} | a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
13 | memset(d,-1,sizeof(d));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <algorithm>
+++ |+#include <cstring>
5 |
|
s963827106 | p00089 | C++ | #include <iostream>
#include <string>
#define L 100
using namespace std;
int main(void)
{
int i1,i2,i3;
int c;
string s;
int f[L][L];
int dp[L][L];
c=0;
memset(f,-1,sizeof(f));
memset(dp,0,sizeof(dp));
while(1){
cin>>s;
for(i1=0,i2=0;i1<s.size();i1+=2,i2++){
f[c][i2]=s[i1]-48;
}
c++;
if(c!=1 && s.size()==1) break;
}
dp[0][0]=f[0][0];
for(i1=1;i1<=c/2;i1++){
for(i2=0;i2<c/2+1;i2++){
if(i2==0) dp[i1][i2]=dp[i1-1][i2]+f[i1][i2];
else if(f[i1][i2]!=-1){
dp[i1][i2]=max(dp[i1-1][i2],dp[i1-1][i2-1])+f[i1][i2];
}
}
}
for(i1;i1<c;i1++){
for(i2=c/2;i2>=0;i2--){
if(f[i1][i2]!=-1){
dp[i1][i2]=max(dp[i1-1][i2],dp[i1-1][i2+1])+f[i1][i2];
}
}
}
/*for(i1=0;i1<=c;i1++){
for(i2=0;i2<c/2+1;i2++){
cout<<dp[i1][i2]<<" ";
}
cout<<endl;
}*/
cout<<dp[c-1][0]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:9: error: 'memset' was not declared in this scope
17 | memset(f,-1,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 | #include <string>
|
s622869669 | p00089 | C++ | #include <iostream>
#include <string>
#include <string.h>
#include <sstream>
#define L 110
using namespace std;
int main(void)
{
int i1,i2,i3;
int c;
string s;
string temp;
int f[L][L];
int dp[L][L];
c=0;
memset(f,-1,sizeof(f));
memset(dp,0,sizeof(dp));
while(1){
cin>>s;
temp="";
s=s+",";
for(i1=0,i2=0;i1<s.size();i1++){
if(s[i1]==','){
istringstream istr(temp);
istr >> f[c][i2];
temp="";
i2++;
}
else temp+=s[i1];
}
c++;
if(c!=1 && count(s.begin(),s.end(),',')==1) break;
}
dp[0][0]=f[0][0];
for(i1=1;i1<=c/2;i1++){
for(i2=0;i2<c/2+1;i2++){
if(i2==0) dp[i1][i2]=dp[i1-1][i2]+f[i1][i2];
else if(f[i1][i2]!=-1){
dp[i1][i2]=max(dp[i1-1][i2],dp[i1-1][i2-1])+f[i1][i2];
}
}
}
for(i1;i1<c;i1++){
for(i2=0;i2<c/2+1;i2++){
if(f[i1][i2]!=-1){
dp[i1][i2]=max(dp[i1-1][i2],dp[i1-1][i2+1])+f[i1][i2];
}
}
}
/*for(i1=0;i1<=c;i1++){
for(i2=0;i2<c/2+1;i2++){
cout<<f[i1][i2]<<" ";
}
cout<<endl;
}*/
cout<<dp[c-1][0]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:39:28: error: 'count' was not declared in this scope
39 | if(c!=1 && count(s.begin(),s.end(),',')==1) break;
| ^~~~~
|
s591767877 | p00089 | C++ | #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
static const int margin = 1;
int main() {
char input[128][512];
int vertex[128][64];
int line;
for(line = 0; fgets(input[line], 512, stdin) != NULL; line++);
memset(vertex, 0, sizeof(vertex));
for(int i = 0; i < line; i++) {
for(int j = 0, k = 0; input[i][j] != '\n' && input[i][j] != '\0'; j++, k++) {
int tmp = 0;
for(;input[i][j] != ',' && input[i][j] != '\n' && input[i][j]; j++) {
tmp *= 10;
tmp += input[i][j] - '0';
}
if(i <= line / 2)
vertex[margin + i][margin + k] = max(vertex[margin + (i - 1)][margin + (k - 1)], vertex[margin + (i - 1)][margin + k]) + tmp;
else
vertex[margin + i][margin + k] = max(vertex[margin + (i - 1)][margin + k], vertex[margin + (i - 1)][margin + (k + 1)]) + tmp;
}
}
cout << vertex[margin + line - 1][margin] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'memset' was not declared in this scope
14 | memset(vertex, 0, sizeof(vertex));
| ^~~~~~
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 | using namespace std;
|
s161179192 | p00089 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int coor[101][101],tmp[100][100];
int main()
{
memset(coor,0,sizeof(coor));
memset(tmp,0,sizeof(tmp));
string s;
int k=0;
while(cin >> s)
{
int len=s.size();
len=(len+1)/2;
for(int i=0;i<len;i++)
{
coor[k][i]=s[2*i]-'0';
}
k++;
}
/*for(int i=0;i<k;i++)
{
for(int j=0;j<min(i+1,k-i);j++)
{
cout << coor[i][j] <<' ';
}
cout << endl;
}*/
tmp[0][0]=coor[0][0];
for(int i=0;i<k/2;i++)
{
for(int j=0;j<i+1;j++)
{
tmp[i+1][j]=max(tmp[i+1][j],tmp[i][j]+coor[i+1][j]);
tmp[i+1][j+1]=max(tmp[i+1][j+1],tmp[i][j]+coor[i+1][j+1]);
}
}
int p=k/2;
for(int i=0;i<k/2;i++)
{
for(int j=0;j<(k/2-i);j++)
{
tmp[i+p+1][j]=max(tmp[i+p][j],tmp[i+p][j+1])+coor[i+p+1][j];
}
}
/*for(int i=0;i<k;i++)
{
for(int j=0;j<min(i+1,k-i);j++)
{
printf("%2d ",tmp[i][j]);
}
cout << endl;
}*/
cout << tmp[k-1][0] << endl;
return 0;
} | a.cc:35:1: error: extended character is not valid in an identifier
35 | memset(coor,0,sizeof(coor));
| ^
a.cc:35:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:35:1: error: '\U00003000\U00003000' was not declared in this scope
35 | memset(coor,0,sizeof(coor));
| ^~~~
|
s252835629 | p00089 | C++ | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;
int n;
int mas[101][101];
int dp[101][101];
int rec(int i,int j){
if(i == n) return 0;
if(j < 0 || mas[i][j] == -1) return -(2 << 26);
if(dp[i][j]) return dp[i][j];
int res = 0;
if(i < n/2) res = max(rec(i+1,j)+mas[i][j],rec(i+1,j+1)+mas[i][j]);
else if(i >= n/2) res = max(rec(i+1,j-1)+mas[i][j],rec(i+1,j)+mas[i][j]);
return dp[i][j] = res;
}
int main(){
memset(mas,-1,sizeof(mas));
for(int i=0;;i++){
stringstream ss; string s;
getline(cin,s);
n = i;
if(s.size() == 0) break;
ss << s;
for(int j=0;;j++){
char tr; int fig;
ss >> fig; mas[i][j] = fig;
if(ss.peek() == EOF) break;
ss >> tr;
}
}
cout << rec(0,0) << endl;
} | a.cc: In function 'int main()':
a.cc:22:3: error: 'memset' was not declared in this scope
22 | memset(mas,-1,sizeof(mas));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <algorithm>
+++ |+#include <cstring>
5 | using namespace std;
|
s208381904 | p00090 | Java | import java.util.*;
public class Maiin{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
int n = Integer.parseInt(str);
String[] strCor = new String[n];
String[][] strZahyo = new String[n][2];
double[][] zahyo = new double[n][2];
int cnt = 0;
int cntMax = 0;
for(int i = 0; i < n; i++){
strCor[i] = sc.nextLine();
strZahyo[i] = strCor[i].split(",");
zahyo[i][0] = Double.parseDouble(strZahyo[i][0]);
zahyo[i][1] = Double.parseDouble(strZahyo[i][1]);
}
if(Integer.parseInt(sc.nextLine()) == 0){
sc.close();
}
for(int i = 0; i < n; i++){
for(int j = i; j < n; j++){
if(isOverlap(zahyo[i][0], zahyo[i][1], zahyo[j][0], zahyo[j][1])){
cnt++;
}
if(cnt >= cntMax){
cntMax = cnt;
}
}
cnt = 0;
}
System.out.println(cntMax);
}
/**
* @param x1 ??????????????????x??§?¨?
* @param y1 ??????????????????y??§?¨?
* @param x2 ??????2????????????x??§?¨?
* @param y2 ???2????????????y??§?¨?
* @return??????2????????±?????????????????°true????????????????????°false
*/
private static boolean isOverlap(double x1, double y1, double x2, double y2){
double r1 = 1.000000;
double r2 = 1.000000;
boolean result = false;
if(distance(x1,y1,x2,y2) <= r1+r2){
result = true;
}else{
result = false;
}
return result;
}
/**
* @param x1 ??????????????????x??§?¨?
* @param y1 ??????????????????y??§?¨?
* @param x2 ???2????????????x??§?¨?
* @param y2 ???2????????????y??§?¨?
* @return??????2???????????????????????¢
*/
private static double distance(double x1, double y1, double x2, double y2){
double dx = x1 - x2;
double dy = y1 - y2;
return Math.sqrt(dx*dx+dy*dy);
}
} | Main.java:3: error: class Maiin is public, should be declared in a file named Maiin.java
public class Maiin{
^
1 error
|
s140037745 | p00090 | Java | import java.util.*;
public class Maiin{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
int n = Integer.parseInt(str);
String[] strCor = new String[n];
String[][] strZahyo = new String[n][2];
double[][] zahyo = new double[n][2];
int cnt = 0;
int cntMax = 0;
for(int i = 0; i < n; i++){
strCor[i] = sc.nextLine();
strZahyo[i] = strCor[i].split(",");
zahyo[i][0] = Double.parseDouble(strZahyo[i][0]);
zahyo[i][1] = Double.parseDouble(strZahyo[i][1]);
}
if(Integer.parseInt(sc.nextLine()) == 0){
sc.close();
}
for(int i = 0; i < n; i++){
for(int j = i; j < n; j++){
if(isOverlap(zahyo[i][0], zahyo[i][1], zahyo[j][0], zahyo[j][1])){
cnt++;
}
if(cnt >= cntMax){
cntMax = cnt;
}
}
cnt = 0;
}
if(cntMax == 0)cntMax = 1;
System.out.println(cntMax);
}
/**
* @param x1 ??????????????????x??§?¨?
* @param y1 ??????????????????y??§?¨?
* @param x2 ??????2????????????x??§?¨?
* @param y2 ???2????????????y??§?¨?
* @return??????2????????±?????????????????°true????????????????????°false
*/
private static boolean isOverlap(double x1, double y1, double x2, double y2){
double r1 = 1.000000;
double r2 = 1.000000;
boolean result = false;
if(distance(x1,y1,x2,y2) <= r1+r2){
result = true;
}else{
result = false;
}
return result;
}
/**
* @param x1 ??????????????????x??§?¨?
* @param y1 ??????????????????y??§?¨?
* @param x2 ???2????????????x??§?¨?
* @param y2 ???2????????????y??§?¨?
* @return??????2???????????????????????¢
*/
private static double distance(double x1, double y1, double x2, double y2){
double dx = x1 - x2;
double dy = y1 - y2;
return Math.sqrt(dx*dx+dy*dy);
}
} | Main.java:3: error: class Maiin is public, should be declared in a file named Maiin.java
public class Maiin{
^
1 error
|
s111260960 | p00090 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
while(true){
int num = s.nextInt();
if(num==-)break;
double[][] data = new double[num][2];
for(int i=0 ; i<num ; i++){
String[] temp = s.next().split(",");
for(int j=0 ; j<2 ; j++)
data[i][j] = Double.valueOf(temp[j]).doubleValue();
}
int[] c = new int[num];
for(int i=0 ; i<num ; i++){
for(int j=0 ; j<num ; j++){
if(i!=j){
if((data[i][0]-data[j][0])*(data[i][0]-data[j][0])+(data[i][1]-data[j][1])*(data[i][1]-data[j][1]) <= 4)
c[i]++;
}
}
}
int max = 0;
for(int i=0 ; i<num ; i++)
max = Math.max(max,c[i]);
System.out.println(max+1);
}
}
} | Main.java:9: error: illegal start of expression
if(num==-)break;
^
1 error
|
s472494533 | p00090 | Java | 15
3.14979,8.51743
2.39506,3.84915
2.68432,5.39095
5.61904,9.16332
7.85653,4.75593
2.84021,5.41511
1.79500,8.59211
7.55389,8.17604
4.70665,4.66125
1.63470,4.42538
7.34959,4.61981
5.09003,8.11122
5.24373,1.30066
0.13517,1.83659
7.57313,1.58150
0 | Main.java:1: error: class, interface, enum, or record expected
15
^
1 error
|
s478560941 | p00090 | Java | 00.07 sec 20600 KB 90 lines 2654 bytes 2013-03-05 19:22
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Main {
public static void main(String[] args) throws IOException {
Main instance = new Main();
instance.execute();
}
private void execute() throws IOException {
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
while(true) {
int rows = Integer.parseInt(sc.readLine());
if(rows == 0){break;}
Map<Integer, List<Integer>> cross = calculateCross(toDataArray(sc, rows));
int result = 0;
for(Integer num : cross.keySet()) {
result = Math.max(result, countCrossover(cross, cross.get(num), 1));
}
System.out.println(result);
}
}
/**
* BufferReaderから取得した座標情報を2次元配列に変換する
*/
private double[][] toDataArray(BufferedReader sc, int rows) throws IOException {
double[][] dataArray = new double[rows][2];
String[] line;
for(int i = 0 ; i < rows ; i++) {
line = sc.readLine().split(",");
dataArray[i][0] = Double.parseDouble(line[0]);
dataArray[i][1] = Double.parseDouble(line[1]);
}
return dataArray;
}
/**
* 座標情報(2次元配列)から、シールの重なり状態を示すMapを生成する
* {シール番号, [座標が重なるシール番号]}
*/
private Map<Integer, List<Integer>> calculateCross(double[][] dataArray) {
Map<Integer, List<Integer>> cross = new HashMap<Integer, List<Integer>>();
List<Integer> result;
for(int i = 0 ; i < dataArray.length ; i++) {
result = new ArrayList<Integer>();
for(int j = i + 1 ; j < dataArray.length ; j++) {
// x座標,y座標の各距離の二乗の和が4以下なら、シールが重なっていると判断
if(Math.pow(dataArray[i][0] - dataArray[j][0], 2) +
Math.pow(dataArray[i][1] - dataArray[j][1], 2) <= 4) {
result.add(j);
}
}
cross.put(i, result);
}
return cross;
}
/**
* シールの重なり状態を示すMapから、最大の重なり枚数を計算する
*/
private int countCrossover(Map<Integer, List<Integer>> cross, List<Integer> currentCross, int currentCount) {
int result = currentCount;
List<Integer> target;
List<Integer> nextCross;
for(Integer num : currentCross) {
target = cross.get(num);
nextCross = new ArrayList<Integer>();
nextCross.addAll(target);
nextCross.retainAll(currentCross);
target.removeAll(currentCross);
result = Math.max(result, countCrossover(cross, nextCross, currentCount + 1));
}
return result;
}
} | Main.java:1: error: class, interface, enum, or record expected
00.07 sec 20600 KB 90 lines 2654 bytes 2013-03-05 19:22
^
Main.java:93: error: class, interface, enum, or record expected
import java.io.IOException;
^
Main.java:94: error: class, interface, enum, or record expected
import java.io.InputStreamReader;
^
Main.java:95: error: class, interface, enum, or record expected
import java.util.ArrayList;
^
Main.java:96: error: class, interface, enum, or record expected
import java.util.HashMap;
^
Main.java:97: error: class, interface, enum, or record expected
import java.util.List;
^
Main.java:98: error: class, interface, enum, or record expected
import java.util.Map;
^
7 errors
|
s509746296 | p00090 | C | #include<stdio.h>
#include<math.h>
int N,i,j,u[100],r[100]={0},R=0;
double P[100][2];
int pa(int n){return u[n]==n?n:u[n]=pa(u[n]);}
void un(int a,int b){u[pa(a)]=pa(b);}
int dis(double a[2],double b[2])
{
double x=a[0]-b[0],y=a[1]-b[1];
return ((x*x+y*y)-4.0<=0.000001)?1:0;
}
int main()
{
for(;scanf("%d",&N),N;)
{
for(i=0;i<N;i++)u[i]=i;
for(i=0;i<N;i++)
{
scanf("%lf,%lf",&P[i][0],&P[i][1]);
for(j=0;j<i;j++)
if(dis(P[j],P[i]))
un(i,j);
}
for(i=0;i<N;i++)
r[pa(u[i])]++;
for(i=0;i<N;i++)
R=R>r[i]?R:r[i];
printf("%d\n",R);
}
return 0;
} | main.c: In function 'pa':
main.c:7:36: error: lvalue required as left operand of assignment
7 | int pa(int n){return u[n]==n?n:u[n]=pa(u[n]);}
| ^
|
s528757480 | p00090 | C | 15
3.14979,8.51743
2.39506,3.84915
2.68432,5.39095
5.61904,9.16332
7.85653,4.75593
2.84021,5.41511
1.79500,8.59211
7.55389,8.17604
4.70665,4.66125
1.63470,4.42538
7.34959,4.61981
5.09003,8.11122
5.24373,1.30066
0.13517,1.83659
7.57313,1.58150
0 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 15
| ^~
|
s014445311 | p00090 | C | #include <stdio.h>
#define SQ(x) ((x) * (x))
typedef struct {
double x;
double y;
} POINT;
int dist(POINT a, POINT b)
{
if (SQ(a.x - b.x) + SQ(a.y - b.y) > 1){
return (0);
}
return (1);
}
int max(int a, int b)
{
if (a > b){
return (a);
}
return (b);
}
int main(void)
{
POINT seal[100], t;
int n;
int count, ans;
double i, j;
int k;
while (1){
scanf("%d", &n);
if (!n){
break;
}
for (i = 0; i < n; i++){
scanf("%lf%*c%lf", &seal[i].x, &seal[i].y);
}
ans = 0;
for (i = 0; i <= 10; i += 0.01){
t.y = i;
for (j = 0; j <= 10; j += 0.01){
t.x = j;
count = 0;
for (k = 0; k < n; k++){
if (dist(t, seal[k])){
count++;
}
ans = max(ans, count);
}
}
}
printf("%d\n", ans);
}
return (0);
} | main.c: In function 'main':
main.c:41:37: error: array subscript is not an integer
41 | scanf("%lf%*c%lf", &seal[i].x, &seal[i].y);
| ^
main.c:41:49: error: array subscript is not an integer
41 | scanf("%lf%*c%lf", &seal[i].x, &seal[i].y);
| ^
|
s961798742 | p00090 | C | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}} | main.c:1:1: error: unknown type name 'adouble'; did you mean 'double'?
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~~~~
| double
main.c:1:29: warning: data definition has no type or storage class
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^
main.c:1:29: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:31: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^
main.c:1:33: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^
main.c:1:35: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^
main.c:1:37: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^
main.c:1:39: error: return type defaults to 'int' [-Wimplicit-int]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~
main.c: In function 'main':
main.c:1:39: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:54: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
main.c:1:54: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~~
main.c:1:54: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:73: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~~~
main.c:1:73: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:73: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:73: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:159: error: implicit declaration of function 'acos' [-Wimplicit-function-declaration]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'acos'
+++ |+#include <math.h>
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
main.c:1:159: warning: incompatible implicit declaration of built-in function 'acos' [-Wbuiltin-declaration-mismatch]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~
main.c:1:159: note: include '<math.h>' or provide a declaration of 'acos'
main.c:1:164: error: implicit declaration of function 'hypot' [-Wimplicit-function-declaration]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~~
main.c:1:164: note: include '<math.h>' or provide a declaration of 'hypot'
main.c:1:164: warning: incompatible implicit declaration of built-in function 'hypot' [-Wbuiltin-declaration-mismatch]
main.c:1:164: note: include '<math.h>' or provide a declaration of 'hypot'
main.c:1:203: error: implicit declaration of function 'atan2' [-Wimplicit-function-declaration]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~~~
main.c:1:203: note: include '<math.h>' or provide a declaration of 'atan2'
main.c:1:203: warning: incompatible implicit declaration of built-in function 'atan2' [-Wbuiltin-declaration-mismatch]
main.c:1:203: note: include '<math.h>' or provide a declaration of 'atan2'
main.c:1:267: error: implicit declaration of function 'cos' [-Wimplicit-function-declaration]
1 | adouble x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),i=n;printf("%d\n",m)){for(;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}
| ^~~
main.c:1:267: note: include '<math.h>' or provide a declaration of 'cos'
main.c:1:267: warning: incompatible implicit declaration of built-in function 'cos' [-Wbuiltin-declaration-mismatch]
main.c:1:267: note: include '<math.h>' or provide a declaration of 'cos'
main.c:1:288: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration]
1 | adouble x[100],y[100],t,u,s;n,i |
s142746987 | p00090 | C | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;} | main.c:1:32: warning: data definition has no type or storage class
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^
main.c:1:32: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:34: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^
main.c:1:36: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^
main.c:1:38: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^
main.c:1:40: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^
main.c:1:42: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^
main.c:1:44: error: return type defaults to 'int' [-Wimplicit-int]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^~~~
main.c: In function 'main':
main.c:1:44: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:59: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
main.c:1:59: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^~~~~
main.c:1:59: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:80: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^~~~~~
main.c:1:80: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:80: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:80: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:138: error: expected ';' before ')' token
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^
| ;
main.c:1:159: error: implicit declaration of function 'acos' [-Wimplicit-function-declaration]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'acos'
+++ |+#include <math.h>
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
main.c:1:159: warning: incompatible implicit declaration of built-in function 'acos' [-Wbuiltin-declaration-mismatch]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^~~~
main.c:1:159: note: include '<math.h>' or provide a declaration of 'acos'
main.c:1:164: error: implicit declaration of function 'hypot' [-Wimplicit-function-declaration]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^~~~~
main.c:1:164: note: include '<math.h>' or provide a declaration of 'hypot'
main.c:1:164: warning: incompatible implicit declaration of built-in function 'hypot' [-Wbuiltin-declaration-mismatch]
main.c:1:164: note: include '<math.h>' or provide a declaration of 'hypot'
main.c:1:204: error: implicit declaration of function 'atan2' [-Wimplicit-function-declaration]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| ^~~~~
main.c:1:204: note: include '<math.h>' or provide a declaration of 'atan2'
main.c:1:204: warning: incompatible implicit declaration of built-in function 'atan2' [-Wbuiltin-declaration-mismatch]
main.c:1:204: note: include '<math.h>' or provide a declaration of 'atan2'
main.c:1:244: error: implicit declaration of function 'cos' [-Wimplicit-function-declaration]
1 | double x[100],y[100],t,u,a,b,s;n,i,j,k,c,z;main(m){for(;m=scanf("%d",&n),z=i=n;printf("%d\n",m)){for(;!z?j=--i:scanf("%lf,%lf",x+z,y+--z))for(;!z&&j--;)for(u=acos(hypot(a=x[j]-x[i],b=y[j]-y[i])/2),s=1,t=atan2(b,a);c=0,u<9&&s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}
| |
s409058887 | p00090 | C | M=9999;main(n,i,j,k,a,b,c){
double p=atan(1)*4,X[100],Y[100],x,y;
for(;scanf("%d",&n),n;printf("%d\n",a)){
for(i=0;i<n;i++)scanf("%lf,%lf",X+i,Y+i);
for(a=i=0;i<n;i++){
for(b=k=0;k<M;k++){
x=X[i]+cos(p*k/M),y=Y[i]+sin(p*k/M);
for(c=j=0;j<n;j++){
if((X[j]-x)*(X[j]-x)+(Y[j]-y)*(Y[j]-y))<1+1e-7)c++;
}
if(b<c)b=c;
}
if(a<b)a=b;
}
}
exit(0);} | main.c:1:1: warning: data definition has no type or storage class
1 | M=9999;main(n,i,j,k,a,b,c){
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'M' [-Wimplicit-int]
main.c:1:8: error: return type defaults to 'int' [-Wimplicit-int]
1 | M=9999;main(n,i,j,k,a,b,c){
| ^~~~
main.c: In function 'main':
main.c:1:8: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:8: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:8: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:1:8: error: type of 'k' defaults to 'int' [-Wimplicit-int]
main.c:1:8: error: type of 'a' defaults to 'int' [-Wimplicit-int]
main.c:1:8: error: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c:1:8: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:2:18: error: implicit declaration of function 'atan' [-Wimplicit-function-declaration]
2 | double p=atan(1)*4,X[100],Y[100],x,y;
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'atan'
+++ |+#include <math.h>
1 | M=9999;main(n,i,j,k,a,b,c){
main.c:2:18: warning: incompatible implicit declaration of built-in function 'atan' [-Wbuiltin-declaration-mismatch]
2 | double p=atan(1)*4,X[100],Y[100],x,y;
| ^~~~
main.c:2:18: note: include '<math.h>' or provide a declaration of 'atan'
main.c:3:14: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | for(;scanf("%d",&n),n;printf("%d\n",a)){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | M=9999;main(n,i,j,k,a,b,c){
main.c:3:14: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | for(;scanf("%d",&n),n;printf("%d\n",a)){
| ^~~~~
main.c:3:14: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:3:31: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
3 | for(;scanf("%d",&n),n;printf("%d\n",a)){
| ^~~~~~
main.c:3:31: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:3:31: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:3:31: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:40: error: implicit declaration of function 'cos' [-Wimplicit-function-declaration]
7 | x=X[i]+cos(p*k/M),y=Y[i]+sin(p*k/M);
| ^~~
main.c:7:40: note: include '<math.h>' or provide a declaration of 'cos'
main.c:7:40: warning: incompatible implicit declaration of built-in function 'cos' [-Wbuiltin-declaration-mismatch]
main.c:7:40: note: include '<math.h>' or provide a declaration of 'cos'
main.c:7:58: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration]
7 | x=X[i]+cos(p*k/M),y=Y[i]+sin(p*k/M);
| ^~~
main.c:7:58: note: include '<math.h>' or provide a declaration of 'sin'
main.c:7:58: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch]
main.c:7:58: note: include '<math.h>' or provide a declaration of 'sin'
main.c:9:80: error: expected expression before '<' token
9 | if((X[j]-x)*(X[j]-x)+(Y[j]-y)*(Y[j]-y))<1+1e-7)c++;
| ^
main.c:9:87: error: expected statement before ')' token
9 | if((X[j]-x)*(X[j]-x)+(Y[j]-y)*(Y[j]-y))<1+1e-7)c++;
| ^
main.c:16:1: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
16 | exit(0);}
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | M=9999;main(n,i,j,k,a,b,c){
main.c:16:1: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
16 | exit(0);}
| ^~~~
main.c:16:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
|
s818748340 | p00090 | C++ | import math
while True:
n = input()
if (n == 0):
break
d = []
EPS = 10 ** (-9)
for i in range(n):
a = map(float, raw_input().split(","))
x = a[0]
y = a[1]
d.append([y,x])
ans = 1
for i in range(n):
sheets = 1
for j in range(n):
if (i == j):continue
dist = (d[i][0] - d[j][0]) ** 2 + (d[i][1] - d[j][1]) ** 2
format(dist, ".12g")
if (dist <= 4.0 + EPS):
sheets += 1
ans = max(ans, sheets)
print ans | a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s635495803 | p00090 | C++ | import math
while True:
n = input()
if (n == 0):
break
d = []
EPS = 10 ** (-5)
for i in range(n):
a = map(float, raw_input().split(","))
x = a[0]
y = a[1]
d.append([y,x])
ans = 1
for i in range(n):
sheets = 1
for j in range(n):
if (i == j):continue
dist = (d[i][0] - d[j][0]) ** 2 + (d[i][1] - d[j][1]) ** 2
format(dist, ".12g")
if (dist + EPS <= 4.0):
sheets += 1
ans = max(ans, sheets)
print ans | a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s999510440 | p00090 | C++ | #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;
#define EPS 1e-8
#define INF 1000000
struct Point{
double x,y;
Point(){}
Point(double _x,double _y){
x=_x; y=_y;
}
Point operator +(const Point p)const{
return Point(x+p.x,y+p.y);
}
Point operator -(const Point p)const{
return Point(x-p.x,y-p.y);
}
Point operator *(const double d)const{
return Point(x*d,y*d);
}
bool operator <(const Point &p)const{
if(x==p.x) return y<p.y;
return x<p.x;
}
bool operator ==(const Point &p)const{
return abs(x-p.x)<EPS && abs(y-p.y)<EPS;
}
double norm(){
return x*x+y*y;
}
bool input(){
if(cin>>x>>y) return true;
return false;
}
};
struct Line{
Point a,b;
Line(){}
Line(Point _a,Point _b){
a=_a; b=_b;
}
bool input(){
if(a.input() && b.input()) return true;
return false;
}
};
struct Circle{
Point c;
double r;
Circle(){}
Circle(Point _c,double _r){
c=_c; r=_r;
}
};
typedef Point Vector;
typedef vector<Point> Polygon;
typedef Line Segment;
double dot(Point p,Point q){
return p.x*q.x+p.y*q.y;
}
double cross(Point p,Point q){
return p.x*q.y-q.x*p.y;
}
int ccw(Point a,Point b,Point c){ //a,b,c,縺ッ蜈ィ縺ヲ逡ー縺ェ繧? Vector v1 = b-a;
Vector v2 = c-a;
if(cross(v1,v2)>EPS) return +1; //a->b->c 縺悟渚譎りィ亥屓繧? if(cross(v1,v2)<-EPS) return -1; //a->b->c 縺梧凾險亥屓繧? if(dot(v1,v2)<-EPS) return +2; //c縺径-b繧医j蠕後m c<-a->b
if(v2.norm()-v1.norm()>EPS) return -2; //c縺径-b繧医j蜑?a->b->c
return 0; //c縺径-b荳?a->c->b
}
Point project(Segment s,Point p){
Vector v1 = s.b-s.a;
Vector v2 = p-s.a;
double r = dot(v1,v2)/v1.norm();
return s.a+v1*r;
}
Point reflect(Segment s,Point p){
return p+(project(s,p)-p)*2.0;
}
bool intersect_ll(Line l,Line m){
return ccw(l.a,l.b,m.a)*ccw(l.a,l.b,m.b)<=0 && ccw(m.a,m.b,l.a)*ccw(m.a,m.b,l.b)<=0;
}
bool crosspoint_ss(Segment s,Segment t,Point &p){
Vector a1,a2,b1,b2;
a1 = s.b-s.a; a2 = t.b-t.a;
b1 = t.a-s.a; b2 = s.a-t.b;
double s1,s2;
s1 = cross(a1,b1)/2; s2 = cross(a1,b2)/2;
if(s1+s2<EPS) return false; //蟷ウ陦? p = Point(t.a.x+a2.x*s1/(s1+s2),t.a.y+a2.y*s1/(s1+s2));
return true;
}
int crosspoint_ll(Line l,Line m,Point &p){
if(intersect_ll(l,m)==false) return 0; //莠、蟾ョ縺励※縺?↑縺? if(crosspoint_ss(l,m,p)==true) return 1;
return -1; //莠、轤ケ縺檎┌髯仙?(蟷ウ陦後°縺、莠、蟾ョ)
}
int crosspoint_cc(Circle c1,Circle c2,Point &p1,Point &p2){
double d,a,t;
d = sqrt((c2.c-c1.c).norm());
if(abs(c1.c.x-c2.c.x)<EPS && abs(c1.c.y-c2.c.y)<EPS && abs(c1.r-c2.r)<EPS)
return -1; //2縺、縺ョ蜀?′驥阪↑縺」縺ヲ縺?k
if(d<abs(c1.r-c2.r) || c1.r+c2.r<d) return 0; //髮「繧後※縺?k縺句?蛹? a = acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d));
t = atan2(c2.c.y-c1.c.y,c2.c.x-c1.c.x);
p1 = Point(c1.c.x+c1.r*cos(t+a),c1.c.y+c1.r*sin(t+a));
p2 = Point(c1.c.x+c1.r*cos(t-a),c1.c.y+c1.r*sin(t-a));
if(abs(p1.x-p2.x)<EPS && abs(p1.y-p2.y)<EPS) return 1; //莠、轤ケ縺?縺、
return 2; //莠、轤ケ縺?縺、
}
//螟夊ァ貞ス「縺ョ轤ケ縺ョ蜀?桁
int contain_gp(Polygon g,Point p){
Line l = Line(p,Point(INF,p.y));
int cnt = 0, n = g.size();
for(int i=0;i<n;i++){
Vector a = g[i]-p;
Vector b = g[(i+1)%n]-p;
if(ccw(g[i],g[(i+1)%n],p)==0) return 1; //邱壼?荳? if(a.y>b.y) swap(a,b);
if(a.y<=EPS && EPS<b.y && cross(a,b)>EPS) cnt++;
}
if((cnt&1)==1) return 2; //蜀?桁縺励※縺?k
return 0; //蜀?桁縺励※縺?↑縺?}
Polygon andrewScan(Polygon s){
if(s.size()<=2) return s;
sort(s.begin(),s.end());
Polygon g;
for(int i=0;i<s.size();i++){
for(int n=g.size(); n>=2 && ccw(g[n-2],g[n-1],s[i])!=-1; n--){
g.pop_back();
}
g.push_back(s[i]);
}
int upper_n = g.size();
for(int i=s.size()-2;i>=0;i--){
for(int n=g.size(); n>upper_n && ccw(g[n-2],g[n-1],s[i])!=-1; n--){
g.pop_back();
}
g.push_back(s[i]);
}
reverse(g.begin(),g.end());
g.pop_back();
return g;
}
struct Data{
int n;
double dist;
Data(){}
Data(int _n,double _dist){
n=_n; dist=_dist;
}
bool operator<(const Data &a)const{
return dist>a.dist;
}
};
struct Edge{
int to;
double dist;
Edge(){}
Edge(int _to,double _dist){
to=_to; dist=_dist;
}
};
int main(){
int N;
Circle C[100];
while(cin>>N,N){
for(int i=0;i<N;i++){
scanf("%lf,%lf",&C[i].c.x,&C[i].c.y);
C[i].r = 1;
}
int ans = 0;
for(int i=0;i<N;i++){
for(int j=i+1;j<N;j++){
Point p[2];
if(crosspoint_cc(C[i],C[j],p[0],p[1])>0){
for(int k=0;k<2;k++){
int cnt = 0;
for(int l=0;l<N;l++){
if((C[l].c-p[k]).norm()<=1+EPS) cnt++;
}
ans = max(ans,cnt);
}
}
}
}
printf("%d\n",ans);
}
} | a.cc: In function 'int ccw(Point, Point, Point)':
a.cc:85:14: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
85 | if(cross(v1,v2)>EPS) return +1; //a->b->c 縺悟渚譎りィ亥屓繧? if(cross(v1,v2)<-EPS) return -1; //a->b->c 縺梧凾險亥屓繧? if(dot(v1,v2)<-EPS) return +2; //c縺径-b繧医j蠕後m c<-a->b
| ^~
| __pstl::execution::v1
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
from /usr/include/c++/14/algorithm:86,
from a.cc:4:
/usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
19 | inline namespace v1
| ^~
a.cc:86:22: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
86 | if(v2.norm()-v1.norm()>EPS) return -2; //c縺径-b繧医j蜑?a->b->c
| ^~
| __pstl::execution::v1
/usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
19 | inline namespace v1
| ^~
a.cc: In function 'int contain_gp(Polygon, Point)':
a.cc:146:30: error: a function-definition is not allowed here before '{' token
146 | Polygon andrewScan(Polygon s){
| ^
a.cc:189:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
189 | int main(){
| ^~
a.cc:189:9: note: remove parentheses to default-initialize a variable
189 | int main(){
| ^~
| --
a.cc:189:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:189:11: error: a function-definition is not allowed here before '{' token
189 | int main(){
| ^
a.cc:214:2: error: expected '}' at end of input
214 | }
| ^
a.cc:134:34: note: to match this '{'
134 | int contain_gp(Polygon g,Point p){
| ^
|
s272749723 | p00090 | C++ | #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;
#define EPS 1e-8
#define INF 1000000
struct Point{
double x,y;
Point(){}
Point(double _x,double _y){
x=_x; y=_y;
}
Point operator +(const Point p)const{
return Point(x+p.x,y+p.y);
}
Point operator -(const Point p)const{
return Point(x-p.x,y-p.y);
}
Point operator *(const double d)const{
return Point(x*d,y*d);
}
bool operator <(const Point &p)const{
if(x==p.x) return y<p.y;
return x<p.x;
}
bool operator ==(const Point &p)const{
return abs(x-p.x)<EPS && abs(y-p.y)<EPS;
}
double norm(){
return x*x+y*y;
}
bool input(){
if(cin>>x>>y) return true;
return false;
}
};
struct Line{
Point a,b;
Line(){}
Line(Point _a,Point _b){
a=_a; b=_b;
}
bool input(){
if(a.input() && b.input()) return true;
return false;
}
};
struct Circle{
Point c;
double r;
Circle(){}
Circle(Point _c,double _r){
c=_c; r=_r;
}
};
typedef Point Vector;
typedef vector<Point> Polygon;
typedef Line Segment;
double dot(Point p,Point q){
return p.x*q.x+p.y*q.y;
}
double cross(Point p,Point q){
return p.x*q.y-q.x*p.y;
}
int ccw(Point a,Point b,Point c){ //a,b,c,縺ッ蜈ィ縺ヲ逡ー縺ェ繧? Vector v1 = b-a;
Vector v2 = c-a;
if(cross(v1,v2)>EPS) return +1; //a->b->c 縺悟渚譎りィ亥屓繧? if(cross(v1,v2)<-EPS) return -1; //a->b->c 縺梧凾險亥屓繧? if(dot(v1,v2)<-EPS) return +2; //c縺径-b繧医j蠕後m c<-a->b
if(v2.norm()-v1.norm()>EPS) return -2; //c縺径-b繧医j蜑?a->b->c
return 0; //c縺径-b荳?a->c->b
}
Point project(Segment s,Point p){
Vector v1 = s.b-s.a;
Vector v2 = p-s.a;
double r = dot(v1,v2)/v1.norm();
return s.a+v1*r;
}
Point reflect(Segment s,Point p){
return p+(project(s,p)-p)*2.0;
}
bool intersect_ll(Line l,Line m){
return ccw(l.a,l.b,m.a)*ccw(l.a,l.b,m.b)<=0 && ccw(m.a,m.b,l.a)*ccw(m.a,m.b,l.b)<=0;
}
bool crosspoint_ss(Segment s,Segment t,Point &p){
Vector a1,a2,b1,b2;
a1 = s.b-s.a; a2 = t.b-t.a;
b1 = t.a-s.a; b2 = s.a-t.b;
double s1,s2;
s1 = cross(a1,b1)/2; s2 = cross(a1,b2)/2;
if(s1+s2<EPS) return false; //蟷ウ陦? p = Point(t.a.x+a2.x*s1/(s1+s2),t.a.y+a2.y*s1/(s1+s2));
return true;
}
int crosspoint_ll(Line l,Line m,Point &p){
if(intersect_ll(l,m)==false) return 0; //莠、蟾ョ縺励※縺?↑縺? if(crosspoint_ss(l,m,p)==true) return 1;
return -1; //莠、轤ケ縺檎┌髯仙?(蟷ウ陦後°縺、莠、蟾ョ)
}
int crosspoint_cc(Circle c1,Circle c2,Point &p1,Point &p2){
double d,a,t;
d = sqrt((c2.c-c1.c).norm());
if(abs(c1.c.x-c2.c.x)<EPS && abs(c1.c.y-c2.c.y)<EPS && abs(c1.r-c2.r)<EPS)
return -1; //2縺、縺ョ蜀?′驥阪↑縺」縺ヲ縺?k
if(d<abs(c1.r-c2.r) || c1.r+c2.r<d) return 0; //髮「繧後※縺?k縺句?蛹? a = acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d));
t = atan2(c2.c.y-c1.c.y,c2.c.x-c1.c.x);
p1 = Point(c1.c.x+c1.r*cos(t+a),c1.c.y+c1.r*sin(t+a));
p2 = Point(c1.c.x+c1.r*cos(t-a),c1.c.y+c1.r*sin(t-a));
if(abs(p1.x-p2.x)<EPS && abs(p1.y-p2.y)<EPS) return 1; //莠、轤ケ縺?縺、
return 2; //莠、轤ケ縺?縺、
}
//螟夊ァ貞ス「縺ョ轤ケ縺ョ蜀?桁
int contain_gp(Polygon g,Point p){
Line l = Line(p,Point(INF,p.y));
int cnt = 0, n = g.size();
for(int i=0;i<n;i++){
Vector a = g[i]-p;
Vector b = g[(i+1)%n]-p;
if(ccw(g[i],g[(i+1)%n],p)==0) return 1; //邱壼?荳? if(a.y>b.y) swap(a,b);
if(a.y<=EPS && EPS<b.y && cross(a,b)>EPS) cnt++;
}
if((cnt&1)==1) return 2; //蜀?桁縺励※縺?k
return 0; //蜀?桁縺励※縺?↑縺?}
Polygon andrewScan(Polygon s){
if(s.size()<=2) return s;
sort(s.begin(),s.end());
Polygon g;
for(int i=0;i<s.size();i++){
for(int n=g.size(); n>=2 && ccw(g[n-2],g[n-1],s[i])!=-1; n--){
g.pop_back();
}
g.push_back(s[i]);
}
int upper_n = g.size();
for(int i=s.size()-2;i>=0;i--){
for(int n=g.size(); n>upper_n && ccw(g[n-2],g[n-1],s[i])!=-1; n--){
g.pop_back();
}
g.push_back(s[i]);
}
reverse(g.begin(),g.end());
g.pop_back();
return g;
}
struct Data{
int n;
double dist;
Data(){}
Data(int _n,double _dist){
n=_n; dist=_dist;
}
bool operator<(const Data &a)const{
return dist>a.dist;
}
};
struct Edge{
int to;
double dist;
Edge(){}
Edge(int _to,double _dist){
to=_to; dist=_dist;
}
};
int main(){
int N;
Circle C[100];
while(cin>>N,N){
for(int i=0;i<N;i++){
scanf("%lf,%lf",&C[i].c.x,&C[i].c.y);
C[i].r = 1;
}
int ans = 1;
for(int i=0;i<N;i++){
for(int j=i+1;j<N;j++){
Point p[2];
if(crosspoint_cc(C[i],C[j],p[0],p[1])>0){
for(int k=0;k<2;k++){
int cnt = 0;
for(int l=0;l<N;l++){
if((C[l].c-p[k]).norm()<=1+EPS) cnt++;
}
ans = max(ans,cnt);
}
}
}
}
printf("%d\n",ans);
}
} | a.cc: In function 'int ccw(Point, Point, Point)':
a.cc:85:14: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
85 | if(cross(v1,v2)>EPS) return +1; //a->b->c 縺悟渚譎りィ亥屓繧? if(cross(v1,v2)<-EPS) return -1; //a->b->c 縺梧凾險亥屓繧? if(dot(v1,v2)<-EPS) return +2; //c縺径-b繧医j蠕後m c<-a->b
| ^~
| __pstl::execution::v1
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
from /usr/include/c++/14/algorithm:86,
from a.cc:4:
/usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
19 | inline namespace v1
| ^~
a.cc:86:22: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
86 | if(v2.norm()-v1.norm()>EPS) return -2; //c縺径-b繧医j蜑?a->b->c
| ^~
| __pstl::execution::v1
/usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
19 | inline namespace v1
| ^~
a.cc: In function 'int contain_gp(Polygon, Point)':
a.cc:146:30: error: a function-definition is not allowed here before '{' token
146 | Polygon andrewScan(Polygon s){
| ^
a.cc:189:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
189 | int main(){
| ^~
a.cc:189:9: note: remove parentheses to default-initialize a variable
189 | int main(){
| ^~
| --
a.cc:189:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:189:11: error: a function-definition is not allowed here before '{' token
189 | int main(){
| ^
a.cc:214:2: error: expected '}' at end of input
214 | }
| ^
a.cc:134:34: note: to match this '{'
134 | int contain_gp(Polygon g,Point p){
| ^
|
s934893976 | p00090 | C++ | #include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
// ------ Classes ------ //
class Point {
public:
long double px, py;
Point() : px(0), py(0) {};
Point(long double px_, long double py_) : px(px_), py(py_) {};
bool operator==(const Point& p) const { return px == p.px && py == p.py; }
bool operator!=(const Point& p) const { return px != p.px || py != p.py; }
bool operator<(const Point& p) const { return px < p.px ? true : (px == p.px && py < p.py); }
bool operator>(const Point& p) const { return px > p.px ? true : (px == p.px && py > p.py); }
bool operator<=(const Point& p) const { return !(Point(px, py) > p); }
bool operator>=(const Point& p) const { return !(Point(px, py) < p); }
Point operator+(const Point& p) const { return Point(px + p.px, py + p.py); }
Point operator-(const Point& p) const { return Point(px - p.px, py - p.py); }
Point operator/(long double d) const { return Point(px / d, py / d); }
friend Point operator*(const Point p, long double d) { return Point(p.px * d, p.py * d); }
friend Point operator*(long double d, const Point& p) { return p * d; }
Point& operator+=(const Point& p1) { px += p1.px, py += p1.py; return *this; }
Point& operator-=(const Point& p1) { px -= p1.px, py -= p1.py; return *this; }
Point& operator*=(long double d) { px *= d, py *= d; return *this; }
Point& operator/=(long double d) { px /= d, py /= d; return *this; }
};
class Circle {
public:
Point p; long double r;
Circle() : p(Point()), r(0.0L) {};
Circle(Point p_) : p(p_), r(0.0L) {};
Circle(Point p_, long double r_) : p(p_), r(r_) {};
Circle(long double x_, long double y_) : p(Point(x_, y_)), r(0.0L) {};
Circle(long double x_, long double y_, long double r_) : p(Point(x_, y_)), r(r_) {};
bool operator==(const Circle& c) const { return p == c.p && r == c.r; }
bool operator!=(const Circle& c) const { return !(Circle(p, r) == c); }
};
// ------ Functions ------ //
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
Point pol(long double r, long double d) { return Point(cosl(d) * r, sinl(d) * r); }
int ccw(const Point& p0, const Point& p1, const Point& p2) {
Point a = p1 - p0, b = p2 - p0;
if (crs(a, b) > 1e-10) return 1;
if (crs(a, b) < -1e-10) return -1;
if (dot(a, b) < -1e-10) return 2;
if (norm(a) < norm(b)) return -2;
return 0;
}
bool its(const Point& p1, const Point& p2, const Point& p3, const Point& p4) { return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0); }
long double dst(const Point& a, const Point& b) { return abs(b - a); }
vector<Point> crp(Circle c1, Circle c2) {
double d = abs(c1.p - c2.p);
double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
double t = arg(c2.p - c1.p);
return { c1.p + pol(c1.r, t + a), c1.p + pol(c1.r, t - a) };
}
// ------ Main ------ //
int n; char c; vector<Circle> v;
int main() {
while (cin >> n, n) {
v.resize(n);
for (int i = 0; i < n; i++) cin >> v[i].p.px >> c >> v[i].p.py, v[i].r = 1;
int ret = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
vector<Point> w = crp(v[i], v[j]);
for (int k = 0; k < 2; k++) {
int s = 0;
for (int l = 0; l < n; l++) {
if (dst(w[k], v[l]) <= 1.0L + 1e-10) s++;
}
ret = max(ret, s);
}
}
}
cout << ret << endl;
}
} | a.cc: In function 'int main()':
a.cc:78:56: error: invalid initialization of reference of type 'const Point&' from expression of type '__gnu_cxx::__alloc_traits<std::allocator<Circle>, Circle>::value_type' {aka 'Circle'}
78 | if (dst(w[k], v[l]) <= 1.0L + 1e-10) s++;
| ~~~^~~~~~~~~~~~
a.cc:57:46: note: in passing argument 2 of 'long double dst(const Point&, const Point&)'
57 | long double dst(const Point& a, const Point& b) { return abs(b - a); }
| ~~~~~~~~~~~~~^
|
s599486947 | p00090 | C++ | include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
struct Point { long double px, py; };
struct Circle { Point p; long double r; };
Point pol(long double r, long double d) { return Point{ cosl(d) * r, sinl(d) * r }; }
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
Point Minus(Point a, Point b) { return Point{ a.px - b.px,a.py - b.py }; }
Point Plus(Point a, Point b) { return Point{ a.px + b.px,a.py + b.py }; }
long double dst(const Point& a, const Point& b) { return abs(Minus(b, a)); }
pair<Point, Point> crp(Circle c1, Circle c2) {
double d = abs(Minus(c1.p, c2.p));
double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
double t = arg(Minus(c2.p, c1.p));
return make_pair(Plus(c1.p, pol(c1.r, t + a)), Plus(c1.p, pol(c1.r, t - a)));
}
int main() {
Circle x[100]; int n; vector<Point>y;
while (true) {
cin >> n; char ch; if (n == 0)break;
for (int i = 0; i < n; i++) { cin >> x[i].p.px >> ch >> x[i].p.py; x[i].r = 1.0l; }
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
y.push_back(crp(x[i], x[j]).first);
y.push_back(crp(x[i], x[j]).second);
}
}
int maxn = 0;
for (int i = 0; i < y.size(); i++) {
int cnt = 0;
for (int j = 0; j < n; j++) {
if (dst(y[i], x[j].p) <= 1.0l) { cnt++; }
}
maxn = max(maxn, cnt);
}
cout << maxn << 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/cmath:45,
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,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/stdlib.h:32,
from /usr/include/c++/14/bits/std_abs.h:38,
from /usr/include/c++/14/cmath:49:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:65:
/usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type
125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
+++ |+#include <cstddef>
1 | // Types used in iterator implementation -*- C++ -*-
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type
214 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type
225 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type
112 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
65 | #include <debug/assertions.h>
+++ |+#include <cstddef>
66 | #include <bits/stl_iterator_base_types.h>
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type
118 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_iterator.h:67,
from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits |
s293810756 | p00090 | C++ | #include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
struct Point { long double px, py; };
struct Circle { Point p; long double r; };
Point pol(long double r, long double d) { return Point{ cosl(d) * r, sinl(d) * r }; }
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
inline Point Minus(Point a, Point b) { return Point{ a.px - b.px,a.py - b.py }; }
inline Point Plus(Point a, Point b) { return Point{ a.px + b.px,a.py + b.py }; }
long double dst(const Point& a, const Point& b) { return abs(Minus(b, a)); }
pair<Point, Point> crp(Circle c1, Circle c2) {
double d = abs(Minus(c1.p, c2.p));
double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
double t = arg(Minus(c2.p, c1.p));
return make_pair(Plus(c1.p, pol(c1.r, t + a)), Plus(c1.p, pol(c1.r, t - a)));
}
int main() {
Circle x[100]; int n;
while (true) {
cin >> n; char ch; if (n == 0)break;
for (int i = 0; i < n; i++) { cin >> x[i].p.px >> ch >> x[i].p.py; x[i].r = 1.0l; }
int ret = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
vector<Point> z = crp(x[i], x[j]);
for(int k = 0; k < 2; k++) {
int cnt = 0;
for(int l = 0; l < n; l++) {
if(dst(z[k], x[l].p) <= 1.0L) cnt++;
}
ret = max(ret, cnt);
}
}
}
cout << ret << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:38: error: conversion from 'std::pair<Point, Point>' to non-scalar type 'std::vector<Point>' requested
29 | vector<Point> z = crp(x[i], x[j]);
| ~~~^~~~~~~~~~~~
|
s670195205 | p00090 | C++ | #include <cstdio>
#include <vector>
#include <complex>
using namespace std;
#define EPS 1e-8
#define EQ(x, y) (abs((x)-(y)) < EPS)
typedef complex<double> Point;
struct Circle {
Point c;
double r;
};
int n;
Circle cs[100000];
vector<Point> CrossPointCC(Circle a, Circle b) {
vector<Point> ret;
double d = abs(b.c-a.c);
double rc = (d*d + a.r*a.r - b.r*b.r) / (2*d);
double dfr = a.r*a.r - rc*rc;
if (EQ(dfr, 0.0)) dfr = 0.0;
else if (dfr < 0.0) return ret;
double rs = sqrt(dfr);
Point sgn = (b.c-a.c) / d;
ret.push_back(a.c + sgn * Point(rc, rs));
if (dfr > 0.0) {
ret.push_back(b.c + sgn * Point(rc, -rs));
}
return ret;
}
int main() {
while (1) {
scanf("%d", &n);
if (n == 0) return 0;
for (int i=0; i<n; i++) {
double x, y;
scanf("%lf,%lf", &x, &y);
cs[i] = {Point(x, y), 1.0};
}
vector<Point> candidates;
for (int i=0; i<n; i++) {
for (int j=i+1; j<n; j++) {
vector<Point> ps = CrossPointCC(cs[i], cs[j]);
candidates.insert(candidates.end(), ps.begin(), ps.end());
}
}
int ans = 1;
for (int i=0; i<candidates.size(); i++) {
Point p = candidates[i];
if (p.X < 0.0 || p.X > 10.0) continue;
if (p.Y < 0.0 || p.Y > 10.0) continue;
int cnt = 0;
for (int i=0; i<n; i++) {
if (abs(cs[i].c-p) < 1.0+EPS) cnt++;
}
ans = max(ans, cnt);
}
printf("%d\n", ans);
}
} | a.cc: In function 'int main()':
a.cc:59:13: error: 'Point' {aka 'class std::complex<double>'} has no member named 'X'
59 | if (p.X < 0.0 || p.X > 10.0) continue;
| ^
a.cc:59:26: error: 'Point' {aka 'class std::complex<double>'} has no member named 'X'
59 | if (p.X < 0.0 || p.X > 10.0) continue;
| ^
a.cc:60:13: error: 'Point' {aka 'class std::complex<double>'} has no member named 'Y'
60 | if (p.Y < 0.0 || p.Y > 10.0) continue;
| ^
a.cc:60:26: error: 'Point' {aka 'class std::complex<double>'} has no member named 'Y'
60 | if (p.Y < 0.0 || p.Y > 10.0) continue;
| ^
|
s099049305 | p00090 | C++ | #include<iostream>
#include<math.h>
using namespace std;
int n,a[101][101];
double x[101],y[101];
bool used[101];
int dfs(int x){
int res=1;
used[x]=1;
for(int i=0;i<n;i++)
if(a[x][i]&&(!used[i]))
res+=dfs(i);
return res;
}
int main(){
while(cin>>n,n){
for(int i=0;i<n;i++)
scanf("%lf,%lf",&x[i],&y[i]);
memset(a,0,sizeof(a));
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)if(i!=j)
if(sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))<=2.0)a[i][j]=1;
memset(used,0,sizeof(used));
int ans=0;
for(int i=0;i<n;i++)
if(!used[i])ans=max(ans,dfs(i));
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:19:5: error: 'memset' was not declared in this scope
19 | memset(a,0,sizeof(a));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<math.h>
+++ |+#include <cstring>
3 | using namespace std;
|
s425926835 | p00090 | C++ | #include<iostream>
#include<math.h>
using namespace std;
int n,a[101][101];
double x[101],y[101];
bool used[101];
int dfs(int x){
int res=1;
used[x]=1;
for(int i=0;i<n;i++)
if(a[x][i]&&(!used[i]))
res+=dfs(i);
return res;
}
int main(){
while(cin>>n,n){
for(int i=0;i<n;i++)
scanf("%lf,%lf",&x[i],&y[i]);
memset(a,0,sizeof(a));
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)if(i!=j)
if(sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))<=2.0)a[i][j]=1;
memset(used,0,sizeof(used));
int ans=0;
for(int i=0;i<n;i++)
if(!used[i])ans=max(ans,dfs(i));
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:19:5: error: 'memset' was not declared in this scope
19 | memset(a,0,sizeof(a));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<math.h>
+++ |+#include <cstring>
3 | using namespace std;
|
s755172247 | p00090 | C++ | #include<iostream>
#include<math.h>
using namespace std;
int n,a[101][101];
double x[101],y[101];
bool used[101];
int dfs(int x){
int res=1;
used[x]=1;
for(int i=0;i<n;i++)
if(a[x][i]&&(!used[i]))
res+=dfs(i);
return res;
}
int main(){
while(cin>>n,n){
for(int i=0;i<n;i++)
scanf("%lf,%lf",&x[i],&y[i]);
memset(a,0,sizeof(a));
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)if(i!=j)
if(sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))<=1.9999999999)a[i][j]=1;
memset(used,0,sizeof(used));
int ans=0;
for(int i=0;i<n;i++)
if(!used[i])ans=max(ans,dfs(i));
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:19:5: error: 'memset' was not declared in this scope
19 | memset(a,0,sizeof(a));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<math.h>
+++ |+#include <cstring>
3 | using namespace std;
|
s866472420 | p00090 | C++ | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
using namespace std;
template <typename _Ty>
std::ostream& operator << (std::ostream& ostr, const std::vector<_Ty> v) {
if (v.empty()) return ostr;
for (auto itr = v.begin(); itr != v.end(); itr++) {
if (itr == v.begin()) {
std::cout << "{" << *itr;
}
else std::cout << ", " << *itr;
}
std::cout << "}";
return ostr;
}
class Point2i {
public:
int x;
int y;
Point2i() {
this->x = x; this->y = y;
}
Point2i(int x, int y) {
this->x = x; this->y = y;
}
friend std::ostream& operator << (std::ostream& ostr, const Point2i& p) {
std::cout << "{" << p.x << ", " << p.y << "}";
return ostr;
}
};
class Point2f {
public:
double x;
double y;
Point2f() {
this->x = x; this->y = y;
}
Point2f(double x, double y) {
this->x = x; this->y = y;
}
friend std::ostream& operator << (std::ostream& ostr, const Point2f& p) {
std::cout << "{" << p.x << ", " << p.y << "}";
return ostr;
}
};
double distance(Point2f p1, Point2f p2) {
return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
bool isOverlapped(Point2f p1, Point2f p2)
{
return distance(p1, p2) < 2.0;
}
pair<Point2f, Point2f> intersection(Point2f p1, Point2f p2) {
double dist = distance(p1, p2);
double costheta = dist / 2;
double sintheta = sqrt(1 - costheta * costheta);
Point2f i1, i2;
i1.x = p1.x + (costheta * (p2.x - p1.x) - sintheta * (p2.y - p1.y)) / dist;
i1.y = p1.y + (sintheta * (p2.x - p1.x) + costheta * (p2.y - p1.y)) / dist;
i2.x = p1.x + (costheta * (p2.x - p1.x) + sintheta * (p2.y - p1.y)) / dist;
i2.y = p1.y + (-sintheta * (p2.x - p1.x) + costheta * (p2.y - p1.y)) / dist;
return pair<Point2f, Point2f>(i1, i2);
}
bool AOJ0090()
{
int n;
cin >> n;
if (n == 0) return false;
vector<Point2f> p;
vector<bool> b(n, false);
vector<Point2i> pair;
for (int i = 0; i < n; i++) {
double x, y;
scanf("%lf,%lf", &x, &y);
p.push_back(Point2f(x, y));
}
for (int i = 0; i < p.size() - 1; i++) {
for (int j = i + 1; j < p.size(); j++) {
if (isOverlapped(p[i], p[j])) {
pair.push_back(Point2i(i, j));
b[i] = b[j] = true;
//cout << "(" << i + 1 << ", " << j + 1 << ")" << endl;
}
}
}
//cout << pair << endl;
//cout << b << endl;
int maxOverlaps = 1;
for (auto itr = pair.begin(); itr != pair.end(); itr++) {
int np1 = itr->x, np2 = itr->y;
auto inter = intersection(p[np1], p[np2]);
int overlaps[2] = { 2, 2 };
for (int i = 0; i < n; i++) {
if (!b[i] || i == np1 || i == np2) continue;
if (distance(inter.first, p[i]) < 1) overlaps[0]++;
if (distance(inter.second, p[i]) < 1) overlaps[1]++;
}
maxOverlaps = max(maxOverlaps, max(overlaps[0], overlaps[1]));
}
cout << maxOverlaps << endl;
return true;
}
int main()
{
while (AOJ0090()) {
}
return 0;
} | a.cc: In function 'double distance(Point2f, Point2f)':
a.cc:67:16: error: 'sqrt' was not declared in this scope
67 | return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
| ^~~~
a.cc: In function 'std::pair<Point2f, Point2f> intersection(Point2f, Point2f)':
a.cc:78:27: error: 'sqrt' was not declared in this scope
78 | double sintheta = sqrt(1 - costheta * costheta);
| ^~~~
|
s191222746 | p00090 | C++ | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
using namespace std;
template <typename _Ty>
std::ostream& operator << (std::ostream& ostr, const std::vector<_Ty> v) {
if (v.empty()) return ostr;
for (auto itr = v.begin(); itr != v.end(); itr++) {
if (itr == v.begin()) {
std::cout << "{" << *itr;
}
else std::cout << ", " << *itr;
}
std::cout << "}";
return ostr;
}
class Point2i {
public:
int x;
int y;
Point2i() {
this->x = x; this->y = y;
}
Point2i(int x, int y) {
this->x = x; this->y = y;
}
friend std::ostream& operator << (std::ostream& ostr, const Point2i& p) {
std::cout << "{" << p.x << ", " << p.y << "}";
return ostr;
}
};
class Point2f {
public:
double x;
double y;
Point2f() {
this->x = x; this->y = y;
}
Point2f(double x, double y) {
this->x = x; this->y = y;
}
friend std::ostream& operator << (std::ostream& ostr, const Point2f& p) {
std::cout << "{" << p.x << ", " << p.y << "}";
return ostr;
}
};
double distance(Point2f p1, Point2f p2) {
return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
bool isOverlapped(Point2f p1, Point2f p2)
{
return distance(p1, p2) < 2.0;
}
pair<Point2f, Point2f> intersection(Point2f p1, Point2f p2) {
double dist = distance(p1, p2);
double costheta = dist / 2;
double sintheta = sqrt(1 - costheta * costheta);
Point2f i1, i2;
i1.x = p1.x + (costheta * (p2.x - p1.x) - sintheta * (p2.y - p1.y)) / dist;
i1.y = p1.y + (sintheta * (p2.x - p1.x) + costheta * (p2.y - p1.y)) / dist;
i2.x = p1.x + (costheta * (p2.x - p1.x) + sintheta * (p2.y - p1.y)) / dist;
i2.y = p1.y + (-sintheta * (p2.x - p1.x) + costheta * (p2.y - p1.y)) / dist;
return pair<Point2f, Point2f>(i1, i2);
}
bool AOJ0090()
{
int n;
cin >> n;
if (n == 0) return false;
vector<Point2f> p;
vector<bool> b(n, false);
vector<Point2i> pair;
for (int i = 0; i < n; i++) {
double x, y;
scanf("%lf,%lf", &x, &y);
p.push_back(Point2f(x, y));
}
for (int i = 0; i < p.size() - 1; i++) {
for (int j = i + 1; j < p.size(); j++) {
if (isOverlapped(p[i], p[j])) {
pair.push_back(Point2i(i, j));
b[i] = b[j] = true;
//cout << "(" << i + 1 << ", " << j + 1 << ")" << endl;
}
}
}
//cout << pair << endl;
//cout << b << endl;
int maxOverlaps = 1;
for (auto itr = pair.begin(); itr != pair.end(); itr++) {
int np1 = itr->x, np2 = itr->y;
auto inter = intersection(p[np1], p[np2]);
int overlaps[2] = { 2, 2 };
for (int i = 0; i < n; i++) {
if (!b[i] || i == np1 || i == np2) continue;
if (distance(inter.first, p[i]) < 1) overlaps[0]++;
if (distance(inter.second, p[i]) < 1) overlaps[1]++;
}
maxOverlaps = max(maxOverlaps, max(overlaps[0], overlaps[1]));
}
cout << maxOverlaps << endl;
return true;
}
int main()
{
while (AOJ0090()) {
}
return 0;
} | a.cc: In function 'double distance(Point2f, Point2f)':
a.cc:67:16: error: 'sqrt' was not declared in this scope
67 | return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
| ^~~~
a.cc: In function 'std::pair<Point2f, Point2f> intersection(Point2f, Point2f)':
a.cc:78:27: error: 'sqrt' was not declared in this scope
78 | double sintheta = sqrt(1 - costheta * costheta);
| ^~~~
|
s993324760 | p00090 | C++ | import math
def overlap(p1, p2, d):
return (p1[0] - p2[0])**2 + (p1[1] - p2[1])**2 <= d
def intersection(o1,o2):
a = 2*(o2[0] - o1[0])
b = 2*(o2[1] - o1[1])
c = (o1[0] - o2[0])*(o1[0] + o2[0]) + (o1[1] - o2[1])*(o1[1] + o2[1])
a2 = a**2 + b**2
b2 = a*c + a*b*o1[1] - b**2*o1[0]
c2 = b**2*(o1[0]**2 + o1[1]**2 - 1) + c**2 + 2*b*c*o1[1]
x1 = (-b2 + math.sqrt(b2**2 - a2*c2))/a2
x2 = (-b2 - math.sqrt(b2**2 - a2*c2))/a2
if b == 0:
y1 = (o1[1] + o2[1])/2
y2 = (o1[1] + o2[1])/2
else:
y1 = -(a*x1 + c)/b
y2 = -(a*x2 + c)/b
if b2**2 - a2*c2 < 10e-6:
return [x1, y1], [None, None]
else:
return [x1, y1], [x2, y2]
while True:
n = int(input())
if n == 0:
break
p = []
for i in range(n):
p.append(list(map(float, input().split(","))))
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
if not overlap(p[i], p[j], 4):
continue
p1, p2 = intersection(p[i], p[j])
cnt1 = 0
cnt2 = 0
for k in range(n):
if overlap(p1, p[k], 1):
cnt1 += 1
if p2[0] != None and overlap(p2, p[k], 1):
cnt2 += 1
ans = max([ans, cnt1, cnt2])
print(ans)
| a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s283191418 | p00090 | C++ | import math
def overlap(p1, p2, d):
return (p1[0] - p2[0])**2 + (p1[1] - p2[1])**2 <= d
def intersection(o1,o2):
a = 2*(o2[0] - o1[0])
b = 2*(o2[1] - o1[1])
c = (o1[0] - o2[0])*(o1[0] + o2[0]) + (o1[1] - o2[1])*(o1[1] + o2[1])
a2 = a**2 + b**2
b2 = a*c + a*b*o1[1] - b**2*o1[0]
c2 = b**2*(o1[0]**2 + o1[1]**2 - 1) + c**2 + 2*b*c*o1[1]
x1 = (-b2 + math.sqrt(b2**2 - a2*c2))/a2
x2 = (-b2 - math.sqrt(b2**2 - a2*c2))/a2
if b == 0:
y1 = (o1[1] + o2[1])/2
y2 = (o1[1] + o2[1])/2
else:
y1 = -(a*x1 + c)/b
y2 = -(a*x2 + c)/b
if b2**2 - a2*c2 < 10e-6:
return [x1, y1], [None, None]
else:
return [x1, y1], [x2, y2]
while True:
n = int(input())
if n == 0:
break
p = []
for i in range(n):
p.append(list(map(float, input().split(","))))
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
if not overlap(p[i], p[j], 4):
continue
elif overlap(p[i], p[j], 10e-6):
continue
p1, p2 = intersection(p[i], p[j])
print(p1,p2)
cnt1 = 0
cnt2 = 0
for k in range(n):
if overlap(p1, p[k], 1):
cnt1 += 1
if p2[0] != None and overlap(p2, p[k], 1):
cnt2 += 1
print(ans, cnt1, cnt2)
ans = max([ans, cnt1, cnt2])
print(ans)
| a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s664356551 | p00090 | C++ | #include <cstdio>
#include <cmath>
#include <bitset>
using namespace std;
double x[100], y[100];
bitset<100> bits[100];
int main()
{
int n;
while (true) {
scanf("%d", &n);
if (n == 0) break;
for (int i = 0; i < n; ++i) scanf("%lf,%lf", &x[i], &y[i]);
for (int i = 0; i < n; ++i) bits[i].reset();
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
double d = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
if (d > 4.0) continue;
bits[i][j] = 1;
//if (d <= 4.0000000001) bits[i][j] = 1;
}
}
int res = 0;
for (int i = 0; i < n; ++i) {
for (int j = i; j < n; ++j)
if (bits[i][j]) bits[i] &= bits[j];
if (res < bits[i].count()) res = bits[i].count();
}
printf("%d\n", res);
}
return 0; | a.cc: In function 'int main()':
a.cc:33:18: error: expected '}' at end of input
33 | return 0;
| ^
a.cc:8:1: note: to match this '{'
8 | {
| ^
|
s533544038 | p00090 | C++ | #include <iostream>
#include <cstdlib>
#include <vector>
#include <cstdio>
#include <algorithm>
#define EPS (1e-5)
using namespace std;
class Point{
public:
double x, y;
Point ( double x =0, double y=0): x(x), y(y){}
Point operator + ( Point p ){ return Point(x + p.x, y + p.y); }
Point operator - ( Point p ){ return Point(x - p.x, y - p.y); }
Point operator * ( double a ){ return Point(a*x, a*y); }
double abs() { return sqrt(norm());}
double norm() { return x*x + y*y; }
bool operator < ( const Point &p ) const{
return x != p.x ? x < p.x : y < p.y;
}
bool operator == ( const Point &p ) const {
return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
}
};
Point p[100];
int n;
vector<Point> cross(Point a, Point b){
vector<Point> res;
if(fabs((b-a).abs()-2.0)<EPS){
Point c = a + b;
res.push_back( Point(c.x/2.0, c.y/2.0) );
}else if((b-a).abs()<2.0){
Point ab = b - a;
Point center = a + Point(ab.x/2.0,ab.y/2.0);
Point un1 = Point(-ab.y/ab.abs(), ab.x/ab.abs());
Point un2 = Point(ab.y/ab.abs(), -ab.x/ab.abs());
double dist = sqrt(1.0 - pow(ab.abs() /2.0, 2.0));
Point c1 = center + un1 * dist;
Point c2 = center + un2 * dist;
res.push_back(c1);
res.push_back(c2);
}
return res;
}
int solve(){
int ans=1;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
vector<Point> c=cross(p[i], p[j]);
if(c.empty()) continue;
int cnt1=2, cnt2=2;
for(int k=0;k<n;k++){
if(i==k || j==k) continue;
if((c[0]-p[k]).abs()-1.0<EPS) cnt1++;
if(c.size()==2 && (c[1]-p[k]).abs()-1.0<EPS) cnt2++;
}
ans=max(ans, max(cnt1, cnt2));
}
}
return ans;
}
main(){
while(1){
cin >> n;
if(n==0) break;
for(int i=0;i<n;i++){
cin >> p[i].x;
getchar();
cin >> p[i].y;
}
cout << solve() << endl;
}
return 0;
} | a.cc: In member function 'double Point::abs()':
a.cc:19:25: error: 'sqrt' was not declared in this scope
19 | double abs() { return sqrt(norm());}
| ^~~~
a.cc: In member function 'bool Point::operator==(const Point&) const':
a.cc:25:12: error: 'fabs' was not declared in this scope; did you mean 'abs'?
25 | return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
| ^~~~
| abs
a.cc: In function 'std::vector<Point> cross(Point, Point)':
a.cc:33:6: error: 'fabs' was not declared in this scope; did you mean 'labs'?
33 | if(fabs((b-a).abs()-2.0)<EPS){
| ^~~~
| labs
a.cc:41:30: error: 'pow' was not declared in this scope
41 | double dist = sqrt(1.0 - pow(ab.abs() /2.0, 2.0));
| ^~~
a.cc:41:19: error: 'sqrt' was not declared in this scope
41 | double dist = sqrt(1.0 - pow(ab.abs() /2.0, 2.0));
| ^~~~
a.cc: At global scope:
a.cc:67:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
67 | main(){
| ^~~~
|
s226120885 | p00090 | C++ | | a.cc:1:1: error: extended character is not valid in an identifier
1 |
| ^
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: '\302\202\302\240' does not name a type
1 |
| ^~
|
s505808360 | p00090 | C++ | #include <stdio.h>
#include <list>
#include <string.h>
using namespace std;
#define SQ(x) ((x) * (x))
int n;
char G[100][100];
int check(int n)
{
int count;
int result;
bool loopflag;
bool chflag;
result = 0;
do {
loopflag = false;
result++;
do {
chflag = false;
for (int i = 0; i < n; i++){
count = 0;
for (int j = 0; j < n; j++){
count += G[i][j];
}
if (count > 0){
loopflag = true;
}
if (count <= result){
for (int j = 0; j < n; j++){
if (G[i][j] == 1){
chflag = true;
}
G[i][j] = G[j][i] = 0;
}
}
}/*
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
printf("%d ", G[i][j]);
}
puts("");
}
puts("");*/
} while (chflag == true);
} while (loopflag == true);
return (result);
}
int main(void)
{
double x[100], y[100];
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
memset(G, 0 , sizeof(G));
for (int i = 0; i < n; i++){
scanf("%lf,%lf", &x[i], &y[i]);
}
for (int i = 0; i < n; i++){
for (int j = i + 1; j < n; j++){
if (SQ(x[i] - x[j]) + SQ(y[i] - y[j]) <= 4.0){
G[i][j] = G[j][i] = 1;
}
}
}
/
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
printf("%d ", G[i][j]);
}
puts("");
}
puts("");*/
printf("%d\n", check(n));
}
return (0);
} | a.cc: In function 'int main()':
a.cc:78:17: error: expected primary-expression before '/' token
78 | /
| ^
a.cc:79:17: error: expected primary-expression before 'for'
79 | for (int i = 0; i < n; i++){
| ^~~
a.cc:79:33: error: 'i' was not declared in this scope
79 | for (int i = 0; i < n; i++){
| ^
a.cc:86:27: error: expected primary-expression before '/' token
86 | puts("");*/
| ^
|
s977660774 | p00090 | C++ | #include <stdio.h>
#include <list>
#include <string.h>
#include <sort>
using namespace std;
#define SQ(x) ((x) * (x))
typedef struct {
int index;
int degree;
} SORTDATA;
int n;
char G[100][100];
int degree[100];
int ans;
int check(char use[] , int depth)
{
char next[100];
int next_count;
if (depth > ans){
ans = depth;
}
memset(next, 1, sizeof(next));
next_count = n;
for (int i = 0; i < n; i++){
for (int j = 0; j < depth; j++){
if (G[use[j]][i] == 0 && next[i] == 1){
next[i] = 0;
next_count--;
}
}
}
if (next_count == 0){
return (0);
}
for (int i = 0; i < n; i++){
if (next[i] == 1 && degree[i] > ans - 1){
use[depth] = i;
check(use, depth + 1);
}
}
return (0);
}
int main(void)
{
double x[100], y[100];
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
memset(G, 0 , sizeof(G));
for (int i = 0; i < n; i++){
scanf("%lf,%lf", &x[i], &y[i]);
}
for (int i = 0; i < n; i++){
for (int j = i + 1; j < n; j++){
if (SQ(x[i] - x[j]) + SQ(y[i] - y[j]) <= 4.0){
G[i][j] = G[j][i] = 1;
}
}
}
SORT_DATA sort_data[100];
for (int i = 0; i < n; i++){
degree[i] = 0;
for (int j = 0; j < n; j++){
degree[i] += G[i][j];
}
}
char use[100];
memset(use, 0, sizeof(use));
ans = 1;
for (int i = 0; i < n; i++){
use[0] = i;
check(use, 1);
}
printf("%d\n", ans);
}
return (0);
} | a.cc:4:10: fatal error: sort: No such file or directory
4 | #include <sort>
| ^~~~~~
compilation terminated.
|
s563839608 | p00090 | C++ | #include <stdio.h>
#include <list>
#include <string.h>
#include <sort>
using namespace std;
#define SQ(x) ((x) * (x))
typedef struct {
int index;
int degree;
} SORTDATA;
int n;
char G[100][100];
int degree[100];
int ans;
int check(char use[] , int depth)
{
char next[100];
int next_count;
if (depth > ans){
ans = depth;
}
memset(next, 1, sizeof(next));
next_count = n;
for (int i = 0; i < n; i++){
for (int j = 0; j < depth; j++){
if (G[use[j]][i] == 0 && next[i] == 1){
next[i] = 0;
next_count--;
}
}
}
if (next_count == 0){
return (0);
}
for (int i = 0; i < n; i++){
if (next[i] == 1 && degree[i] > ans - 1){
use[depth] = i;
check(use, depth + 1);
}
}
return (0);
}
int main(void)
{
double x[100], y[100];
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
memset(G, 0 , sizeof(G));
for (int i = 0; i < n; i++){
scanf("%lf,%lf", &x[i], &y[i]);
}
for (int i = 0; i < n; i++){
for (int j = i + 1; j < n; j++){
if (SQ(x[i] - x[j]) + SQ(y[i] - y[j]) <= 4.0){
G[i][j] = G[j][i] = 1;
}
}
}
SORTDATA sort_data[100];
for (int i = 0; i < n; i++){
degree[i] = 0;
for (int j = 0; j < n; j++){
degree[i] += G[i][j];
}
}
char use[100];
memset(use, 0, sizeof(use));
ans = 1;
for (int i = 0; i < n; i++){
use[0] = i;
check(use, 1);
}
printf("%d\n", ans);
}
return (0);
} | a.cc:4:10: fatal error: sort: No such file or directory
4 | #include <sort>
| ^~~~~~
compilation terminated.
|
s340287704 | p00090 | C++ | #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const double EPS = 1e-8;
const double PI=acos(-1.0);
template<class T>
struct point{
T x,y;
point() : x(0), y(0) {}
point(const T& x,const T& y) : x(x), y(y) {}
point operator+(const point &a)const{ return point(x+a.x,y+a.y); }
point& operator+=(const point &a){x += a.x; y += a.y; return *this;}
point operator-(const point &a)const{ return point(x-a.x,y-a.y); }
point& operator-=(const point &a){x -= a.x; y -= a.y; return *this;}
point operator*(const double a)const{ return point(a*x,a*y); }
point& operator*=(const double a){ x *= a; y *= a; return *this;}
point operator/(const double a)const{ return point(x/a,y/a); }
point& operator/=(const double a){ x /= a; y /= a; return *this;}
//比較用
bool operator<(const point &a)const{return (x != a.x) ? (x < a.x) : (y < a.y);}
};
template<class T> T SQ(T x){ return x*x; }
template<class T> T dist2(const point<T> &a,const point<T> &b){return SQ(a.x-b.x)+SQ(a.y-b.y);}
template<class T> T abs(const point<T>& p){return sqrt(SQ(p.x) + SQ(p.y));}
template<class T> T dot(const point<T>& a,const point<T>& b)
{return a.x*b.x + a.y*b.y;}
template<class T> T cross(const point<T>& a,const point<T>& b)
{return a.x*b.y - a.y*b.x;}
template<class T> point<T> rot(const point<T>& a,const double theta){
return point<T>(a.x*cos(theta)-a.y*sin(theta),
a.x*sin(theta)+a.y*cos(theta));
}
template<class T>
double arg(const point<T> &a){ double t=atan2(a.y,a.x); return t<0?t+2*PI:t; }
enum{CCW=1,CW=-1,ON=0};
template<class T>
int ccw(const point<T> &a,const point<T> &b,const point<T> &c){
double rdir=cross(b-a,c-a);
if(rdir> EPS) return CCW; //cがabより上(反時計周り)
if(rdir<-EPS) return CW; // cがabより下(時計周り)
return ON; // a,b,cが一直線上
}
//多角形の面積
template<class T>
T area(const vector<point<T> >& v){
T ans = 0;
for (int i = 2; i < (int)v.size(); i++){
ans += cross(v[i-1] - v[0],v[i] - v[0]);
}
return abs(ans) / 2;
}
template<class T>
struct segment{
point<T> a,b;
segment() : a(point<T>()), b(point<T>()) {}
segment(const point<T>& a,const point<T>& b) : a(a), b(b) {}
};
template<class T>
struct line{
point<T> a,b;
line() : a(point<T>()), b(point<T>()) {}
line(const point<T>& a,const point<T>& b) : a(a), b(b) {}
};
bool intersect(const segment<double> &S1,const segment<double> &S2){
if(max(S1.a.x,S1.b.x)+EPS<min(S2.a.x,S2.b.x)
|| max(S1.a.y,S1.b.y)+EPS<min(S2.a.y,S2.b.y)
|| max(S2.a.x,S2.b.x)+EPS<min(S1.a.x,S1.b.x)
|| max(S2.a.y,S2.b.y)+EPS<min(S1.a.y,S1.b.y)) return false;
return ccw(S1.a,S1.b,S2.a)*ccw(S1.a,S1.b,S2.b)<=0
&& ccw(S2.a,S2.b,S1.a)*ccw(S2.a,S2.b,S1.b)<=0;
}
template<class T>
double dist2(const segment<T> &S,const point<T> &p){
if(dot(S.b-S.a,p-S.a)<=0) return dist2(p,S.a);
if(dot(S.a-S.b,p-S.b)<=0) return dist2(p,S.b);
return (double)SQ(cross(S.b-S.a,p-S.a)) / dist2(S.a,S.b);
}
template<class T>
double dist(const segment<T> &S,const point<T> &p){ return sqrt(dist2(S,p)); }
template<class T>
double dist(const segment<T> &S1,const segment<T> &S2){
if(intersect(S1,S2)) return 0;
return sqrt(min(min(dist2(S1,S2.a),dist2(S1,S2.b)),
min(dist2(S2,S1.a),dist2(S2,S1.b))));
}
template<class T>
double dist(const line<T> &L,const point<T> &p){
return sqrt((double)SQ(cross(L.b-L.a,p-L.a)) / dist2(L.a,L.b));
}
//凸包
template<class T>
vector< point<T> > convex_hull(vector< point<T> >& ps) {
int n = ps.size(), k = 0;
sort(ps.begin(), ps.end());
vector< point<T> > ch(2*n);
for (int i = 0; i < n; ch[k++] = ps[i++]) // lower-hull
while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--]) // upper-hull
while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
ch.resize(k-1);
return ch;
}
template<class T>
struct circle{
point<T> c;
T r;
circle(){}
circle(const point<T> &c, T& r) : c(c),r(r) {}
};
//a -- bの間の円が入った時の、a - b間の距離
//円の間に
template<class T>
double geodist(point<T> a,point<T> b,const circle<T> &C){
double r=C.r;
segment<T> s(a,b);
if(dist(s,C.c)>r)
return abs(a-b);
a-=C.c;
b-=C.c;
double L1=abs(a);
double t1=arg(a)+acos(r/L1); if(t1<0) t1+=2*PI;
double t2=arg(a)-acos(r/L1); if(t2<0) t2+=2*PI;
double L2=abs(b);
double t3=arg(b)+acos(r/L2); if(t3<0) t3+=2*PI;
double t4=arg(b)-acos(r/L2); if(t4<0) t4+=2*PI;
double theta=2*PI;
theta=min(theta,min(abs(t1-t4),2*PI-abs(t1-t4)));
theta=min(theta,min(abs(t2-t3),2*PI-abs(t2-t3)));
return sqrt(L1*L1-r*r)+sqrt(L2*L2-r*r)+r*theta;
}
//円の接点
template<class T>
vector< point<T> > GetContact(const point<T>& p,const point<T>& q,const double r){
point<T> a = p-q;
double s = SQ(a.x) + SQ(a.y);
double D = sqrt(s - SQ(r));
double dx = r * D * a.y / s;
double dy = r * D * a.x / s;
double bx = SQ(r) * a.x / s;
double by = SQ(r) * a.y / s;
point<T> ans(2);
ans[0].x = bx + dx;
ans[0].y = by - dy;
ans[1].x = bx - dx;
ans[1].y = by + dy;
ans[0] += q;
ans[1] += q;
return ans;
}
//todo : verifyしてないので、そのうち。
// 円が交差しているか 「=」は問によって変更する
template<class T>
int CircleCross(const circle<T> &c1,const circle<T> &c2){
double l = abs(c1.c - c2.c);
if(l >= c1.r + c2.r) return 3; //外部にある
if(l + c1.r <= c2.r) return 2; //c1 ⊃ c2
if(l + c2.r <= c1.r) return 1; //c1 ⊂ c2
return 0; //交差している
}
template<class T>
std::ostream& operator<<(std::ostream& os, const point<T>& point){return ( os << '(' << point.x << ',' << point.y << ')' );}
template<class T>
std::ostream& operator<<(std::ostream& os, const segment<T>& seg){return ( os << '{' << seg.a << ',' << seg.b << '}' );}
typedef point<double> P;
typedef segment<double> S;
typedef line<double> L;
typedef circle<double> C;
int n;
P pt[300];
int getCnt(P &o){
int cnt = 0;
for (int i = 0; i < n; i++){
if(abs(pt[i] - o) <= 1.0 + EPS)
cnt++;
}
return cnt;
}
int solve()
{
for (int i = 0; i < n; i++) scanf("%lf,%lf",&(pt[i].x),&(pt[i].y));
int ans = 1;
for (int i = 0; i < n; i++){
for (int j = i+1; j < n; j++){
P e = pt[j] - pt[i];
double len = abs(e);
if(len > 2.0 + EPS) continue;
P md = pt[i] + e / 2.0;
e /= len;
e = rot(e,PI/2);
double o_dis = sqrt(1.0 - SQ(len / 2));
e *= o_dis;
static int dir[] = {1,-1};
for (int k = 0; k < 2; k++){
e *= -1;
ans = max(ans,getCnt(md + e));
}
}
}
return ans;
}
int main(){
while(cin>>n,n){
cout << solve() << endl;
}
return 0;
} | a.cc: In function 'int solve()':
a.cc:263:41: error: cannot bind non-const lvalue reference of type 'P&' {aka 'point<double>&'} to an rvalue of type 'point<double>'
263 | ans = max(ans,getCnt(md + e));
| ~~~^~~
a.cc:236:15: note: initializing argument 1 of 'int getCnt(P&)'
236 | int getCnt(P &o){
| ~~~^
|
s470714014 | p00090 | C++ | #include <iostream>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)
using namespace std;
double dist(double x1,double y1,double x2,double y2){
return ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}
int main(void){
double tx[101],ty[101];
int n;
char k;
while(cin >> n){
if(n ==0 || cin.eof()) break;
rep(i,n) cin >> tx[i] >> k >> ty[i];
bool ds[101][101];
int cnt[101]={0};
rep(i,n) rep2(j,i+1,n)
if( dist(tx[i],ty[i],tx[j],ty[j]) <= 4.0){
ds[i][j]=true;
cnt[i]++; cnt[j]++;
}
else ds[i][j]=false;
int mx=0;
rep(i,n) mx = max(mx, cnt[i]);
int cmx=0;
if(mx>0){
cmx=1;
rep(k,n){
vector<int>z;
int ct2=0;
if(cnt[k]<=cmx) continue;
rep(i,n) if(ds[k][i] && i != k) z.push_back(i);
rep(i,n) if(ds[i][k] && i != k) z.push_back(i);
sort(z.begin(), z.end());
z.erase(unique(z.begin(), z.end()),z.end());
int ct1=z.size();
// rep(i,ct1) printf("z%d:%d, ",i,z[i]);
rep(i,ct1) rep2(j,i+1,ct1) if(ds[z[i]][z[j]]) ct2++;
if( cnt[k]+ct2 >= cnt[k]*(cnt[k]+1)/2) cmx=cnt[k];
else if( cnt[k]+ct2 >= cnt[k]*(cnt[k]-1)/2 && cnt[k] - 1 > cmx) cmk = cnt[k] -1;
}
}
cout << cmx+1 <<endl;
// rep(i,n) rep2(j,i+1,n) if(ds[i][j])printf("%d:%d , ",i+1,j+1); printf("\n");
// rep(i,n) printf("%d:%d, ",i+1,cnt[i]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:58:97: error: 'cmk' was not declared in this scope; did you mean 'cmx'?
58 | else if( cnt[k]+ct2 >= cnt[k]*(cnt[k]-1)/2 && cnt[k] - 1 > cmx) cmk = cnt[k] -1;
| ^~~
| cmx
|
s850554274 | p00090 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<complex>
#include<iomanip>
#include<cstdio>
#include<cassert>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-10)
#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1
#define ONLINE_BACK 2
#define ONLINE_FRONT -2
#define ON_SEGMENT 0
#define equals(a,b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef pair<double,double> BB;
class Point
{
public:
double x,y;
Point(double x = -1,double y = -1): x(x),y(y){}
Point operator + (Point p ){return Point(x+p.x,y+p.y);}
Point operator - (Point p){return Point(x-p.x,y-p.y);}
Point operator * (double a){return Point(a*x,a*y);}
Point operator / (double a){return Point(x/a,y/a);}//※イケメンに限る
bool operator < (const Point& p) const
{
return x != p.x?x<p.x:y<p.y;
}
bool operator == (const Point& p)const
{
return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
}
};
struct Segment
{
Point p1,p2;
Segment(Point p1 = Point(-1,-1),Point p2 = Point(-1,-1)):p1(p1),p2(p2){}
};
typedef Point Vector;
typedef Segment Line;
typedef vector<Point> Polygon;
struct Circle
{
Point p;
double r;
Circle(Point p=Point(0,0),double r=0):p(p),r(r){}
bool operator < (const Circle &a)const
{
if(p.x != a.p.x)return p.x < a.p.x;
if(p.y != a.p.y)return p.y < a.p.y;
return r < a.r;
}
};
double dot(Point a,Point b)
{
return a.x*b.x + a.y*b.y;
}
double cross(Point a,Point b)
{
return a.x*b.y - a.y*b.x;
}
double norm(Point a)
{
return a.x*a.x+a.y*a.y;
}
int ccw(Point p0,Point p1,Point p2)
{
Point a = p1-p0;
Point b = p2-p0;
if(cross(a,b) > 0)return COUNTER_CLOCKWISE;
if(cross(a,b) < 0)return CLOCKWISE;
if(dot(a,b) < 0)return ONLINE_BACK;
if(norm(a) < norm(b))return ONLINE_FRONT;
return ON_SEGMENT;
}
bool isIntersectCC(Circle a,Circle b)
{
double d = sqrt(norm(a.p-b.p));
double r1 = max(a.r,b.r);
double r2 = min(a.r,b.r);
if(d > r1+r2)return false;
if(d < r1-r2)return false;
return true;
}
pair<Point,Point> getPointsCC(Circle a,Circle b)
{
//assert(isIntersectCC(a,b));
complex<double> c1,c2;
c1 = complex<double>(a.p.x,a.p.y);
c2 = complex<double>(b.p.x,b.p.y);
double r1 = a.r;
double r2 = b.r;
complex<double> A = conj(c2-c1),B = (r2*r2-r1*r1-(c2-c1)*conj(c2-c1)), C = r1*r1*(c2-c1);
complex<double> D = B*B-4.0*A*C;
complex<double> z1 = (-B+sqrt(D))/(2.0*A)+c1, z2 = (-B-sqrt(D))/(2.0*A)+c1;
Point R1,R2;
R1 = Point(z1.real(),z1.imag());
R2 = Point(z2.real(),z2.imag());
return pair<Point,Point>(R1,R2);
}
int main()
{
int n;
while(cin >> n,n)
{
vector<Circle> c(n);
rep(i,n)
{
scanf("%lf,%lf",&c[i].p.x,&c[i].p.y);
c[i].r = 1.0;
}
int ans = 0;
rep(i,n)
{
REP(j,i+1,n)
{
if(sqrt(c[i].p-c[j].p) >= 2.0+EPS)continue;
pair<Point,Point> pp = getPointsCC(c[i],c[j]);
int cnt = 0;
Point p1 = pp.first;
Point p2 = pp.second;
rep(k,n)if(sqrt(norm(p1-c[k].p)) < EPS+1.0)cnt++;
ans = (ans<cnt?cnt:ans);
cnt = 0;
rep(k,n)if(sqrt(norm(p2-c[k].p)) < EPS+1.0)cnt++;
ans = (ans<cnt?cnt:ans);
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:138:22: error: no matching function for call to 'sqrt(Point)'
138 | if(sqrt(c[i].p-c[j].p) >= 2.0+EPS)continue;
| ~~~~^~~~~~~~~~~~~~~
In file included from a.cc:5:
/usr/include/c++/14/complex:1195:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::sqrt(const complex<_Tp>&)'
1195 | sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); }
| ^~~~
/usr/include/c++/14/complex:1195:5: note: template argument deduction/substitution failed:
a.cc:138:22: note: 'Point' is not derived from 'const std::complex<_Tp>'
138 | if(sqrt(c[i].p-c[j].p) >= 2.0+EPS)continue;
| ~~~~^~~~~~~~~~~~~~~
In file included from a.cc:4:
/usr/include/c++/14/cmath:454:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::sqrt(_Tp)'
454 | sqrt(_Tp __x)
| ^~~~
/usr/include/c++/14/cmath:454:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/cmath: In substitution of 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::sqrt(_Tp) [with _Tp = Point]':
a.cc:138:15: required from here
138 | if(sqrt(c[i].p-c[j].p) >= 2.0+EPS)continue;
| ~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/cmath:454:5: error: no type named '__type' in 'struct __gnu_cxx::__enable_if<false, double>'
454 | sqrt(_Tp __x)
| ^~~~
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/bits/requires_hosted.h:31,
from /usr/include/c++/14/iostream:38,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note: candidate: 'double sqrt(double)'
176 | __MATHCALL (sqrt,, (_Mdouble_ __x));
| ^~~~~~~~~~
In file included from /usr/include/math.h:275,
from /usr/include/c++/14/cmath:47:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note: no known conversion for argument 1 from 'Point' to 'double'
176 | __MATHCALL (sqrt,, (_Mdouble_ __x));
| ^
/usr/include/c++/14/cmath:446:3: note: candidate: 'constexpr long double std::sqrt(long double)'
446 | sqrt(long double __x)
| ^~~~
/usr/include/c++/14/cmath:446:20: note: no known conversion for argument 1 from 'Point' to 'long double'
446 | sqrt(long double __x)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/cmath:442:3: note: candidate: 'constexpr float std::sqrt(float)'
442 | sqrt(float __x)
| ^~~~
/usr/include/c++/14/cmath:442:14: note: no known conversion for argument 1 from 'Point' to 'float'
442 | sqrt(float __x)
| ~~~~~~^~~
|
s466072538 | p00090 | C++ | using namespace std;
//typedef pair<double,double> P;
int main()
{
int n;
for(;scanf("%d",&n),n;)
{
vector<pair<double,double> >circle;
for(int i=0;i<n;i++)
{
double tmp1,tmp2;
char buf;
cin>>tmp1>>buf>>tmp2;
circle.push_back(make_pair(tmp1,tmp2));
}
int ans=1;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
int count=0;
double xc1=circle[i].first;
double xc2=circle[j].first;
double yc1=circle[i].second;
double yc2=circle[j].second;
if(i!=j && (xc1-xc2)*(xc1-xc2)+(yc1-yc2)*(yc1-yc2)<=4.0)
{
int count=2;
for(int k=0;k<n;k++)
{
double xc3=circle[k].first;
double yc3=circle[k].second;
if(i!=k &&j!=k&&
(xc1-xc3)*(xc1-xc3)+(yc1-yc3)*(yc1-yc3)<=4.0 &&
(xc2-xc3)*(xc2-xc3)+(yc2-yc3)*(yc2-yc3)<=4.0)
{
// cout<<i<<" "<<j<<" "<<k<<endl;
count++;
}
}
ans=max(count,ans);
}
}
}
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:6:8: error: 'scanf' was not declared in this scope
6 | for(;scanf("%d",&n),n;)
| ^~~~~
a.cc:8:7: error: 'vector' was not declared in this scope
8 | vector<pair<double,double> >circle;
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | using namespace std;
a.cc:8:14: error: 'pair' was not declared in this scope
8 | vector<pair<double,double> >circle;
| ^~~~
a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
+++ |+#include <utility>
1 | using namespace std;
a.cc:8:19: error: expected primary-expression before 'double'
8 | vector<pair<double,double> >circle;
| ^~~~~~
a.cc:13:11: error: 'cin' was not declared in this scope
13 | cin>>tmp1>>buf>>tmp2;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:14:11: error: 'circle' was not declared in this scope
14 | circle.push_back(make_pair(tmp1,tmp2));
| ^~~~~~
a.cc:14:28: error: 'make_pair' was not declared in this scope
14 | circle.push_back(make_pair(tmp1,tmp2));
| ^~~~~~~~~
a.cc:14:28: note: 'std::make_pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
a.cc:22:26: error: 'circle' was not declared in this scope
22 | double xc1=circle[i].first;
| ^~~~~~
a.cc:41:23: error: 'max' was not declared in this scope
41 | ans=max(count,ans);
| ^~~
a.cc:45:7: error: 'cout' was not declared in this scope
45 | cout<<ans<<endl;
| ^~~~
a.cc:45:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:45:18: error: 'endl' was not declared in this scope
45 | cout<<ans<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
|
s626315077 | p00090 | C++ | while 1:
n=input()
if n==0:break
X=[]
for i in range(n):
x,y=input()
X.append(complex(x,y))
m=0
for i in range(n):
p0=X[i]
for j in range(n):
if i==j:continue
a,b=cmath.polar(p0-X[j])
if a<=2:
dx=a/2.0
dy=(1-dx**2)**.5
p1=complex(dx,dy)*cmath.exp(1j*b)+p0
p2=complex(dx,-dy)*cmath.exp(1j*b)+p0
s1,s2=0,0
for k in range(n):
if k==i or k==j:continue
if abs(p1-X[k])<=1.06:s1+=1
if abs(p2-X[k])<=1.06:s2+=1
if s1>m:m=s1
if s2>m:m=s2
print m+2 | a.cc:1:1: error: expected unqualified-id before 'while'
1 | while 1:
| ^~~~~
|
s947754617 | p00090 | C++ | import math,cmath
while 1:
n=input()
if n==0:break
X=[]
for i in range(n):
x,y=input()
X.append(complex(x,y))
m=0
for i in range(n):
p0=X[i]
for j in range(n):
if i==j:continue
a,b=cmath.polar(p0-X[j])
if a<=2:
dx=a/2.0
dy=(1-dx**2)**.5
p1=complex(dx,dy)*cmath.exp(1j*b)+p0
p2=complex(dx,-dy)*cmath.exp(1j*b)+p0
s1,s2=0,0
for k in range(n):
if k==i or k==j:continue
if abs(p1-X[k])<=1.06:s1+=1
if abs(p2-X[k])<=1.06:s2+=1
if s1>m:m=s1
if s2>m:m=s2
print m+2 | a.cc:1:1: error: 'import' does not name a type
1 | import math,cmath
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s304876527 | p00090 | C++ | #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <list>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;
#include <complex>
typedef complex<double> P;
#define LT(x,y) ((x)-(y)<=-EPS)
#define LE(x,y) ((x)-(y)<+EPS)
vector<P> cross_circles(P c1, double r1, P c2, double r2) {
double d = abs(c2 - c1);
if (LT(r1 + r2, d) || LT(d, fabs(r1 - r2))) {
return vector<P>();
}
double l = 0.5*((r1*r1 - r2*r2) / d + d);
double h = sqrt(r1*r1 - l*l);
vector<P> ret(2);
ret[0] = P(l, +h)*(c2 - c1) / d + c1;
ret[1] = P(l, -h)*(c2 - c1) / d + c1;
return ret;
}
int main() {
int n;
while (cin >> n, n) {
double x, y;
char c;
vector<P> circles(n);
REP(i, n) {
cin >> x >> c >> y;
circles[i] = P(x, y);
}
int ans = 1;
REP(i, n - 1) {
REP(j, i + 1, n - 1) {
vector<P> pts = cross_circles(circles[i], 1.0, circles[j], 1.0);
int size = pts.size();
REP(k, size) {
int count = 2;
REP(l, n) {
if (l == i || l == j) {
continue;
}
else {
if (LE(abs(circles[l] - pts[k]), 1.0)) {
count++;
}
}
}
ans = max(ans, count);
}
}
}
cout << ans << endl;
}
return 0;
} | a.cc:69:44: error: macro "REP" passed 3 arguments, but takes just 2
69 | REP(j, i + 1, n - 1) {
| ^
a.cc:32:9: note: macro "REP" defined here
32 | #define REP(i,n) FOR(i,0,(n)-1)
| ^~~
a.cc: In function 'int main()':
a.cc:69:25: error: 'REP' was not declared in this scope
69 | REP(j, i + 1, n - 1) {
| ^~~
|
s630918472 | p00091 | Java | import java.io.*;
class Main{
int[] sx={0,0,1,0,-1};
int[] sy={0,1,0,-1,0};
int[] mx={0,0,1,0,-1,-1,-1,1,1};
int[] my={0,1,0,-1,0,-1,1,-1,1};
int[] sx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
int[] my={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
int total;
int res;
int[][] map=new int[10][10];
int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public staic void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3)
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
lr(x,y);
}
}
size--;
continue;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
mr(x,y);
}
}
size--;
continue;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
sr(x,y);
}
}
size--;
continue;
case 0:drop[x][y]=size;
return searchnext(x,y);
break;
}
}
} | Main.java:86: error: <identifier> expected
public staic void main(String[] args) throws IOException{
^
Main.java:110: error: ';' expected
return search(x+1,1,3)
^
2 errors
|
s423670642 | p00091 | Java | import java.io.*;
class Main{
int[] sx={0,0,1,0,-1};
int[] sy={0,1,0,-1,0};
int[] mx={0,0,1,0,-1,-1,-1,1,1};
int[] my={0,1,0,-1,0,-1,1,-1,1};
int[] sx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
int[] my={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
int total;
int res;
int[][] map=new int[10][10];
int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public staic void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
lr(x,y);
}
}
size--;
continue;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
mr(x,y);
}
}
size--;
continue;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
sr(x,y);
}
}
size--;
continue;
case 0:drop[x][y]=size;
return searchnext(x,y);
break;
}
}
} | Main.java:86: error: <identifier> expected
public staic void main(String[] args) throws IOException{
^
1 error
|
s503098470 | p00091 | Java | import java.io.*;
class Main{
int[] sx={0,0,1,0,-1};
int[] sy={0,1,0,-1,0};
int[] mx={0,0,1,0,-1,-1,-1,1,1};
int[] my={0,1,0,-1,0,-1,1,-1,1};
int[] sx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
int[] my={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
int total;
int res;
int[][] map=new int[10][10];
int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
lr(x,y);
}
}
size--;
continue;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
mr(x,y);
}
}
size--;
continue;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
sr(x,y);
}
}
size--;
continue;
case 0:drop[x][y]=size;
return searchnext(x,y);
break;
}
}
} | Main.java:8: error: variable sx is already defined in class Main
int[] sx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
^
Main.java:9: error: variable my is already defined in class Main
int[] my={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
^
Main.java:15: error: non-static variable sx cannot be referenced from a static context
for(int i=0;i<sx.length;i++){
^
Main.java:16: error: non-static variable map cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]--;
^
Main.java:16: error: non-static variable sx cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]--;
^
Main.java:16: error: non-static variable sy cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]--;
^
Main.java:18: error: non-static variable total cannot be referenced from a static context
total-=5;
^
Main.java:19: error: non-static variable res cannot be referenced from a static context
res--;
^
Main.java:22: error: non-static variable sx cannot be referenced from a static context
for(int i=0;i<sx.length;i++){
^
Main.java:23: error: non-static variable map cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]++;
^
Main.java:23: error: non-static variable sx cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]++;
^
Main.java:23: error: non-static variable sy cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]++;
^
Main.java:25: error: non-static variable total cannot be referenced from a static context
total+=5;
^
Main.java:26: error: non-static variable res cannot be referenced from a static context
res++;
^
Main.java:29: error: non-static variable sx cannot be referenced from a static context
for(int i=0;i<sx.length;i++){
^
Main.java:30: error: non-static variable sx cannot be referenced from a static context
int nx=x+sx[i];
^
Main.java:31: error: non-static variable sy cannot be referenced from a static context
int ny=y+sy[i];
^
Main.java:32: error: non-static variable map cannot be referenced from a static context
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
^
Main.java:39: error: non-static variable mx cannot be referenced from a static context
for(int i=0;i<mx.length;i++){
^
Main.java:40: error: non-static variable map cannot be referenced from a static context
map[x+mx[i]][y+my[i]]--;
^
Main.java:40: error: non-static variable mx cannot be referenced from a static context
map[x+mx[i]][y+my[i]]--;
^
Main.java:40: error: non-static variable my cannot be referenced from a static context
map[x+mx[i]][y+my[i]]--;
^
Main.java:42: error: non-static variable total cannot be referenced from a static context
total-=9;
^
Main.java:43: error: non-static variable res cannot be referenced from a static context
res--;
^
Main.java:46: error: non-static variable mx cannot be referenced from a static context
for(int i=0;i<mx.length;i++){
^
Main.java:47: error: non-static variable map cannot be referenced from a static context
map[x+mx[i]][y+my[i]]++;
^
Main.java:47: error: non-static variable mx cannot be referenced from a static context
map[x+mx[i]][y+my[i]]++;
^
Main.java:47: error: non-static variable my cannot be referenced from a static context
map[x+mx[i]][y+my[i]]++;
^
Main.java:49: error: non-static variable total cannot be referenced from a static context
total+=9;
^
Main.java:50: error: non-static variable res cannot be referenced from a static context
res++;
^
Main.java:53: error: non-static variable mx cannot be referenced from a static context
for(int i=0;i<mx.length;i++){
^
Main.java:54: error: non-static variable mx cannot be referenced from a static context
int nx=x+mx[i];
^
Main.java:55: error: non-static variable my cannot be referenced from a static context
int ny=y+my[i];
^
Main.java:56: error: non-static variable map cannot be referenced from a static context
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
^
Main.java:63: error: cannot find symbol
for(int i=0;i<lx.length;i++){
^
symbol: variable lx
location: class Main
Main.java:64: error: non-static variable map cannot be referenced from a static context
map[x+lx[i]][y+ly[i]]--;
^
Main.java:64: error: cannot find symbol
map[x+lx[i]][y+ly[i]]--;
^
symbol: variable lx
location: class Main
Main.java:64: error: cannot find symbol
map[x+lx[i]][y+ly[i]]--;
^
symbol: variable ly
location: class Main
Main.java:66: error: non-static variable total cannot be referenced from a static context
total-=13;
^
Main.java:67: error: non-static variable res cannot be referenced from a static context
res--;
^
Main.java:70: error: cannot find symbol
for(int i=0;i<lx.length;i++){
^
symbol: variable lx
location: class Main
Main.java:71: error: non-static variable map cannot be referenced from a static context
map[x+lx[i]][y+ly[i]]++;
^
Main.java:71: error: cannot find symbol
map[x+lx[i]][y+ly[i]]++;
^
symbol: variable lx
location: class Main
Main.java:71: error: cannot find symbol
map[x+lx[i]][y+ly[i]]++;
^
symbol: variable ly
location: class Main
Main.java:73: error: non-static variable total cannot be referenced from a static context
total+=13;
^
Main.java:74: error: non-static variable res cannot be referenced from a static context
res++;
^
Main.java:77: error: cannot find symbol
for(int i=0;i<lx.length;i++){
^
symbol: variable lx
location: class Main
Main.java:78: error: cannot find symbol
int nx=x+lx[i];
^
symbol: variable lx
location: class Main
Main.java:79: error: cannot find symbol
int ny=y+ly[i];
^
symbol: variable ly
location: class Main
Main.java:80: error: non-static variable map cannot be referenced from a static context
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
^
Main.java:88: error: non-static variable res cannot be referenced from a static context
res=Integer.parseInt(br.readLine());
^
Main.java:89: error: non-static variable total cannot be referenced from a static context
total=0;
^
Main.java:94: error: non-static variable map cannot be referenced from a static context
map[i][j]=num;
^
Main.java:95: error: non-static variable total cannot be referenced from a static context
total+=num;
^
Main.java:101: error: non-static variable drop cannot be referenced from a static context
if(drop[i][j]!=0){
^
Main.java:102: error: non-static variable drop cannot be referenced from a static context
System.out.println(i+" "+j+" "+drop[i][j]);
^
Main.java:115: error: non-static variable res cannot be referenced from a static context
if(res==0&&total==0){
^
Main.java:115: error: non-static variable total cannot be referenced from a static context
if(res==0&&total==0){
^
Main.java:118: error: non-static variable total cannot be referenced from a static context
else if(total<5){
^
Main.java:126: error: non-static variable map cannot be referenced from a static context
if(map[x-3][i]!=0){
^
Main.java:135: error: non-static variable drop cannot be referenced from a static context
drop[x][y]=size;
^
Main.java:144: error: continue outside of loop
continue;
^
Main.java:148: error: non-static variable drop cannot be referenced from a static context
drop[x][y]=size;
^
Main.java:157: error: continue outside of loop
continue;
^
Main.java:161: error: non-static variable drop cannot be referenced from a static context
drop[x][y]=size;
^
Main.java:170: error: continue outside of loop
continue;
^
Main.java:171: error: non-static variable drop cannot be referenced from a static context
case 0:drop[x][y]=size;
^
67 errors
|
s281286373 | p00091 | Java | import java.io.*;
class Main{
int[] sx={0,0,1,0,-1};
int[] sy={0,1,0,-1,0};
int[] mx={0,0,1,0,-1,-1,-1,1,1};
int[] my={0,1,0,-1,0,-1,1,-1,1};
int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
int total;
int res;
int[][] map=new int[10][10];
int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
lr(x,y);
}
}
size--;
continue;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
mr(x,y);
}
}
size--;
continue;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
sr(x,y);
}
}
size--;
continue;
case 0:drop[x][y]=size;
return searchnext(x,y);
break;
}
}
} | Main.java:15: error: non-static variable sx cannot be referenced from a static context
for(int i=0;i<sx.length;i++){
^
Main.java:16: error: non-static variable map cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]--;
^
Main.java:16: error: non-static variable sx cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]--;
^
Main.java:16: error: non-static variable sy cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]--;
^
Main.java:18: error: non-static variable total cannot be referenced from a static context
total-=5;
^
Main.java:19: error: non-static variable res cannot be referenced from a static context
res--;
^
Main.java:22: error: non-static variable sx cannot be referenced from a static context
for(int i=0;i<sx.length;i++){
^
Main.java:23: error: non-static variable map cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]++;
^
Main.java:23: error: non-static variable sx cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]++;
^
Main.java:23: error: non-static variable sy cannot be referenced from a static context
map[x+sx[i]][y+sy[i]]++;
^
Main.java:25: error: non-static variable total cannot be referenced from a static context
total+=5;
^
Main.java:26: error: non-static variable res cannot be referenced from a static context
res++;
^
Main.java:29: error: non-static variable sx cannot be referenced from a static context
for(int i=0;i<sx.length;i++){
^
Main.java:30: error: non-static variable sx cannot be referenced from a static context
int nx=x+sx[i];
^
Main.java:31: error: non-static variable sy cannot be referenced from a static context
int ny=y+sy[i];
^
Main.java:32: error: non-static variable map cannot be referenced from a static context
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
^
Main.java:39: error: non-static variable mx cannot be referenced from a static context
for(int i=0;i<mx.length;i++){
^
Main.java:40: error: non-static variable map cannot be referenced from a static context
map[x+mx[i]][y+my[i]]--;
^
Main.java:40: error: non-static variable mx cannot be referenced from a static context
map[x+mx[i]][y+my[i]]--;
^
Main.java:40: error: non-static variable my cannot be referenced from a static context
map[x+mx[i]][y+my[i]]--;
^
Main.java:42: error: non-static variable total cannot be referenced from a static context
total-=9;
^
Main.java:43: error: non-static variable res cannot be referenced from a static context
res--;
^
Main.java:46: error: non-static variable mx cannot be referenced from a static context
for(int i=0;i<mx.length;i++){
^
Main.java:47: error: non-static variable map cannot be referenced from a static context
map[x+mx[i]][y+my[i]]++;
^
Main.java:47: error: non-static variable mx cannot be referenced from a static context
map[x+mx[i]][y+my[i]]++;
^
Main.java:47: error: non-static variable my cannot be referenced from a static context
map[x+mx[i]][y+my[i]]++;
^
Main.java:49: error: non-static variable total cannot be referenced from a static context
total+=9;
^
Main.java:50: error: non-static variable res cannot be referenced from a static context
res++;
^
Main.java:53: error: non-static variable mx cannot be referenced from a static context
for(int i=0;i<mx.length;i++){
^
Main.java:54: error: non-static variable mx cannot be referenced from a static context
int nx=x+mx[i];
^
Main.java:55: error: non-static variable my cannot be referenced from a static context
int ny=y+my[i];
^
Main.java:56: error: non-static variable map cannot be referenced from a static context
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
^
Main.java:63: error: non-static variable lx cannot be referenced from a static context
for(int i=0;i<lx.length;i++){
^
Main.java:64: error: non-static variable map cannot be referenced from a static context
map[x+lx[i]][y+ly[i]]--;
^
Main.java:64: error: non-static variable lx cannot be referenced from a static context
map[x+lx[i]][y+ly[i]]--;
^
Main.java:64: error: non-static variable ly cannot be referenced from a static context
map[x+lx[i]][y+ly[i]]--;
^
Main.java:66: error: non-static variable total cannot be referenced from a static context
total-=13;
^
Main.java:67: error: non-static variable res cannot be referenced from a static context
res--;
^
Main.java:70: error: non-static variable lx cannot be referenced from a static context
for(int i=0;i<lx.length;i++){
^
Main.java:71: error: non-static variable map cannot be referenced from a static context
map[x+lx[i]][y+ly[i]]++;
^
Main.java:71: error: non-static variable lx cannot be referenced from a static context
map[x+lx[i]][y+ly[i]]++;
^
Main.java:71: error: non-static variable ly cannot be referenced from a static context
map[x+lx[i]][y+ly[i]]++;
^
Main.java:73: error: non-static variable total cannot be referenced from a static context
total+=13;
^
Main.java:74: error: non-static variable res cannot be referenced from a static context
res++;
^
Main.java:77: error: non-static variable lx cannot be referenced from a static context
for(int i=0;i<lx.length;i++){
^
Main.java:78: error: non-static variable lx cannot be referenced from a static context
int nx=x+lx[i];
^
Main.java:79: error: non-static variable ly cannot be referenced from a static context
int ny=y+ly[i];
^
Main.java:80: error: non-static variable map cannot be referenced from a static context
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
^
Main.java:88: error: non-static variable res cannot be referenced from a static context
res=Integer.parseInt(br.readLine());
^
Main.java:89: error: non-static variable total cannot be referenced from a static context
total=0;
^
Main.java:94: error: non-static variable map cannot be referenced from a static context
map[i][j]=num;
^
Main.java:95: error: non-static variable total cannot be referenced from a static context
total+=num;
^
Main.java:101: error: non-static variable drop cannot be referenced from a static context
if(drop[i][j]!=0){
^
Main.java:102: error: non-static variable drop cannot be referenced from a static context
System.out.println(i+" "+j+" "+drop[i][j]);
^
Main.java:115: error: non-static variable res cannot be referenced from a static context
if(res==0&&total==0){
^
Main.java:115: error: non-static variable total cannot be referenced from a static context
if(res==0&&total==0){
^
Main.java:118: error: non-static variable total cannot be referenced from a static context
else if(total<5){
^
Main.java:126: error: non-static variable map cannot be referenced from a static context
if(map[x-3][i]!=0){
^
Main.java:135: error: non-static variable drop cannot be referenced from a static context
drop[x][y]=size;
^
Main.java:144: error: continue outside of loop
continue;
^
Main.java:148: error: non-static variable drop cannot be referenced from a static context
drop[x][y]=size;
^
Main.java:157: error: continue outside of loop
continue;
^
Main.java:161: error: non-static variable drop cannot be referenced from a static context
drop[x][y]=size;
^
Main.java:170: error: continue outside of loop
continue;
^
Main.java:171: error: non-static variable drop cannot be referenced from a static context
case 0:drop[x][y]=size;
^
65 errors
|
s534740601 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
lr(x,y);
}
}
size--;
continue;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
mr(x,y);
}
}
size--;
continue;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
sr(x,y);
}
}
size--;
continue;
case 0:drop[x][y]=size;
return searchnext(x,y);
break;
}
}
} | Main.java:144: error: continue outside of loop
continue;
^
Main.java:157: error: continue outside of loop
continue;
^
Main.java:170: error: continue outside of loop
continue;
^
3 errors
|
s410810587 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=size;
return searchnext(x,y);
break;
}
}
} | Main.java:137: error: unreachable statement
break;
^
Main.java:149: error: unreachable statement
break;
^
Main.java:161: error: unreachable statement
break;
^
Main.java:170: error: unreachable statement
break;
^
Main.java:172: error: missing return statement
}
^
5 errors
|
s759663017 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=size;
return searchnext(x,y);
}
}
} | Main.java:168: error: missing return statement
}
^
1 error
|
s402152826 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=size;
return searchnext(x,y);
break;
}
}
} | Main.java:167: error: unreachable statement
break;
^
Main.java:169: error: missing return statement
}
^
2 errors
|
s559883170 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=size;
return searchnext(x,y);
}
}
} | Main.java:168: error: missing return statement
}
^
1 error
|
s169067122 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=size;
return searchnext(x,y);
}
return;
}
} | Main.java:168: error: incompatible types: missing return value
return;
^
1 error
|
s344974949 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=size;
return searchnext(x,y);
}
}
} | Main.java:168: error: missing return statement
}
^
1 error
|
s519523681 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
if(searchnext(x,y)){
drop[x][y]=size;
return true;
break;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=size;
return searchnext(x,y);
break;
}
}
} | Main.java:137: error: unreachable statement
break;
^
Main.java:149: error: unreachable statement
break;
^
Main.java:161: error: unreachable statement
break;
^
Main.java:170: error: unreachable statement
break;
^
Main.java:172: error: missing return statement
}
^
5 errors
|
s034898349 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y]=3;
if(searchnext(x,y)){
return true;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y]=2;
if(searchnext(x,y)){
return true;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y]=1;
if(searchnext(x,y)){
return true;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=0;
return searchnext(x,y);
}
}
} | Main.java:168: error: missing return statement
}
^
1 error
|
s835248696 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y]=3;
if(searchnext(x,y)){
return true;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y]=2;
if(searchnext(x,y)){
return true;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y]=1;
if(searchnext(x,y)){
return true;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=0;
return searchnext(x,y);
break;
}
}
} | Main.java:167: error: unreachable statement
break;
^
Main.java:169: error: missing return statement
}
^
2 errors
|
s262007557 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][] drop=new int[10][10];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]<=0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
if(drop[i][j]!=0){
System.out.println(i+" "+j+" "+drop[i][j]);
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
else if(res==0){
return false
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
while(true){
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y]=3;
if(searchnext(x,y)){
return true;
}
else{
lr(x,y);
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y]=2;
if(searchnext(x,y)){
return true;
}
else{
mr(x,y);
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y]=1;
if(searchnext(x,y)){
return true;
}
else{
sr(x,y);
}
}
size--;
case 0:drop[x][y]=0;
return searchnext(x,y);
}
}
}
} | Main.java:122: error: ';' expected
return false
^
1 error
|
s520635257 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][][] drop=new int[10][10][3];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
for(int k=0;k<3;k++){
if(drop[i][j][k]!=0){
for(int l=0;l<drop[i][j][k];i++){
int m=k+1;
System.out.println(j+" "+i+" "+m);
}
}
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<5){
return false;
}
else if(res==0){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
while(true){
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y][2]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)){
continue;
}
lr(x,y);
drop[x][y][2]--;
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y][1]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)){
continue;
size=3;
}
mr(x,y);
drop[x][y][1]--;
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y][0]--;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)){
size=3;
continue;
}
sr(x,y);
drop[x][y][0]--;
}
}
size--;
case 0:return searchnext(x,y);
}
}
}
} | Main.java:165: error: unreachable statement
size=3;
^
1 error
|
s648260419 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][][] drop=new int[10][10][3];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
for(int k=0;k<3;k++){
if(drop[i][j][k]!=0){
for(int l=0;l<drop[i][j][k];l++){
int m=k+1;
System.out.println(j+" "+i+" "+m);
}
}
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<res*5||total>res*13){
return false;
}
else if(res==0){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
while(true){
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y][2]++;
if(searchnext(x,y)){
return true;
}
else{
if(lcd(x,y)&&search(x,y,3)){
return true;
}
else if(mcd(x,y)&&search(x,y,2){
return true;
}
else if(scd(x,y)&&search(x,y,1){
return true;
}
lr(x,y);
drop[x][y][2]--;
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y][1]++;
if(mcd(x,y)&&search(x,y,2)){
return true;
}
else if(scd(x,y)&&search(x,y,1){
return true;
}
else{
if(search(x,y,3)){
return true;
}
mr(x,y);
drop[x][y][1]--;
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y][0]++;
if(scd(x,y)&&search(x,y,1)){
return true;
}
else{
if(search(x,y,3)){
return true;
}
sr(x,y);
drop[x][y][0]--;
}
}
size--;
case 0:return searchnext(x,y);
}
}
}
} | Main.java:151: error: ')' expected
else if(mcd(x,y)&&search(x,y,2){
^
Main.java:154: error: ')' expected
else if(scd(x,y)&&search(x,y,1){
^
Main.java:168: error: ')' expected
else if(scd(x,y)&&search(x,y,1){
^
3 errors
|
s366357620 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][][] drop=new int[10][10][3];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
for(int k=0;k<3;k++){
if(drop[i][j][k]!=0){
for(int l=0;l<drop[i][j][k];l++){
int m=k+1;
System.out.println(j+" "+i+" "+m);
}
}
}
}
}
}
}
static boolean searchnext(int x,int y){
if(y==8){
return search(x+1,1,3);
}
return search(x,y+1,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<res*5||total>res*13){
return false;
}
else if(res==0){
return false;
}
if(x==9){
return false;
}
if(x>2&&y==1){
for(int i=0;i<10;i++){
if(map[x-3][i]!=0){
return false;
}
}
}
while(true){
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y][2]++;
if(scd(x,y)){
if(lcd(x,y)&&search(x,y,3)){
return true;
}
else if(mcd(x,y)&&search(x,y,2)){
return true;
}
else if(search(x,y,1)){
return true;
}
if(searchnext(x,y)){
return true;
}
}
else{
lr(x,y);
drop[x][y][2]--;
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y][1]++;
if(scd(x,y)){
if(mcd(x,y)&&search(x,y,2)){
return true;
}
else if(search(x,y,1)){
return true;
}
}
if(searchnext(x,y)){
return true;
}
}
else{
mr(x,y);
drop[x][y][1]--;
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y][0]++;
if(scd(x,y)&&search(x,y,1)){
return true;
}
if(searchnext(x,y)){
return true;
}
}
else{
sr(x,y);
drop[x][y][0]--;
}
size--;
case 0:return searchnext(x,y);
}
}
}
} | Main.java:163: error: orphaned case
case 2:if(mcd(x,y)){
^
Main.java:202: error: reached end of file while parsing
}
^
2 errors
|
s724762455 | p00091 | Java | import java.io.*;
class Main{
static int[] sx={0,0,1,0,-1};
static int[] sy={0,1,0,-1,0};
static int[] mx={0,0,1,0,-1,-1,-1,1,1};
static int[] my={0,1,0,-1,0,-1,1,-1,1};
static int[] lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2};
static int[] ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int total;
static int res;
static int[][] map=new int[10][10];
static int[][][] drop=new int[10][10][3];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
res=Integer.parseInt(br.readLine());
total=0;
for(int i=0;i<10;i++){
String[] value=br.readLine().split(" ");
for(int j=0;j<10;j++){
int num=Integer.parseInt(value[j]);
map[i][j]=num;
total+=num;
}
}
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
for(int k=1;k<=3;k++){
int m=drop[i][j][k-1]
if(m!=0){
for(int l=0;l<m;l++){
System.out.println(j+" "+i+" "+k);
}
}
}
}
}
}
}
static boolean searchnext(int x,int y){
if(x==8){
return search(1,y+1,3);
}
return search(x+1,y,3);
}
static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<res*5||total>res*13){
return false;
}
else if(res==0){
return false;
}
if(y==9){
return false;
}
if(y>2&&x==1){
for(int i=0;i<10;i++){
if(map[i][y-3]!=0){
return false;
}
}
}
while(true){
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y][2]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,3)){
return true;
}
lr(x,y);
drop[x][y][2]--;
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y][1]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,2)){
return true;
}
mr(x,y);
drop[x][y][1]--;
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y][0]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,1)){
return true;
}
sr(x,y);
drop[x][y][0]--;
}
}
size--;
case 0:return searchnext(x,y);
}
}
}
} | Main.java:102: error: ';' expected
int m=drop[i][j][k-1]
^
1 error
|
s454678529 | p00091 | 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.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
res=ir.nextInt();
total=0;
for(int i=0;i<10;i++){
map[i]=ir.nextIntArray(10);
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
total+=map[i][j];
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
for(int k=0;k<3;k++){
if(drop[i][j][k]!=0){
for(int l=0;l<drop[i][j][k];l++){
out.println(j+" "+i+" "+(k+1));
}
}
}
}
}
}
}
static int total,res;
static final int[] sx={0,0,1,0,-1},sy={0,1,0,-1,0},mx={0,0,1,0,-1,-1,-1,1,1},my={0,1,0,-1,0,-1,1,-1,1},lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2},ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int[][] map=new int[10][10];
static int[][][] drop=new int[10][10][3];
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static boolean searchnext(int x,int y){
if(x==8){
return search(1,y+1,3);
}
return search(x+1,y,3);
}
public static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<res*5||total>res*13){
return false;
}
else if(res==0){
return false;
}
if(y==9){
return false;
}
if(y>2&&x==1){
for(int i=0;i<10;i++){
if(map[i][y-3]!=0){
return false;
}
}
}
while(true){
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y][2]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,3)){
return true;
}
lr(x,y);
drop[x][y][2]--;
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y][1]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,2)){
return true;
}
mr(x,y);
drop[x][y][1]--;
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y][0]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,1)){
return true;
}
sr(x,y);
drop[x][y][0]--;
}
}
size--;
case 0:return searchnext(x,y);
}
}
}
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 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:39: error: illegal start of expression
static int total,res;
^
1 error
|
s885402199 | p00091 | 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.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
res=ir.nextInt();
total=0;
map=new int[10][];
drop=new int[10][10][3];
for(int i=0;i<10;i++){
map[i]=ir.nextIntArray(10);
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
total+=map[i][j];
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
for(int k=0;k<3;k++){
if(drop[i][j][k]!=0){
for(int l=0;l<drop[i][j][k];l++){
out.println(j+" "+i+" "+(k+1));
}
}
}
}
}
}
}
static int total,res;
static final int[] sx={0,0,1,0,-1},sy={0,1,0,-1,0},mx={0,0,1,0,-1,-1,-1,1,1},my={0,1,0,-1,0,-1,1,-1,1},lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2},ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int[][] map;
static int[][][] drop;
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static boolean searchnext(int x,int y){
if(x==8){
return search(1,y+1,3);
}
return search(x+1,y,3);
}
public static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<res*5||total>res*13){
return false;
}
else if(res==0){
return false;
}
if(y==9){
return false;
}
if(y>2&&x==1){
for(int i=0;i<10;i++){
if(map[i][y-3]!=0){
return false;
}
}
}
while(true){
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y][2]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,3)){
return true;
}
lr(x,y);
drop[x][y][2]--;
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y][1]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,2)){
return true;
}
mr(x,y);
drop[x][y][1]--;
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y][0]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,1)){
return true;
}
sr(x,y);
drop[x][y][0]--;
}
}
size--;
case 0:return searchnext(x,y);
}
}
}
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 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:41: error: illegal start of expression
static int total,res;
^
1 error
|
s323791397 | p00091 | 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.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static int total,res;
static final int[] sx={0,0,1,0,-1},sy={0,1,0,-1,0},mx={0,0,1,0,-1,-1,-1,1,1},my={0,1,0,-1,0,-1,1,-1,1},lx={0,0,1,0,-1,-1,-1,1,1,0,2,0,-2},ly={0,1,0,-1,0,-1,1,-1,1,2,0,-2,0};
static int[][] map;
static int[][][] drop;
static void solve(){
res=ir.nextInt();
total=0;
map=new int[10][];
drop=new int[10][10][3];
for(int i=0;i<10;i++){
map[i]=ir.nextIntArray(10);
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
total+=map[i][j];
if(search(1,1,3)){
for(int i=1;i<9;i++){
for(int j=1;j<9;j++){
for(int k=0;k<3;k++){
if(drop[i][j][k]!=0){
for(int l=0;l<drop[i][j][k];l++){
out.println(j+" "+i+" "+(k+1));
}
}
}
}
}
}
}
static void sd(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]--;
}
total-=5;
res--;
}
static void sr(int x,int y){
for(int i=0;i<sx.length;i++){
map[x+sx[i]][y+sy[i]]++;
}
total+=5;
res++;
}
static boolean scd(int x,int y){
for(int i=0;i<sx.length;i++){
int nx=x+sx[i];
int ny=y+sy[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void md(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]--;
}
total-=9;
res--;
}
static void mr(int x,int y){
for(int i=0;i<mx.length;i++){
map[x+mx[i]][y+my[i]]++;
}
total+=9;
res++;
}
static boolean mcd(int x,int y){
for(int i=0;i<mx.length;i++){
int nx=x+mx[i];
int ny=y+my[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
static void ld(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]--;
}
total-=13;
res--;
}
static void lr(int x,int y){
for(int i=0;i<lx.length;i++){
map[x+lx[i]][y+ly[i]]++;
}
total+=13;
res++;
}
static boolean lcd(int x,int y){
for(int i=0;i<lx.length;i++){
int nx=x+lx[i];
int ny=y+ly[i];
if(nx<0||ny<0||nx>=10||ny>=10||map[nx][ny]==0){
return false;
}
}
return true;
}
public static boolean searchnext(int x,int y){
if(x==8){
return search(1,y+1,3);
}
return search(x+1,y,3);
}
public static boolean search(int x,int y,int size){
if(res==0&&total==0){
return true;
}
else if(total<res*5||total>res*13){
return false;
}
else if(res==0){
return false;
}
if(y==9){
return false;
}
if(y>2&&x==1){
for(int i=0;i<10;i++){
if(map[i][y-3]!=0){
return false;
}
}
}
while(true){
switch(size){
case 3:if(lcd(x,y)){
ld(x,y);
drop[x][y][2]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,3)){
return true;
}
lr(x,y);
drop[x][y][2]--;
}
}
size--;
case 2:if(mcd(x,y)){
md(x,y);
drop[x][y][1]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,2)){
return true;
}
mr(x,y);
drop[x][y][1]--;
}
}
size--;
case 1:if(scd(x,y)){
sd(x,y);
drop[x][y][0]++;
if(searchnext(x,y)){
return true;
}
else{
if(scd(x,y)&&search(x,y,1)){
return true;
}
sr(x,y);
drop[x][y][0]--;
}
}
size--;
case 0:return searchnext(x,y);
}
}
}
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 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:45: error: illegal start of expression
static void sd(int x,int y){
^
1 error
|
s874243766 | p00091 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main2 {
private static BufferedReader br = null;
static {
br = new BufferedReader(new InputStreamReader(System.in));
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int cnt = 0;
while ((cnt = parsePoint()) != 0) {
}
}
private static int parsePoint() {
int params = 0;
String strin = null;
if ((strin = parseStdin()) != null) {
params = Integer.parseInt(strin);
}
return params;
}
private static String parseStdin() {
String stdin = null;
try {
String tmp = br.readLine();
if (!tmp.isEmpty()) stdin = tmp;
}
catch (IOException e) {}
return stdin;
}
} | Main.java:6: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
^
1 error
|
s649265573 | p00091 | Java | import java.util.Stack;
import java.util.Scanner;
import java.util.TreeSet;
import java.util.Comparator;
class Sheet
{
private byte n;
private byte [][] t = new byte[10][10];
private Stack<String> st = new Stack<String>();
private final static int[][][] inkPos =
{
{
{-1, 0} , {1, 0} , {0,-1} , {0, 1}, {0,0}
},
{
{-1,-1} , {-1,1} , {1,-1} , {1, 1}
},
{
{-2, 0} , {0, 2} , {2, 0} , {0,-2}
}
};
private boolean isInside(int i, int j)
{
return i<10 && j<10 && i>=0 && j>=0;
}
private boolean droppable_(int ink, int i, int j)
{
for(int a = 0; a <= ink; ++a) {
for(int[] r : inkPos[a]) {
int ci = i + r[0];
int cj = j + r[1];
if( !isInside(ci,cj) ){
return false;
}
if( t[ci][cj] < 1 ) {
return false;
}
}
}
return true;
}
private boolean operateInk(int ink, int i, int j, int op)
{
boolean ret = false;
for(int a = 0; a <= ink; ++a) {
for( int[] r : inkPos[a] ) {
int ci = i + r[0];
int cj = j + r[1];
if( op == 0 ) {
// drop ink
t[ci][cj]--;
if( t[ci][cj] == 0 ) ret = true;
} else {
// remove ink
if( t[ci][cj] == 0 ) ret = true;
t[ci][cj]++;
}
}
}
return ret;
}
public void solve(int pi, int pj, int pa)
{
int maxVal = 0;
int rem = 0;
for(int i = 0; i < t.length; ++i) {
for(int j = 0; j < t[i].length; ++j) {
if( t[i][j] > 0 ) {
rem+=t[i][j];
}
if( t[i][j] > maxVal ) {
maxVal = t[i][j];
}
}
}
// the number of remaining operations is enough to clear
if( n < maxVal || 13*n < rem ) {
return ;
}
if( n == 0 ){
for(int i = 0; i < t.length; ++i) {
for(int j = 0; j < t[i].length; ++j) {
if( t[i][j] != 0 ) {
return ;
}
}
}
while( !st.empty() ) {
System.out.println(st.pop());
}
}else{
for(int i = 0; i < t.length; ++i){
for(int j = 0; j < t[i].length; ++j){
if( t[i][j] > 0 ) {
boolean ret = false;
for(int a = 0; a <= 2; ++a){
for(int[] r : inkPos[a]){
int ci = i+r[0];
int cj = j+r[1];
if( droppable_(a,ci,cj) ) {
ret = true;
}
}
}
// exist a cell that cannot be zero by dropping ANY inks around there.
if( !ret ) {
return ;
}
}
}
}
for(int a = pa; a >= 0; --a){
for(int i = a==pa?pi:1; i < 9; ++i) {
for(int j = a==pa&&i==pi?pj:1; j < 9; ++j) {
if( droppable_(a,i,j) ){
// progress state
--n;
operateInk(a,i,j,0);
st.push(j+" "+i+" "+(a+1));
solve( i, j, a );
if( st.empty() ) return ;
// rollback state
++n;
st.pop();
operateInk(a,i,j,1) ){
}
}
}
}
}
}
public void input()
{
Scanner sc = new Scanner(System.in);
n = sc.nextByte();
for(byte[] f : t) {
for(int i = 0; i < f.length; ++i){
f[i] = sc.nextByte();
}
}
}
}
class Main
{
public static void main(String [] args)
{
Sheet sheet = new Sheet();
sheet.input();
sheet.solve( 1, 1, 2 );
}
} | Main.java:152: error: ';' expected
operateInk(a,i,j,1) ){
^
Main.java:160: error: illegal start of expression
public void input()
^
2 errors
|
s299461099 | p00091 | C | int x[12],y[12],p[12],r=0;
int f(int h,int n){
int i,j,k,c;
if(n==0){
for(i=2;i<12;i++){
for(j=2;j<12;j++){
if(d[i][j])return 0;
}
}
return 1;
}
for(i=h;i<12;i++){
for(j=2;j<12;j++){
if(d[i][j]==0)continue;
for(k=2;k>-1;k--){
for(c=0;c<s[k];c++){
if(d[i+Y[k][c]][j+X[k][c]]==0)break;
}
if(c==s[k]){
for(c=0;c<s[k];c++)d[i+Y[k][c]][j+X[k][c]]--;
y[r]=i+k/2-1;
x[r]=j+k%2-2;
p[r++]=k+1;
if(f(i,n-1))return 1;
for(c=0;c<s[k];c++)d[i+Y[k][c]][j+X[k][c]]++;
r--;
}
}
return 0;
}
}
return 0;
}
int main(){
int n,i,j;
scanf("%d",&n);
for(i=2;i<12;i++){
for(j=2;j<12;j++)scanf("%d",&d[i][j]);
}
f(2,n);
for(i=0;i<n;i++)printf("%d %d %d\n",x[i],y[i],p[i]);
return 0;
} | main.c: In function 'f':
main.c:7:12: error: 'd' undeclared (first use in this function)
7 | if(d[i][j])return 0;
| ^
main.c:7:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:19: error: 's' undeclared (first use in this function)
16 | for(c=0;c<s[k];c++){
| ^
main.c:17:18: error: 'Y' undeclared (first use in this function)
17 | if(d[i+Y[k][c]][j+X[k][c]]==0)break;
| ^
main.c:17:29: error: 'X' undeclared (first use in this function)
17 | if(d[i+Y[k][c]][j+X[k][c]]==0)break;
| ^
main.c: In function 'main':
main.c:36:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
36 | scanf("%d",&n);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int x[12],y[12],p[12],r=0;
main.c:36:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
36 | scanf("%d",&n);
| ^~~~~
main.c:36:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:38:34: error: 'd' undeclared (first use in this function)
38 | for(j=2;j<12;j++)scanf("%d",&d[i][j]);
| ^
main.c:41:19: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
41 | for(i=0;i<n;i++)printf("%d %d %d\n",x[i],y[i],p[i]);
| ^~~~~~
main.c:41:19: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:41:19: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:41:19: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s907319154 | p00091 | C++ | #include <iostream>
#include <stack>
using namespace std;
#define N 10
struct point{
int x, y, size;
};
int n;
int total_drop = 0;
int cloth[N][N];
int smallx[4] = {1, -1, 0, 0};
int smally[4] = {0, 0, 1, -1};
int midx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int midy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int bigx[12] = {-2, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 2};
int bigy[12] = {0, -1, 0, 1, -2, -1, 1, 2, -1, 0, 1, 0};
stack<point> st;
bool can_drop_big(int x, int y){
for (int i = 0; i < 12; i++) {
int mx = x + bigx[i];
int my = y + bigy[i];
if (mx < 0 || mx >= N || my < 0 || my >= N) {
return false;
}
if (cloth[my][mx] == 0) {
return false;
}
}
return true;
}
bool can_drop_mid(int x, int y){
for (int i = 0; i < 8; i++) {
int mx = x + midx[i];
int my = y + midy[i];
if (cloth[my][mx] == 0) {
return false;
}
}
return true;
}
bool can_drop_small(int x, int y){
for (int i = 0; i < 4; i++) {
int mx = x + smallx[i];
int my = y + smally[i];
if (cloth[my][mx] == 0) {
return false;
}
}
return true;
}
void del_big(int x, int y){
cloth[y][x]--;
for (int i = 0; i < 12; i++) {
int mx = x + bigx[i];
int my = y + bigy[i];
cloth[my][mx]--;
}
}
void del_mid(int x, int y){
cloth[y][x]--;
for (int i = 0; i < 8; i++) {
int mx = x + midx[i];
int my = y + midy[i];
cloth[my][mx]--;
}
}
void del_small(int x, int y){
cloth[y][x]--;
for (int i = 0; i < 4; i++) {
int mx = x + smallx[i];
int my = y + smally[i];
cloth[my][mx]--;
}
}
void dfs(int drop_num, int ink_num){
if (drop_num == n) {
if (ink_num == total_drop) {
while (!st.empty()) {
point p = st.top();
cout << p.x << " " << p.y << " " << p.size << endl;
st.pop();
}
}
return;
}
int cloth_cp[N][N];
for (int y = 1; y < N - 1; y++) {
for (int x = 1; x < N - 1; x++) {
if (cloth[y][x] == 0) {
continue;
}
if (can_drop_big(x, y)) {
memcpy(cloth_cp, cloth, sizeof(cloth));
del_big(x, y);
st.push(point({x, y, 3}));
dfs(drop_num + 1, ink_num + 13);
if (st.empty()) {
return;
}
st.pop();
memcpy(cloth, cloth_cp, sizeof(cloth));
}
if (can_drop_mid(x, y)) {
memcpy(cloth_cp, cloth, sizeof(cloth));
del_mid(x, y);
st.push(point({x, y, 2}));
dfs(drop_num + 1, ink_num + 9);
if (st.empty()) {
return;
}
st.pop();
memcpy(cloth, cloth_cp, sizeof(cloth));
}
if (can_drop_small(x, y)) {
memcpy(cloth_cp, cloth, sizeof(cloth));
del_small(x, y);
st.push(point({x, y, 1}));
dfs(drop_num + 1, ink_num + 5);
if (st.empty()) {
return;
}
st.pop();
memcpy(cloth, cloth_cp, sizeof(cloth));
}
}
}
}
int get_drop_ink_num(){
int count = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (cloth[i][j] >= 0) {
count += cloth[i][j];
}
}
}
return count;
}
int main()
{
cin >> n;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
cin >> cloth[i][j];
}
}
total_drop = get_drop_ink_num();
dfs(0, 0);
return 0;
} | a.cc: In function 'void dfs(int, int)':
a.cc:102:17: error: 'memcpy' was not declared in this scope
102 | memcpy(cloth_cp, cloth, sizeof(cloth));
| ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <stack>
+++ |+#include <cstring>
3 | using namespace std;
a.cc:114:17: error: 'memcpy' was not declared in this scope
114 | memcpy(cloth_cp, cloth, sizeof(cloth));
| ^~~~~~
a.cc:114:17: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:126:17: error: 'memcpy' was not declared in this scope
126 | memcpy(cloth_cp, cloth, sizeof(cloth));
| ^~~~~~
a.cc:126:17: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s186357210 | p00091 | C++ | def read_data():
n=input()
x=[]
for i in range(10): x.append(map(int,raw_input().split()))
return n, x
def is_area3(x,y):
if x>7 or y>5: return False
for dx in [0,1,2,1,0]:
A=P[y][x-dx:x+dx+1]
if A.count(0)>0: return False
y+=1
return True
def is_area2(x,y):
if x>7 or y>7: return False
for dy in [0,1,2]:
A=P[y+dy][x:x+3]
if A.count(0)>0: return False
return True
def is_area1(x,y):
if x>8 or y>7: return False
for dx in [0,1,0]:
A=P[y][x-dx:x+dx+1]
if A.count(0)>0: return False
y+=1
return True
def ink(x,y,s,m):
global P
dx = [0,1,-1,0,0,1,1,-1,-1,2,-2,0,0]
dy = [0,0,-0,1,-1,1,-1,1,-1,0,0,2,-2]
for i in range([5,9,13][s-1]): P[y+dy[i]][x+dx[i]]+=m
return
drops,P = read_data()
A=[]
i=-1
m=3
while i<99:
i+=1
y=i/10
x=i%10
if P[y][x]==0: continue
if m==3:
while is_area3(x,y):
A.append([x,y,3])
ink(x,y+2,3,-1)
if P[y][x]==0:
m=3
continue
else: m=2
if m==2:
while is_area2(x,y):
A.append([x,y,2])
ink(x+1,y+1,2,-1)
if P[y][x]==0:
m=3
continue
else: m=1
if m==1:
while is_area1(x,y):
A.append([x,y,1])
ink(x,y+1,1,-1)
if P[y][x]==0:
m=3
continue
else: m=0
dx=[0,1,0]
dy=[1,1,2]
if m==0 and len(A)>0:
x,y,m=A.pop()
m-=1
ink(x+dx[m],y+dy[m],m+1,1)
i = y*10+x-1
else: break
if drops <=12 and len(A)==drops:
for x,y,s in A: print x+dx[s-1],y+dy[s-1],s | a.cc:1:1: error: 'def' does not name a type
1 | def read_data():
| ^~~
|
s968762685 | p00091 | C++ | #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>
using namespace std;
#define reps(i,f,n) for(int i=f;i<n;i++)
#define repc(i,n) for(int i=0;i<n;i++)
#define rep(i,n) reps(i,0,n)
#define pb push_back
#define X real()
#define Y imag()
const int N = 10;
class P{
public:
int x,y,kind;
P(int x,int y,int kind):x(x),y(y),kind(kind){}
};
class B{
public:
int board[N][N];
B(){rep(i,N)rep(j,N)board[i][j]=0;}
B copy(){
B b;
rep(i,N)rep(j,N)b.board[i][j]=board[i][j];
return b;
}
};
int color[3][5][5]={
{
{0,0,0,0,0},
{0,0,1,0,0},
{0,1,1,1,0},
{0,0,1,0,0},
{0,0,0,0,0},
},
{
{0,0,0,0,0},
{0,1,1,1,0},
{0,1,1,1,0},
{0,1,1,1,0},
{0,0,0,0,0},
},
{
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
}
};
bool canput(B& b, P p){
int a = 5;
int c = 2;
int d = 0;
if(p.kind!=2){
a=3;
c=1;
d=1;
}
bool flg = true;
repc(dy,a){
repc(dx,a){
int nx = p.x+dx-c;
int ny = p.y+dy-c;
if(nx<0 || ny<0 || nx>=N || ny>=N)continue;
if(color[p.kind][dy+d][dx+d]==1 && b.board[ny][nx]==0)flg=false;
}
}
return flg;
}
void put(B& b, P p,int rev=1){
int a = 5;
int c = 2;
int d = 0;
if(p.kind!=2){
a=3;
d=1;
c=1;
}
repc(dy,a){
repc(dx,a){
int nx = p.x+dx-c;
int ny = p.y+dy-c;
if(nx<0 || ny<0 || nx>=N || ny>=N)continue;
if(color[p.kind][dy+d][dx+d]==1){
b.board[ny][nx]-=rev;
}
}
}
}
vector<P> getcand(B& b){
vector<P> ret;
rep(y,N){
rep(x,N){
rep(k,3){
if(canput(b, P(x,y,k))){
ret.pb(P(x,y,k));
}
}
}
}
return ret;
}
vector<P> answ;
int n;
bool saiki(B& b, int x, int y, vector<P>& hoge){
if(x==N-1 && y==N-1){
answ = hoge;
return true;
}
int nx = (x+1)%N;
int ny = y+(x+1)/N;
if(b.board[y][x]==0){
return saiki(b, nx, ny, hoge);
}
bool ret = false;
rep(kind, 3){
rep(dy,5){
rep(dx,5){
if(color[kind][dy][dx]==1){
P np = P(x+dx-2, y+dy-2, kind);
if(canput(b, np)){
put(b, np);
hoge.pb(np);
ret |= saiki(b, nx,ny, hoge);
put(b, np, -1);
hoge.pop_back();
}
}
if(ret)return true;
}
}
}
return false;
}
int main(){
B b;
cin>>n;
rep(i,N)rep(j,N){
char c;
cin>>c;
b.board[i][j] = c-'0';
}
saiki(b, 0,0, vector<P>());
rep(i,answ.size()){
printf("%d %d %d\n",answ[i].x,answ[i].y,answ[i].kind+1);
}
} | a.cc: In function 'int main()':
a.cc:188:23: error: cannot bind non-const lvalue reference of type 'std::vector<P>&' to an rvalue of type 'std::vector<P>'
188 | saiki(b, 0,0, vector<P>());
| ^~~~~~~~~~~
a.cc:138:43: note: initializing argument 4 of 'bool saiki(B&, int, int, std::vector<P>&)'
138 | bool saiki(B& b, int x, int y, vector<P>& hoge){
| ~~~~~~~~~~~^~~~
|
s276681369 | p00091 | C++ | #include <vector>
#include <cstdio>
#include <cstdlib>
using namespace std;
const vector<pair<
int,
vector<vector<int>>
>>pattern={
{13,{
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
}},
{9,{
{1,1,1},
{1,1,1},
{1,1,1},
}},
{5,{
{0,1,0},
{1,1,1},
{0,1,0},
}},
};
vector<vector<int>>m(10);
set<vector<vector<int>>>se;
void dfs(vector<pair<pair<int,int>,int>> &v,int s){
if(s==0){
for(auto &e:v)printf("%d %d %d\n",e.first.first,e.first.second,e.second);
exit(0);
}
if(se.find(m)!=se.end())return;
int cnt=0;
for(auto &pat:pattern){if(s>=pat.first){
for(int y=0;y<=10-pat.second.size();y++){
for(int x=0;x<=10-pat.second[0].size();x++){
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
if(m[y+dy][x+dx]<pat.second[dy][dx])goto fail;
}
}
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
m[y+dy][x+dx]-=pat.second[dy][dx];
}
}
v.push_back(make_pair(make_pair(x+pat.second[0].size()/2,y+pat.second.size()/2),pattern.size()-cnt));
dfs(v,s-pat.first);
v.pop_back();
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
m[y+dy][x+dx]+=pat.second[dy][dx];
}
}
fail:;
}
}
}cnt++;}
se.insert(m);
}
int main(){
int N,y,x,s=0;
scanf("%d",&N);
for(y=0;y<10;y++){
m[y].resize(10);
for(x=0;x<10;x++)scanf("%d",&m[y][x]),s+=m[y][x];
}
vector<pair<pair<int,int>,int>> v;
dfs(v,s);
} | a.cc:30:1: error: 'set' does not name a type
30 | set<vector<vector<int>>>se;
| ^~~
a.cc: In function 'void dfs(std::vector<std::pair<std::pair<int, int>, int> >&, int)':
a.cc:36:12: error: 'se' was not declared in this scope; did you mean 's'?
36 | if(se.find(m)!=se.end())return;
| ^~
| s
a.cc:63:9: error: 'se' was not declared in this scope; did you mean 's'?
63 | se.insert(m);
| ^~
| s
|
s235402910 | p00091 | C++ | #include <vector>
#include <cstdio>
#include <cstdlib>
using namespace std;
const vector<pair<
int,
vector<vector<int>>
>>pattern={
{13,{
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
}},
{9,{
{1,1,1},
{1,1,1},
{1,1,1},
}},
{5,{
{0,1,0},
{1,1,1},
{0,1,0},
}},
};
vector<vector<int>>m(10);
set<vector<vector<int>>>se;
void dfs(vector<pair<pair<int,int>,int>> &v,int s){
if(s==0){
for(auto &e:v)printf("%d %d %d\n",e.first.first,e.first.second,e.second);
exit(0);
}
if(se.find(m)!=se.end())return;
int cnt=0;
for(auto &pat:pattern){if(s>=pat.first){
for(int y=0;y<=10-pat.second.size();y++){
for(int x=0;x<=10-pat.second[0].size();x++){
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
if(m[y+dy][x+dx]<pat.second[dy][dx])goto fail;
}
}
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
m[y+dy][x+dx]-=pat.second[dy][dx];
}
}
v.push_back(make_pair(make_pair(x+pat.second[0].size()/2,y+pat.second.size()/2),pattern.size()-cnt));
dfs(v,s-pat.first);
v.pop_back();
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
m[y+dy][x+dx]+=pat.second[dy][dx];
}
}
fail:;
}
}
}cnt++;}
se.insert(m);
}
int main(){
int N,y,x,s=0;
scanf("%d",&N);
for(y=0;y<10;y++){
m[y].resize(10);
for(x=0;x<10;x++)scanf("%d",&m[y][x]),s+=m[y][x];
}
vector<pair<pair<int,int>,int>> v;
dfs(v,s);
} | a.cc:30:1: error: 'set' does not name a type
30 | set<vector<vector<int>>>se;
| ^~~
a.cc: In function 'void dfs(std::vector<std::pair<std::pair<int, int>, int> >&, int)':
a.cc:36:12: error: 'se' was not declared in this scope; did you mean 's'?
36 | if(se.find(m)!=se.end())return;
| ^~
| s
a.cc:63:9: error: 'se' was not declared in this scope; did you mean 's'?
63 | se.insert(m);
| ^~
| s
|
s360975056 | p00091 | C++ | #include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
using namespace std;
const vector<pair<
int,
vector<vector<int>>
>>pattern={
{{9,2},{
{1,1,1},
{1,1,1},
{1,1,1},
}},
{{13,3},{
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
}},
{{5,1},{
{0,1,0},
{1,1,1},
{0,1,0},
}},
};
vector<vector<int>>m(10);
set<vector<vector<int>>>se;
void dfs(vector<pair<pair<int,int>,int>> &v,int s){
if(s==0){
for(auto &e:v)printf("%d %d %d\n",e.first.first,e.first.second,e.second);
exit(0);
}
if(se.find(m)!=se.end())return;
for(auto &pat:pattern)if(s>=pat.first.first){
for(int y=0;y<=10-pat.second.size();y++){
for(int x=0;x<=10-pat.second[0].size();x++){
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
if(m[y+dy][x+dx]<pat.second[dy][dx])goto fail;
}
}
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
m[y+dy][x+dx]-=pat.second[dy][dx];
}
}
v.push_back(make_pair(make_pair(x+pat.second[0].size()/2,y+pat.second.size()/2),pat.first.second));
dfs(v,s-pat.first.first);
v.pop_back();
for(int dy=0;dy<pat.second.size();dy++){
for(int dx=0;dx<pat.second[0].size();dx++){
m[y+dy][x+dx]+=pat.second[dy][dx];
}
}
fail:;
}
}
}
se.insert(m);
}
int main(){
int N,y,x,s=0;
scanf("%d",&N);
for(y=0;y<10;y++){
m[y].resize(10);
for(x=0;x<10;x++)scanf("%d",&m[y][x]),s+=m[y][x];
}
vector<pair<pair<int,int>,int>> v;
dfs(v,s);
} | a.cc:28:1: error: could not convert '{{{9, 2}, {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}}, {{13, 3}, {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}}, {{5, 1}, {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}}}' from '<brace-enclosed initializer list>' to 'const std::vector<std::pair<int, std::vector<std::vector<int> > > >'
28 | };
| ^
| |
| <brace-enclosed initializer list>
a.cc: In function 'void dfs(std::vector<std::pair<std::pair<int, int>, int> >&, int)':
a.cc:38:47: error: request for member 'first' in 'pat.std::pair<int, std::vector<std::vector<int> > >::first', which is of non-class type 'const int'
38 | for(auto &pat:pattern)if(s>=pat.first.first){
| ^~~~~
a.cc:51:123: error: request for member 'second' in 'pat.std::pair<int, std::vector<std::vector<int> > >::first', which is of non-class type 'const int'
51 | v.push_back(make_pair(make_pair(x+pat.second[0].size()/2,y+pat.second.size()/2),pat.first.second));
| ^~~~~~
a.cc:52:51: error: request for member 'first' in 'pat.std::pair<int, std::vector<std::vector<int> > >::first', which is of non-class type 'const int'
52 | dfs(v,s-pat.first.first);
| ^~~~~
|
s313518126 | p00091 | C++ | #include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
using namespace std;
const vector<pair<
pair<int,int>,
vector<vector<int>>
>>pattern={
{{13,3},{
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
}},
{{9,2},{
{1,1,1},
{1,1,1},
{1,1,1},
}},
{{5,1},{
{0,1,0},
{1,1,1},
{0,1,0},
}},
};
vector<vector<char>>m(10);
vector<pair<pair<int,int>,int>>v;
void dfs(int pat,int y,int x,int N,int d,int s){
if(s==0){
for(auto &e:v)printf("%d %d %d\n",e.first.first,e.first.second,e.second);
exit(0);
}
for(;pat<pattern.size();pat++,y=x=0)if(s>=pattern[pat].first.first){
for(;y<=10-pattern[pat].second.size();y++,x=0){
for(;x<=10-pattern[pat].second[0].size();x++){
for(int dy=0;dy<pattern[pat].second.size();dy++){
for(int dx=0;dx<pattern[pat].second[0].size();dx++){
if(m[y+dy][x+dx]<pattern[pat].second[dy][dx])goto fail;
}
}
for(int dy=0;dy<pattern[pat].second.size();dy++){
for(int dx=0;dx<pattern[pat].second[0].size();dx++){
m[y+dy][x+dx]-=pattern[pat].second[dy][dx];
}
}
v[d]=make_pair(
make_pair(x+pattern[pat].second[0].size()/2,y+pattern[pat].second.size()/2),
pattern[pat].first.second
);
dfs(pat,y,x+1,N,d+1,s-pattern[pat].first.first);
for(int dy=0;dy<pattern[pat].second.size();dy++){
for(int dx=0;dx<pattern[pat].second[0].size();dx++){
m[y+dy][x+dx]+=pattern[pat].second[dy][dx];
}
}
fail:;
}
}
}
}
int main(){
int N,y,x,s=0,z;
scanf("%d",&N);
for(y=0;y<10;y++){
m[y].resize(10);
for(x=0;x<10;x++)scanf("%d",&z),m[y][x]=z,s+=m[y][x];
}
v.resize(N);
dfs(0,0,0,N,0,v,s);
} | a.cc: In function 'int main()':
a.cc:74:23: error: cannot convert 'std::vector<std::pair<std::pair<int, int>, int> >' to 'int'
74 | dfs(0,0,0,N,0,v,s);
| ^
| |
| std::vector<std::pair<std::pair<int, int>, int> >
a.cc:32:46: note: initializing argument 6 of 'void dfs(int, int, int, int, int, int)'
32 | void dfs(int pat,int y,int x,int N,int d,int s){
| ~~~~^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.