Submission #44758496
Source Code Expand
// #cheat_when_I_was_young
// #cheatkhitacontre #khionhatoicheat
// #thaycuckythatvong
#include "bits/stdc++.h"
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int NM = 2005;
int n, m, ans;
char a[NM][NM];
bool b[NM][NM];
signed main() {
IOS;
cin >> n >> m;
for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) cin >> a[i][j];
while (true) {
bool ok = 0;
for (int i = 1; i <= n; ++i) {
vector<char> v;
for (int j = 1; j <= m; ++j) if (!b[i][j]) v.push_back(a[i][j]);
if (v.size() <= 1) continue;
bool ook = 1;
for (int j = 1; j < v.size(); ++j) if (v[j] != v[j-1]) ook = 0;
if (ook) {
ok = 1;
for (int j = 1; j <= m; ++j) b[i][j] = 1;
}
}
for (int i = 1; i <= m; ++i) {
vector<char> v;
for (int j = 1; j <= n; ++j) if (!b[j][i]) v.push_back(a[j][i]);
if (v.size() <= 1) continue;
bool ook = 1;
for (int j = 1; j < v.size(); ++j) if (v[j] != v[j-1]) ook = 0;
if (ook) {
ok = 1;
for (int j = 1; j <= n; ++j) b[j][i] = 1;
}
}
if (!ok) break;
}
for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) ans += 1 - b[i][j];
cout << ans;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Magical Cookies |
| User | cheatkhitacontre |
| Language | C++ 20 (gcc 12.2) |
| Score | 0 |
| Code Size | 1430 Byte |
| Status | WA |
| Exec Time | 2208 ms |
| Memory | 11436 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:22:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
22 | for (int j = 1; j < v.size(); ++j) if (v[j] != v[j-1]) ook = 0;
| ~~^~~~~~~~~~
Main.cpp:33:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
33 | for (int j = 1; j < v.size(); ++j) if (v[j] != v[j-1]) ook = 0;
| ~~^~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample00.txt, sample01.txt, sample02.txt |
| All | sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample00.txt | AC | 1 ms | 3420 KiB |
| sample01.txt | WA | 1 ms | 3584 KiB |
| sample02.txt | AC | 1 ms | 3508 KiB |
| testcase00.txt | AC | 47 ms | 7356 KiB |
| testcase01.txt | AC | 73 ms | 11336 KiB |
| testcase02.txt | AC | 63 ms | 11252 KiB |
| testcase03.txt | AC | 63 ms | 11356 KiB |
| testcase04.txt | AC | 60 ms | 11020 KiB |
| testcase05.txt | AC | 67 ms | 9660 KiB |
| testcase06.txt | TLE | 2208 ms | 11060 KiB |
| testcase07.txt | TLE | 2208 ms | 11036 KiB |
| testcase08.txt | TLE | 2208 ms | 10924 KiB |
| testcase09.txt | TLE | 2208 ms | 11052 KiB |
| testcase10.txt | AC | 55 ms | 10576 KiB |
| testcase11.txt | TLE | 2208 ms | 11108 KiB |
| testcase12.txt | TLE | 2208 ms | 11036 KiB |
| testcase13.txt | TLE | 2208 ms | 10408 KiB |
| testcase14.txt | TLE | 2208 ms | 11204 KiB |
| testcase15.txt | AC | 58 ms | 11280 KiB |
| testcase16.txt | TLE | 2208 ms | 10788 KiB |
| testcase17.txt | TLE | 2208 ms | 11040 KiB |
| testcase18.txt | TLE | 2208 ms | 10952 KiB |
| testcase19.txt | TLE | 2208 ms | 11204 KiB |
| testcase20.txt | AC | 52 ms | 11344 KiB |
| testcase21.txt | TLE | 2208 ms | 10440 KiB |
| testcase22.txt | TLE | 2208 ms | 11204 KiB |
| testcase23.txt | TLE | 2208 ms | 10212 KiB |
| testcase24.txt | TLE | 2208 ms | 11000 KiB |
| testcase25.txt | TLE | 2208 ms | 11108 KiB |
| testcase26.txt | TLE | 2208 ms | 11004 KiB |
| testcase27.txt | TLE | 2208 ms | 11036 KiB |
| testcase28.txt | TLE | 2208 ms | 11024 KiB |
| testcase29.txt | WA | 50 ms | 11344 KiB |
| testcase30.txt | AC | 57 ms | 11244 KiB |
| testcase31.txt | WA | 51 ms | 11348 KiB |
| testcase32.txt | AC | 56 ms | 11436 KiB |