Submission #1294544

#TimeUsernameProblemLanguageResultExecution timeMemory
1294544serkanrashidAncient Machine (JOI21_ancient_machine)C++20
30 / 100
52 ms7512 KiB
#include "Anna.h" #include<bits/stdc++.h> using namespace std; pair<int,int> encode(char c) { pair<int,int>res = {0,0}; if(c == 'X') res = {0,0}; if(c == 'Y') res = {0,1}; if(c == 'Z') res = {1,0}; return res; } void Anna(int N, std::vector<char> S) { for(int i = 0; i < N; i++) { pair<int,int> p = encode(S[i]); Send(p.first); Send(p.second); } }
#include "Bruno.h" #include<bits/stdc++.h> using namespace std; char decode(pair<int,int> p) { if(p == make_pair(0,0)) return 'X'; if(p == make_pair(0,1)) return 'Y'; if(p == make_pair(1,0)) return 'Z'; } const int MAXN = 1e5 + 5; char s[MAXN]; void Bruno(int N, int L, std::vector<int> A) { for(int j = 0; j < A.size(); j += 2) { s[j/2 + 1] = decode({A[j],A[j+1]}); } vector<int>br; for(int i = 1; i <= N; i++) { if(s[i] == 'X') br.push_back(i); else if(s[i] == 'Y') { if(br.size()) br.push_back(i); else Remove(i-1); } else if(s[i] == 'Z') { while(br.size() >= 2) { Remove(br.back() - 1); br.pop_back(); } Remove(i-1); } } while(br.size() >= 1) { Remove(br.back() - 1); br.pop_back(); } }

Compilation message (stderr)

# 2번째 컴파일 단계

Bruno.cpp: In function 'char decode(std::pair<int, int>)':
Bruno.cpp:10:1: warning: control reaches end of non-void function [-Wreturn-type]
   10 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...