이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=1e6+7;
ll n,m,k;
vector<string>b;
string s1,s2,s3,t;
char vs[3]={'J', 'O', 'I'};
int vls[500];
string cross(const string& a, const string& b){
string c;
for(int i=0;i<a.size();i++){
if(a[i]==b[i]){
c+=a[i];
}
else {
c+=vs[3-vls[a[i]]-vls[b[i]]];
}
}
return c;
}
bool compare(const string& s){
for(int i=0;i<b.size();i++){
if(s==b[i])return true;
}
return false;
}
int main() {
vls['J']=0;
vls['O']=1;
vls['I']=2;
cin>>n;
cin>>s1>>s2>>s3;
b.push_back(s1);
b.push_back(s2);
b.push_back(s3);
b.push_back(cross(s1,s2));
b.push_back(cross(s2,s3));
b.push_back(cross(s1,s3));
b.push_back(cross(b[3],b[4]));
b.push_back(cross(b[3],b[5]));
b.push_back(cross(b[4],b[5]));
cin>>m;
cin>>t;
if(compare(t)){
cout<<"Yes\n";
}
else cout<<"No\n";
for(int i=0;i<m;i++){
int l,r;
char c;
cin>>l>>r>>c;
l--,r--;
for(int j=l;j<=r;j++){
t[j]=c;
}
if(compare(t)){
cout<<"Yes\n";
}
else cout<<"No\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'std::string cross(const string&, const string&)':
Main.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
21 | for(int i=0;i<a.size();i++){
| ~^~~~~~~~~
Main.cpp:26:29: warning: array subscript has type 'char' [-Wchar-subscripts]
26 | c+=vs[3-vls[a[i]]-vls[b[i]]];
| ^
Main.cpp:26:39: warning: array subscript has type 'char' [-Wchar-subscripts]
26 | c+=vs[3-vls[a[i]]-vls[b[i]]];
| ^
Main.cpp: In function 'bool compare(const string&)':
Main.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(int i=0;i<b.size();i++){
| ~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |