Submission #73538950


Source Code Expand

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

int main(){
  ll T,N,A,now;
  cin >> T;
  for(ll i = 0;i < T;i++){
    cin >> N;
    now = 0;
    vector<vector<ll>> X(2,vector<ll>(N));
    vector<ll> ans(0);
    for(ll j = 0;j < N * 2;j++){
      cin >> A;
      if(X[now][A - 1]){
        now^=1;
        ans.push_back(j);
      }
      X[now][A - 1]++;
    }
    cout << ans.size() << endl;
    for(ll j = 0;j < ans.size();j++){
      cout << ans[j] << " ";
    }
    cout << endl;
  }
}

Submission Info

Submission Time
Task B - Stolen Necklace
User MI6174
Language C++23 (GCC 15.2.0)
Score 500
Code Size 536 Byte
Status AC
Exec Time 143 ms
Memory 10108 KiB

Compile Error

./Main.cpp: In function 'int main()':
./Main.cpp:22:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(ll j = 0;j < ans.size();j++){
      |                  ~~^~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 1
AC × 20
Set Name Test Cases
Sample 00_sample_01.txt
All 00_sample_01.txt, hand-14.txt, hand-15.txt, hand-16.txt, hand-17.txt, max-12.txt, min-13.txt, nyaan_killer-19.txt, random-01.txt, random-02.txt, random-03.txt, random-04.txt, random-05.txt, random-06.txt, random-07.txt, random-08.txt, random-09.txt, random-10.txt, random-11.txt, random-18.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3544 KiB
hand-14.txt AC 81 ms 10036 KiB
hand-15.txt AC 80 ms 10064 KiB
hand-16.txt AC 77 ms 9560 KiB
hand-17.txt AC 77 ms 9596 KiB
max-12.txt AC 80 ms 10108 KiB
min-13.txt AC 70 ms 7964 KiB
nyaan_killer-19.txt AC 78 ms 9516 KiB
random-01.txt AC 143 ms 5860 KiB
random-02.txt AC 55 ms 3452 KiB
random-03.txt AC 59 ms 3492 KiB
random-04.txt AC 68 ms 3832 KiB
random-05.txt AC 70 ms 4720 KiB
random-06.txt AC 71 ms 6096 KiB
random-07.txt AC 79 ms 8208 KiB
random-08.txt AC 78 ms 8324 KiB
random-09.txt AC 78 ms 8268 KiB
random-10.txt AC 78 ms 8292 KiB
random-11.txt AC 78 ms 8200 KiB
random-18.txt AC 33 ms 3420 KiB