Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("Ofast")
- // #pragma GCC target("avx,avx2,fma")
- #include<bits/stdc++.h>
- #define F first
- #define S second
- #define vec vector
- #define pb push_back
- #define cld complex<ld>
- #define pll pair<ll, ll>
- #define pdd pair<ld, ld>
- #define umap unordered_map
- #define uset unordered_set
- #define pii pair<int, int>
- #define pnn pair<Node*, Node*>
- #define all(m) m.begin(), m.end()
- #define uid uniform_int_distribution
- #define init(m, x) memset(m, x, sizeof(m));
- #define pripii(p) cout << "{" << p.F << ", " << p.S << "} "
- #define FILE ifstream in("input.txt"); ofstream out("output.txt");
- #define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
- using namespace std;
- typedef string str;
- typedef long long ll;
- typedef long double ld;
- typedef unsigned int uint;
- typedef unsigned long long ull;
- mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
- void solve(ll N) {
- cout<<"T = "<<N<<endl;
- int a, b; cin >> a >> b;
- vec<int> rw[a], cl[b];
- for (int q = 0; q < a; q++) {
- int sz; cin >> sz;
- rw[q] = vec<int>(sz);
- for (int w = 0; w < sz; w++) cin >> rw[q][w];
- }
- for (int q = 0; q < b; q++) {
- int sz; cin >> sz;
- cl[q] = vec<int>(sz);
- for (int w = 0; w < sz; w++) cin >> cl[q][w];
- }
- cout<<"[clues]\n";
- cout<<"columns = \n";
- for(int q=0; q<b; q++){
- assert(cl[q].size());
- //cout<<cl[q].size()<<" ";
- cout<<"\t"; for(int i : cl[q]) cout<<i<<" ";
- cout<<"\n";
- }
- cout<<"\n";
- cout<<"rows = \n";
- for(int q=0; q<a; q++){
- assert(rw[q].size());
- //cout<<rw[q].size()<<" ";
- cout<<"\t"; for(int i : rw[q]) cout<<i<<" ";
- cout<<"\n";
- }
- cout<<"------------------------------"<<endl;
- }
- int main() {
- fast;
- int z; cin >> z;
- for (int q=0; q<z; q++) {
- solve(q);
- }
- }
- #pragma GCC optimize("Ofast")
- // #pragma GCC target("avx,avx2,fma")
- #include<bits/stdc++.h>
- #define F first
- #define S second
- #define vec vector
- #define pb push_back
- #define cld complex<ld>
- #define pll pair<ll, ll>
- #define pdd pair<ld, ld>
- #define umap unordered_map
- #define uset unordered_set
- #define pii pair<int, int>
- #define pnn pair<Node*, Node*>
- #define all(m) m.begin(), m.end()
- #define uid uniform_int_distribution
- #define init(m, x) memset(m, x, sizeof(m));
- #define pripii(p) cout << "{" << p.F << ", " << p.S << "} "
- #define FILE ifstream in("input.txt"); ofstream out("output.txt");
- #define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
- using namespace std;
- typedef string str;
- typedef long long ll;
- typedef long double ld;
- typedef unsigned int uint;
- typedef unsigned long long ull;
- mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
- int main(){
- fast;
- str t;
- vec<str> m;
- for (; getline(cin, t);) {
- //cout << t << endl;
- m.pb(t);
- }
- int a = 0, b = 0;
- for (; m[a][0] == '#';) a++;
- for (int w = 0; w < m[0].size(); w++) {
- if (m[0][w] == '#') b = w + 1;
- }
- for (str &u : m) {
- u.erase(u.begin(), u.begin() + b);
- }
- m.erase(m.begin(), m.begin() + a);
- for (str &u : m) {
- str n;
- for (char c : u) if (c == '.' || c == '#') n.pb(c);
- u = n;
- }
- a = m.size(), b = m[0].size();
- for(int q=0; q<a; q++){
- for(int w=0; w<b; w++){
- cout<<(m[q][w]=='#' ? 1 : 0)<<" ";
- }
- cout<<"\n";
- }
- }
- #pragma GCC optimize("Ofast")
- // #pragma GCC target("avx,avx2,fma")
- #include<bits/stdc++.h>
- #define F first
- #define S second
- #define vec vector
- #define pb push_back
- #define cld complex<ld>
- #define pll pair<ll, ll>
- #define pdd pair<ld, ld>
- #define umap unordered_map
- #define uset unordered_set
- #define pii pair<int, int>
- #define pnn pair<Node*, Node*>
- #define all(m) m.begin(), m.end()
- #define uid uniform_int_distribution
- #define init(m, x) memset(m, x, sizeof(m));
- #define pripii(p) cout << "{" << p.F << ", " << p.S << "} "
- #define FILE ifstream in("input.txt"); ofstream out("output.txt");
- #define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
- using namespace std;
- typedef string str;
- typedef long long ll;
- typedef long double ld;
- typedef unsigned int uint;
- typedef unsigned long long ull;
- mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
- vec<int> fu(vec<int> m){
- vec<int> o;
- int d = 0;
- for (int i : m) {
- if (i) d++;
- else {
- if (d) o.pb(d);
- d = 0;
- }
- }
- if (d) o.pb(d);
- //int sz = o.size();o.insert(o.begin(), sz);
- return o;
- }
- int main() {
- fast;
- int a = 100, b = 100;
- vec<int> rw[a], cl[b];
- for (int q = 0; q < a; q++) {
- int sz; cin >> sz;
- rw[q] = vec<int>(sz);
- for (int w = 0; w < sz; w++) cin >> rw[q][w];
- }
- for (int q = 0; q < b; q++) {
- int sz; cin >> sz;
- cl[q] = vec<int>(sz);
- for (int w = 0; w < sz; w++) cin >> cl[q][w];
- }
- vec<int> m[a];
- for (int q = 0; q < a; q++) {
- m[q] = vec<int>(b);
- for (int w = 0; w < b; w++) {
- cin >> m[q][w];
- }
- }
- for (int q = 0; q < a; q++) {
- for(int i : rw[q]) cout<<i<<" "; cout<<endl;
- for (int i : fu(m[q])) cout << i << " "; cout<<endl;
- assert(fu(m[q])==rw[q]);
- }
- for (int w = 0; w < b; w++) {
- vec<int> n;
- for(int q=0; q<a; q++){
- n.pb(m[q][w]);
- }
- assert(fu(n)==cl[w]);
- //for (int i : fu(n)) cout << i << " "; cout << "\n";
- }
- cout<<"OK!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement