제출 #1142280

#제출 시각아이디문제언어결과실행 시간메모리
1142280SmuggingSpunCrossing (JOI21_crossing)C++20
26 / 100
167 ms9168 KiB
#include<bits/stdc++.h> #define taskname "A" using namespace std; typedef long long ll; int n; string sa, sb, sc; namespace sub1{ void solve(){ int q; string t; cin >> q >> t; cout << (t == sa ? "Yes\n" : "No\n"); for(int _ = 0; _ < q; _++){ int l, r; char c; cin >> l >> r >> c; for(int i = l - 1; i < r; i++){ t[i] = c; } cout << (t == sa ? "Yes\n" : "No\n"); } } } namespace sub2{ const int base = 397; const int mod = 1e9 + 33; void solve(){ vector<int>pw(n + 1); int init = 0; for(int i = pw[0] = 1; i <= n; i++){ init = (init + 1LL * (pw[i] = 1LL * pw[i - 1] * base % mod) * sa[i - 1]) % mod; } for(int i = 1; i <= n; i++){ pw[i] = (pw[i] + pw[i - 1]) % mod; } vector<pair<int, char>>st(n << 2 | 3); int q; string t; cin >> q >> t; t = '#' + t; auto build = [&] (auto&& self, int id, int l, int r){ if(l == r){ st[id] = make_pair(1LL * (pw[l] - pw[l - 1] + mod) * t[l] % mod, '#'); return; } int m = (l + r) >> 1; self(self, id << 1, l, m); self(self, id << 1 | 1, m + 1, r); st[id] = make_pair((st[id << 1].first + st[id << 1 | 1].first) % mod, '#'); }; auto push_down = [&] (int id, int l, int r, int m){ if(st[id].second != '#'){ st[id << 1] = make_pair(1LL * (pw[m] - pw[l - 1] + mod) * st[id].second % mod, st[id].second); st[id << 1 | 1] = make_pair(1LL * (pw[r] - pw[m] + mod) * st[id].second % mod, st[id].second); st[id].second = '#'; } }; auto update = [&] (auto&& self, int id, int l, int r, int u, int v, char x){ if(l > v || r < u){ return; } if(u <= l && v >= r){ st[id] = make_pair(1LL * (pw[r] - pw[l - 1] + mod) * x % mod, x); return; } int m = (l + r) >> 1; push_down(id, l, r, m); self(self, id << 1, l, m, u, v, x); self(self, id << 1 | 1, m + 1, r, u, v, x); st[id].first = (st[id << 1].first + st[id << 1 | 1].first) % mod; }; build(build, 1, 1, n); cout << (st[1].first == init ? "Yes\n" : "No\n"); for(int _ = 0; _ < q; _++){ int l, r; char c; cin >> l >> r >> c; update(update, 1, 1, n, l, r, c); cout << (st[1].first == init ? "Yes\n" : "No\n"); } } } namespace sub3{ void solve(){ } } namespace sub4{ void solve(){ } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } cin >> n >> sa >> sb >> sc; if(n <= 100 && sa == sb && sb == sc){ sub1::solve(); } else if(sa == sb && sa == sc){ sub2::solve(); } else if(n <= 100){ sub3::solve(); } else{ sub4::solve(); } }

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

Main.cpp: In function 'int main()':
Main.cpp:96:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   96 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...