QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#135760#5521. Excellent XOR ProblemUNos_maricones#WA 75ms13912kbC++141.2kb2023-08-05 23:44:592023-08-05 23:45:00

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-05 23:45:00]
  • 评测
  • 测评结果:WA
  • 用时:75ms
  • 内存:13912kb
  • [2023-08-05 23:44:59]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define pb push_back

typedef long long ll;
typedef pair <int,int> pii;

const int N = 200'005;

int pref[N];

int main () {
        
    #ifndef LOCAL
    #endif

    int t;
    scanf ( "%d", &t );
    while (t--) {
        int n;
        scanf ( "%d", &n );
        map <int, int> mp;
        int mini = 1 << 30, maxi = 0;
        for ( int i = 1; i <= n; ++i ) {
            int curr;
            scanf ( "%d", &curr );
            pref[i] = pref[i-1] ^ curr;
            mp[pref[i]] = i;
            if ( pref[i] != 0 ) {
                mini = min ( mini, pref[i] );
                maxi = max ( maxi, pref[i] );
            }
        }

        if ( pref[n] != 0 ) {
            printf ( "YES\n2\n1 1\n2 %d\n", n );
        } else {
            if ( mp.size() <= 2 ) {
                printf ( "NO\n" );
            } else {
                int min_i = mp[mini], max_i = mp[maxi];
                if ( min_i > max_i ) swap ( min_i, max_i );
                printf ( "YES\n3\n1 %d\n%d %d\n%d %d\n", min_i, min_i+1, max_i, n, n );
            }
        }
    }

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3636kb

input:

4
2
0 0
3
1 2 3
5
16 8 4 2 1
6
42 42 42 42 42 42

output:

NO
YES
3
1 1
2 2
3 3
YES
2
1 1
2 5
NO

result:

ok Correct (4 test cases)

Test #2:

score: 0
Accepted
time: 16ms
memory: 4472kb

input:

1
200000
0 0 104990627 0 104990627 0 0 0 0 104990627 0 104990627 0 0 104990627 104990627 0 0 0 0 0 104990627 0 0 0 104990627 104990627 104990627 0 104990627 0 104990627 104990627 0 104990627 0 0 0 104990627 104990627 0 0 104990627 104990627 0 0 104990627 0 0 0 0 0 104990627 104990627 0 0 0 0 0 10499...

output:

YES
2
1 1
2 200000

result:

ok Correct (1 test case)

Test #3:

score: -100
Wrong Answer
time: 75ms
memory: 13912kb

input:

1
200000
916550535 1039111536 183367143 845311658 473404911 844600350 249761080 860927112 268559756 661297994 448456545 184790162 804023458 655065019 442145717 130497524 509071033 644651807 1039510287 766490362 514960668 612238468 863513676 417538457 839195481 901404895 760875212 983171045 343221187...

output:

YES
3
1 95
96 195535
200000 200000

result:

FAIL has to be a partition (test case 1)