結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2019-07-12 14:40:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 921 bytes |
コンパイル時間 | 894 ms |
コンパイル使用メモリ | 67,964 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 13:45:28 |
合計ジャッジ時間 | 2,250 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 6 |
other | WA * 40 |
ソースコード
#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstring> #include <math.h> #include <string> using namespace std; #define MAX 10001 bool dp[MAX]; bool IsPrime(int num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; // 偶数はあらかじめ除く double sqrtNum = sqrt((double)num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { // 素数ではない return false; } } // 素数である return true; } int main() { int H, W; cin >> H >> W; int table[51][51]; int cnt = 0; for(int i = 0 ; i < H ; ++i) { string s; cin >> s; for(int j = 0 ; j < W ; ++j) { table[i][j] = s.at(j) == '#' ? 1 : 0; if(table[i][j]) ++cnt; } } if((cnt%2) != 0) { cout << "No"; return 0; } cout << "Yes"; return 0; }