QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#689516#9246. Dominating PointYipChip#WA 231ms31256kbC++141.1kb2024-10-30 17:32:502024-10-30 17:32:51

Judging History

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

  • [2024-11-22 18:38:25]
  • hack成功,自动添加数据
  • (/hack/1238)
  • [2024-10-30 17:32:51]
  • 评测
  • 测评结果:WA
  • 用时:231ms
  • 内存:31256kb
  • [2024-10-30 17:32:50]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PII;

void solve()
{
    int n;
    cin >> n;
    vector<string> mp(n);
    vector<bitset<3>> dp(n), f(n);
    for (int i = 0; i < n; i ++ )
    {
        cin >> mp[i];
        for (int j = 0; j < n; j ++ )
        {
            dp[i][j] = (mp[i][j] == '1');
            f[i][j] = (mp[i][j] == '1');
        }
        dp[i][i] = f[i][i] = 1;
    }
        
    for (int k = 0; k < n; k ++ )
        for (int i = 0; i < n; i ++ )
            if (dp[i][k])
                f[i] |= dp[k];
    // puts("");
    // for (int i = 0; i < n; i ++ ) cout << dp[i] << '\n';
    // cout << "\n";
    // for (int i = 0; i < n; i ++ ) cout << f[i] << '\n';
    vector<int> ans;
    for (int i = 0; i < n; i ++ )
        if (f[i].count() == n)
            ans.push_back(i + 1);
    if (ans.size() < 3) cout << "NOT FOUND\n";
    else cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int T = 1;
    // cin >> T;
    while (T -- ) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
011010
000101
010111
100001
010100
100010

output:

1 3 4

result:

ok OK, Answer correct.

Test #2:

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

input:

3
011
001
000

output:

NOT FOUND

result:

ok OK, Answer correct.

Test #3:

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

input:

3
010
001
100

output:

1 2 3

result:

ok OK, Answer correct.

Test #4:

score: -100
Wrong Answer
time: 231ms
memory: 31256kb

input:

4994
0100001010011001010101110010101000111101111100100001110010000111100000000100110100101000001010100000010010010110110110111010010010100110100000110110111001010111010111010111011001000101001000010001010111110000000100001100000111100011001010010111011100111010101110011000010111101011111110001111110...

output:

NOT FOUND

result:

wrong output format Expected integer, but "NOT" found