QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#301294#6365. Cut the CakeSolitaryDream#WA 0ms3768kbC++17843b2024-01-09 17:25:042024-01-09 17:25:04

Judging History

你现在查看的是最新测评结果

  • [2024-01-09 17:25:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3768kb
  • [2024-01-09 17:25:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)

const int N=205;
int b[N],c[N];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m,K;
    cin >> n >> m >> K;
    FOR(i,1,n) {
        string s;
        cin >> s;
        FOR(j,1,m) {
            b[i]+=s[j-1]-'0';
            c[j]+=s[j-1]-'0';
        }
    }
    int s=0;
    vector<int> ans;
    FOR(i,1,n-1) {
        s+=b[i];
        if(s%K==0 && b[i]) {
            ans.push_back(i);
        }
    }
    s=0;
    FOR(i,1,m-1) {
        s+=c[i];
        if(s%K==0 && c[i]) {
            ans.push_back(i);
        }
    }
    if(ans.size()==K*2-2) {
        cout << "YES\n";
        for(auto x: ans) cout << x << '\n';
    } else {
        cout << "NO\n";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3768kb

input:

4 4 2
1000
0001
0010
0001

output:

YES
2
3

result:

ok good plan

Test #2:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

3 4 2
1110
0000
0100

output:

NO

result:

ok no solution

Test #3:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

10 10 2
0000000010
0000000000
0000000001
0000000000
0000000000
0000000000
0000100000
0000000000
0000001000
0000000000

output:

NO

result:

ok no solution

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3592kb

input:

10 10 2
0001000100
0000000000
0000100000
0000000000
0000000000
0000000000
0000000001
0000000000
0000000000
0000000000

output:

NO

result:

wrong answer read NO but expected YES