# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43742 | 2018-03-22T02:55:04 Z | nickyrio | Chessboard (IZhO18_chessboard) | C++14 | Compilation error |
0 ms | 0 KB |
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i <= (b); ++i) #define FORD(i, a, b) for (int i = (a); i >= (b); --i) #define REP(i, a) for (int i = 0; i < (a); ++i) #define DEBUG(x) { cerr << #x << '=' << x << endl; } #define Arr(a, l, r) { cerr << #a << " = {"; FOR(_, l, r) cerr << ' ' << a[_]; cerr << "}\n"; } #define N 1001000 #define pp pair<int, int> #define endl '\n' #define IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define taskname "" #define bit(S, i) (((S) >> (i)) & 1) using namespace std; long long n, k, x1[N], x2[N], y1[N], y2[N]; long long solve(int l, int color) {// color = 0 -> Top-left is black long long ans = ((1ll * (n / l) * (n / l) + 1 - color) / 2) * l * l ; REP(i, k) { if (color ^ ((x1[i] / l) % 2) == (y1[i] / l) % 2) ans--; else ans++; } return ans; } int main() { #ifdef NERO freopen("test.inp","r",stdin); freopen("test.out","w",stdout); clock_t stime = clock(); #endif //NERO IO; cin >> n >> k; long long ans = 1e9; REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; REP(i, k) x1[i]--,x2[i]--,y1[i]--,y2[i]--; FOR(i, 1, sqrt(n)) if (n % i == 0) { ans = min(ans, solve(i, 0)); ans = min(ans, solve(i, 1)); } cout << ans; #ifdef NERO clock_t etime = clock(); cerr << "Execution time: " << (etime - stime) / CLOCKS_PER_SEC * 1000 << " ms."; #endif // NERO }
Compilation message
chessboard.cpp:14:35: error: 'long long int y1 [1001000]' redeclared as different kind of symbol long long n, k, x1[N], x2[N], y1[N], y2[N]; ^ In file included from /usr/include/features.h:367:0, from /usr/include/assert.h:35, from /usr/include/c++/5/cassert:43, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:33, from chessboard.cpp:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:251:1: note: previous declaration 'double y1(double)' __MATHCALL (y1,, (_Mdouble_)); ^ chessboard.cpp: In function 'long long int solve(int, int)': chessboard.cpp:19:47: warning: pointer to a function used in arithmetic [-Wpointer-arith] if (color ^ ((x1[i] / l) % 2) == (y1[i] / l) % 2) ans--; ^ chessboard.cpp:19:51: error: invalid operands of types 'double(double) throw ()' and 'int' to binary 'operator/' if (color ^ ((x1[i] / l) % 2) == (y1[i] / l) % 2) ans--; ^ chessboard.cpp: In function 'int main()': chessboard.cpp:33:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:28: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' and 'double(double) throw ()') REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:120:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(__istream_type& (*__pf)(__istream_type&)) ^ /usr/include/c++/5/istream:120:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&) {aka std::basic_istream<char>& (*)(std::basic_istream<char>&)}' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:124:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] <near match> operator>>(__ios_type& (*__pf)(__ios_type&)) ^ /usr/include/c++/5/istream:124:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:131:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(ios_base& (*__pf)(ios_base&)) ^ /usr/include/c++/5/istream:131:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'std::ios_base& (*)(std::ios_base&)' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:168:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(bool& __n) ^ /usr/include/c++/5/istream:168:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid initialization of non-const reference of type 'bool&' from an rvalue of type 'bool' REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:172:7: note: candidate: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>] <near match> operator>>(short& __n); ^ /usr/include/c++/5/istream:172:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'short int' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(short int)((long int)(y1 + ((sizetype)i)))' to 'short int&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:175:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(unsigned short& __n) ^ /usr/include/c++/5/istream:175:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'short unsigned int' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(short unsigned int)((long int)(y1 + ((sizetype)i)))' to 'short unsigned int&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:179:7: note: candidate: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>] <near match> operator>>(int& __n); ^ /usr/include/c++/5/istream:179:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'int' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(int)((long int)(y1 + ((sizetype)i)))' to 'int&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:182:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(unsigned int& __n) ^ /usr/include/c++/5/istream:182:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'unsigned int' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(unsigned int)((long int)(y1 + ((sizetype)i)))' to 'unsigned int&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:186:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(long& __n) ^ /usr/include/c++/5/istream:186:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'long int' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(long int)(y1 + ((sizetype)i))' to 'long int&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:190:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(unsigned long& __n) ^ /usr/include/c++/5/istream:190:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'long unsigned int' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(long unsigned int)(y1 + ((sizetype)i))' to 'long unsigned int&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:195:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(long long& __n) ^ /usr/include/c++/5/istream:195:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'long long int' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(long long int)(y1 + ((sizetype)i))' to 'long long int&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:199:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(unsigned long long& __n) ^ /usr/include/c++/5/istream:199:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'long long unsigned int' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(long long unsigned int)(y1 + ((sizetype)i))' to 'long long unsigned int&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:235:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(void*& __p) ^ /usr/include/c++/5/istream:235:7: note: conversion of argument 1 would be ill-formed: chessboard.cpp:33:35: error: invalid conversion from 'double (*)(double) throw ()' to 'void*' [-fpermissive] REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ chessboard.cpp:33:35: error: cannot bind rvalue '(((void*)y1) + ((sizetype)i))' to 'void*&' In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/istream:214:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] operator>>(float& __f) ^ /usr/include/c++/5/istream:214:7: note: no known conversion for argument 1 from 'double(double) throw ()' to 'float&' /usr/include/c++/5/istream:218:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] operator>>(double& __f) ^ /usr/include/c++/5/istream:218:7: note: no known conversion for argument 1 from 'double(double) throw ()' to 'double&' /usr/include/c++/5/istream:222:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] operator>>(long double& __f) ^ /usr/include/c++/5/istream:222:7: note: no known conversion for argument 1 from 'double(double) throw ()' to 'long double&' /usr/include/c++/5/istream:259:7: note: candidate: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>] operator>>(__streambuf_type* __sb); ^ /usr/include/c++/5/istream:259:7: note: no known conversion for argument 1 from 'double(double) throw ()' to 'std::basic_istream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}' In file included from /usr/include/c++/5/string:53:0, from /usr/include/c++/5/bits/locale_classes.h:40, from /usr/include/c++/5/bits/ios_base.h:41, from /usr/include/c++/5/ios:42, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from chessboard.cpp:1: /usr/include/c++/5/bits/basic_string.tcc:1441:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator>>(basic_istream<_CharT, _Traits>& __in, ^ /usr/include/c++/5/bits/basic_string.tcc:1441:5: note: template argument deduction/substitution failed: chessboard.cpp:33:35: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'double(double) throw ()' REP(i, k) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; ^ In file included from /usr/include/c++/5/istream:934:0, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from /var/