답안 #48841

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48841 2018-05-19T09:25:07 Z mrtsima22 Chessboard (IZhO18_chessboard) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
int a[100000], b[100000], x2[100000], y2[100000];
int main() {
  int n, k;
  long long ansT, ans = 10000000000LL;
  cin>>n>>k;
  for(int i = 0; i < k; ++i) {
    cin>>a[i]>>b[i]>>x2[i]>>y2[i];
    a[i]--;b[i]--;
    x2[i]--;y2[i]--;
  }
  for(int j = 1; j < n; ++j)
    if(n % j == 0) { 
      ansT = 0;
      for(int i = 0; i < k; ++i)
        if((a[i]/j + b[i]/j) % 2 == 0)
          ++ansT;
      ansT = ansT * 2 - k;
      if(ansT + (long long)n * n / j / j / 2 * j * j < ans)
        ans = ansT + (long long)n * n / j / j / 2 * j * j;
      ansT = -ansT;
      if(ansT + ((long long)n * n / j / j + 1) / 2 * j * j < ans)
        ans = ansT + ((long long)n * n / j / j + 1) / 2 * j * j;
    }
  cout<<ans<<endl;
  return 0;
}


Compilation message

chessboard.cpp: In function 'int main()':
chessboard.cpp:6:3: error: 'cin' was not declared in this scope
   cin>>n>>k;
   ^~~
chessboard.cpp:6:3: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:75:0,
                 from chessboard.cpp:1:
/usr/include/c++/7/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^~~
chessboard.cpp:25:3: error: 'cout' was not declared in this scope
   cout<<ans<<endl;
   ^~~~
chessboard.cpp:25:3: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:75:0,
                 from chessboard.cpp:1:
/usr/include/c++/7/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~
chessboard.cpp:25:14: error: 'endl' was not declared in this scope
   cout<<ans<<endl;
              ^~~~
chessboard.cpp:25:14: note: suggested alternative:
In file included from /usr/include/c++/7/istream:39:0,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from chessboard.cpp:1:
/usr/include/c++/7/ostream:590:5: note:   'std::endl'
     endl(basic_ostream<_CharT, _Traits>& __os)
     ^~~~