wery00

Untitled

Mar 1st, 2021
837
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma GCC optimize("Ofast")
  2. // #pragma GCC target("avx,avx2,fma")
  3.  
  4. #include<bits/stdc++.h>
  5.  
  6. #define F first
  7. #define S second
  8. #define vec vector
  9. #define pb push_back
  10. #define cld complex<ld>
  11. #define pll pair<ll, ll>
  12. #define pdd pair<ld, ld>
  13. #define umap unordered_map
  14. #define uset unordered_set
  15. #define pii pair<int, int>
  16. #define pnn pair<Node*, Node*>
  17. #define all(m) m.begin(), m.end()
  18. #define uid uniform_int_distribution
  19. #define init(m, x) memset(m, x, sizeof(m));
  20. #define pripii(p) cout << "{" << p.F << ", " << p.S << "} "
  21. #define FILE ifstream in("input.txt"); ofstream out("output.txt");
  22. #define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
  23. using namespace std;
  24. typedef string str;
  25. typedef long long ll;
  26. typedef long double ld;
  27. typedef unsigned int uint;
  28. typedef unsigned long long ull;
  29. mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
  30.  
  31. void solve(ll N) {
  32.     cout<<"T = "<<N<<endl;
  33.     int a, b; cin >> a >> b;
  34.     vec<int> rw[a], cl[b];
  35.     for (int q = 0; q < a; q++) {
  36.         int sz; cin >> sz;
  37.         rw[q] = vec<int>(sz);
  38.         for (int w = 0; w < sz; w++) cin >> rw[q][w];
  39.     }
  40.     for (int q = 0; q < b; q++) {
  41.         int sz; cin >> sz;
  42.         cl[q] = vec<int>(sz);
  43.         for (int w = 0; w < sz; w++) cin >> cl[q][w];
  44.     }
  45.     cout<<"[clues]\n";
  46.     cout<<"columns = \n";
  47.     for(int q=0; q<b; q++){
  48.         assert(cl[q].size());
  49.         //cout<<cl[q].size()<<" ";
  50.         cout<<"\t"; for(int i : cl[q]) cout<<i<<" ";
  51.         cout<<"\n";
  52.     }
  53.     cout<<"\n";
  54.     cout<<"rows = \n";
  55.     for(int q=0; q<a; q++){
  56.         assert(rw[q].size());
  57.         //cout<<rw[q].size()<<" ";
  58.         cout<<"\t"; for(int i : rw[q]) cout<<i<<" ";
  59.         cout<<"\n";
  60.     }
  61.     cout<<"------------------------------"<<endl;
  62. }
  63.  
  64. int main() {
  65.     fast;
  66.     int z; cin >> z;
  67.     for (int q=0; q<z; q++) {
  68.         solve(q);
  69.     }
  70. }
  71. #pragma GCC optimize("Ofast")
  72. // #pragma GCC target("avx,avx2,fma")
  73.  
  74. #include<bits/stdc++.h>
  75.  
  76. #define F first
  77. #define S second
  78. #define vec vector
  79. #define pb push_back
  80. #define cld complex<ld>
  81. #define pll pair<ll, ll>
  82. #define pdd pair<ld, ld>
  83. #define umap unordered_map
  84. #define uset unordered_set
  85. #define pii pair<int, int>
  86. #define pnn pair<Node*, Node*>
  87. #define all(m) m.begin(), m.end()
  88. #define uid uniform_int_distribution
  89. #define init(m, x) memset(m, x, sizeof(m));
  90. #define pripii(p) cout << "{" << p.F << ", " << p.S << "} "
  91. #define FILE ifstream in("input.txt"); ofstream out("output.txt");
  92. #define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
  93. using namespace std;
  94. typedef string str;
  95. typedef long long ll;
  96. typedef long double ld;
  97. typedef unsigned int uint;
  98. typedef unsigned long long ull;
  99. mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
  100.  
  101. int main(){
  102.     fast;
  103.     str t;
  104.     vec<str> m;
  105.     for (; getline(cin, t);) {
  106.         //cout << t << endl;
  107.         m.pb(t);
  108.     }
  109.     int a = 0, b = 0;
  110.     for (; m[a][0] == '#';) a++;
  111.     for (int w = 0; w < m[0].size(); w++) {
  112.         if (m[0][w] == '#') b = w + 1;
  113.     }
  114.     for (str &u : m) {
  115.         u.erase(u.begin(), u.begin() + b);
  116.     }
  117.     m.erase(m.begin(), m.begin() + a);
  118.     for (str &u : m) {
  119.         str n;
  120.         for (char c : u) if (c == '.' || c == '#') n.pb(c);
  121.         u = n;
  122.     }
  123.     a = m.size(), b = m[0].size();
  124.     for(int q=0; q<a; q++){
  125.         for(int w=0; w<b; w++){
  126.             cout<<(m[q][w]=='#' ? 1 : 0)<<" ";
  127.         }
  128.         cout<<"\n";
  129.     }
  130. }
  131. #pragma GCC optimize("Ofast")
  132. // #pragma GCC target("avx,avx2,fma")
  133.  
  134. #include<bits/stdc++.h>
  135.  
  136. #define F first
  137. #define S second
  138. #define vec vector
  139. #define pb push_back
  140. #define cld complex<ld>
  141. #define pll pair<ll, ll>
  142. #define pdd pair<ld, ld>
  143. #define umap unordered_map
  144. #define uset unordered_set
  145. #define pii pair<int, int>
  146. #define pnn pair<Node*, Node*>
  147. #define all(m) m.begin(), m.end()
  148. #define uid uniform_int_distribution
  149. #define init(m, x) memset(m, x, sizeof(m));
  150. #define pripii(p) cout << "{" << p.F << ", " << p.S << "} "
  151. #define FILE ifstream in("input.txt"); ofstream out("output.txt");
  152. #define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
  153. using namespace std;
  154. typedef string str;
  155. typedef long long ll;
  156. typedef long double ld;
  157. typedef unsigned int uint;
  158. typedef unsigned long long ull;
  159. mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
  160.  
  161. vec<int> fu(vec<int> m){
  162.     vec<int> o;
  163.     int d = 0;
  164.     for (int i : m) {
  165.         if (i) d++;
  166.         else {
  167.             if (d) o.pb(d);
  168.             d = 0;
  169.         }
  170.     }
  171.     if (d) o.pb(d);
  172.     //int sz = o.size();o.insert(o.begin(), sz);
  173.     return o;
  174. }
  175.  
  176. int main() {
  177.     fast;
  178.     int a = 100, b = 100;
  179.     vec<int> rw[a], cl[b];
  180.     for (int q = 0; q < a; q++) {
  181.         int sz; cin >> sz;
  182.         rw[q] = vec<int>(sz);
  183.         for (int w = 0; w < sz; w++) cin >> rw[q][w];
  184.     }
  185.     for (int q = 0; q < b; q++) {
  186.         int sz; cin >> sz;
  187.         cl[q] = vec<int>(sz);
  188.         for (int w = 0; w < sz; w++) cin >> cl[q][w];
  189.     }
  190.     vec<int> m[a];
  191.     for (int q = 0; q < a; q++) {
  192.         m[q] = vec<int>(b);
  193.         for (int w = 0; w < b; w++) {
  194.             cin >> m[q][w];
  195.         }
  196.     }
  197.     for (int q = 0; q < a; q++) {
  198.         for(int i : rw[q]) cout<<i<<" "; cout<<endl;
  199.         for (int i : fu(m[q])) cout << i << " "; cout<<endl;
  200.         assert(fu(m[q])==rw[q]);
  201.     }
  202.     for (int w = 0; w < b; w++) {
  203.         vec<int> n;
  204.         for(int q=0; q<a; q++){
  205.             n.pb(m[q][w]);
  206.         }
  207.         assert(fu(n)==cl[w]);
  208.         //for (int i : fu(n)) cout << i << " "; cout << "\n";
  209.     }
  210.     cout<<"OK!";
  211. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×