Submission #709596

#TimeUsernameProblemLanguageResultExecution timeMemory
709596yuuhiAncient Machine (JOI21_ancient_machine)C++17
70 / 100
73 ms8340 KiB
#include<bits/stdc++.h> #include "Anna.h" #define f first #define s second #define double long double #define _size(x) ((int)((x).size())) using namespace std ; typedef pair< int , int > ii ; void Anna (int n , vector< char > s) { int flag = 0 ; for (int i = 0 ; i < n ; ++ i) { if (!flag && s[i] == 'X') { flag = 1 ; Send(1) ; continue ; } if (!flag) { Send(0) ; continue ; } if (s[i] == 'Z') { Send(1) ; } else { Send(0) ; } } }
#include<bits/stdc++.h> #include "Bruno.h" #define f first #define s second #define double long double #define _size(x) ((int)((x).size())) using namespace std ; typedef pair< int , int > ii ; void Bruno (int n , int L , vector< int > b) { vector< int > erased(n) ; auto Erase = [&](int x) { if (erased[x]) return ; erased[x] = 1 ; Remove(x) ; }; for (int i = 0 , last = -1 ; i < n ; ++ i) if (b[i]) { if (last != -1) { for (int j = i - 1 ; j >= last + 1 ; -- j) Erase(j) ; Erase(i) ; } last = i ; } for (int i = 0 ; i < n ; ++ i) Erase(i) ; } /* 10 X Y Y X Z Y X Z Y Z */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...