제출 #257044

#제출 시각아이디문제언어결과실행 시간메모리
257044dooweyBoard (CEOI13_board)C++14
10 / 100
1097 ms1216 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); vector<int> gen(string t){ vector<int> res = {1}; for(char x : t){ if(x == '1') res.push_back(0); else if(x == '2') res.push_back(1); else if(x == 'U'){ res.pop_back(); } else if(x == 'L'){ int id = res.size() - 1; while(id >= 0){ if(res[id] == 0){ res[id] ^= 1; } else{ res[id] ^= 1; break; } id -- ; } } else{ int id = res.size() - 1; while(id >= 0){ if(res[id] == 0){ res[id] ^= 1; break; } else{ res[id] ^= 1; } id -- ; } } } return res; } int main(){ fastIO; string a, b; cin >> a >> b; vector<int> p = gen(a), q = gen(b); if(p.size() > q.size()) swap(p,q); int ans = 0; int cq; for(int t = 0; t < p.size(); t ++ ){ if(p[t] != q[t]){ cq = t + 1; while(cq < p.size()){ if(p[cq] != p[t]) cq ++ ; else break; } while(p.size() > cq){ ans ++ ; p.pop_back(); } ans ++ ; for(int j = t; j < cq; j ++ ){ p[j] ^= 1; } } } ans += (int)q.size() - (int)p.size(); cout << ans << "\n"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

board.cpp: In function 'int main()':
board.cpp:60:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int t = 0; t < p.size(); t ++ ){
                    ~~^~~~~~~~~~
board.cpp:63:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             while(cq < p.size()){
                   ~~~^~~~~~~~~~
board.cpp:67:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             while(p.size() > cq){
                   ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...