Submission #710702

#TimeUsernameProblemLanguageResultExecution timeMemory
710702Ronin13Crossing (JOI21_crossing)C++14
26 / 100
7014 ms92152 KiB
#include <bits/stdc++.h> #define ll long long #define ull unsigned ll #define f first #define s second #define pii pair<int,int> #define pll pair<ll,ll> #define pb push_back #define epb emplace_back using namespace std; const int nmax = 1000001; map <vector <int> , bool> used; vector <vector <int> > vec; vector <int> op(vector <int> &a, vector <int> &b){ vector <int> ans; for(int i = 0; i < a.size(); i++){ int x = a[i] + b[i]; x = -x; x %= 3; x += 3; x %= 3; ans.pb(x); } return ans; } void rec(vector <int> v){ used[v] = true; for(auto to : vec){ vector <int> x = op(to, v); if(used[x]) continue; rec(x); } } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; string a[3]; for(int i = 0; i < 3; i++){ vector<int> v; cin >> a[i]; for(int j = 0; j < n; j++){ if(a[i][j] == 'O') v.pb(0); if(a[i][j] == 'J') v.pb(1); if(a[i][j] == 'I') v.pb(2); } used[v] = true; vec.pb(v); } for(int i = 0; i < 3; i++) rec(vec[i]); int q; cin >> q; vector <int> t; for(int i = 0; i < n; i++){ char c; cin >> c; if(c == 'J') t.pb(1); if(c == 'O') t.pb(0); if(c == 'I') t.pb(2); } if(used[t]) cout << "Yes\n"; else cout << "No\n"; while(q--){ int l,r; cin >> l >> r; char c; cin >> c; int x; if(c == 'O') x = 0; if(c == 'J') x = 1; if(c == 'I') x = 2; if(n <= 100) for(int i = l - 1; i < r; i++) t[i] = x; used[t] ? cout << "Yes\n" : cout << "No\n"; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'std::vector<int> op(std::vector<int>&, std::vector<int>&)':
Main.cpp:19:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i = 0; i < a.size(); i++){
      |                    ~~^~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:84:18: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   84 |             t[i] = x;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...