Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define all(x) begin(x),end(x)
- using namespace std;
- using ll = long long;
- using ld = long double;
- vector<int> parseString(string s) {
- vector<int> res;
- int pre = 0;
- for (int i = 0; i < int(s.size()); i++) {
- if (s[i] == ' ') {
- res.push_back(stoi(s.substr(pre, i - pre)));
- pre = i + 1;
- }
- }
- if (!s.empty()) {
- res.push_back(stoi(s.substr(pre, int(s.size()) - pre)));
- }
- return res;
- }
- void solve() {
- string s;
- getline(cin, s);
- int n, m;
- {
- auto v = parseString(s);
- n = v[0];
- m = v[1];
- }
- vector<int> c(m);
- for (int i = 0; i < m; i++) {
- getline(cin, s);
- auto v = parseString(s);
- c[i] = v[0];
- }
- vector<vector<int>> arr(n), brr(m);
- for (int i = 0; i < n; i++) {
- getline(cin, s);
- arr[i] = parseString(s);
- }
- for (int i = 0; i < m; i++) {
- getline(cin, s);
- brr[i] = parseString(s);
- }
- cout << n << ' ' << m << '\n';
- for (auto val: c) cout << val << ' ';
- cout << '\n';
- for (auto v: arr) {
- for (auto val: v) cout << val << ' ';
- cout << '\n';
- }
- cout << '\n';
- for (auto v: brr) {
- for (auto val: v) cout << val << ' ';
- cout << '\n';
- }
- }
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int t = 1;
- while (t--) {
- solve();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement