Submission #28926143


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

std::vector<std::string> split(const std::string& text, const char delim);

using ll = long long int;
using llu = unsigned long long int;

int main(){
    string buffer;
    getline(cin, buffer);
    auto size_info = split(buffer, ' ');
    const int H = stoi(size_info[0]);
    const int W = stoi(size_info[1]);

    vector<vector<int>> table;
    table.resize(H);

    for(int count = 0; count < H; ++count){
        getline(cin, buffer);
        table[count].reserve(W);
        for(const auto& input_str : split(buffer, ' ')){
            table[count].emplace_back(stoi(input_str));
        }
    }

    for(int j = 0; j < W; ++j){
        for(int i = 0; i < H; ++i){
            cout << table[i][j];
            if(i + 1 < H){
                cout << " ";
            }
        }
        cout << endl;
    }

    return 0;
}

std::vector<std::string> split(const std::string& text, char delim) {
    std::vector<std::string> elems;
    std::stringstream ss(text);
    std::string item;
    while (std::getline(ss, item, delim)) {
    if (!item.empty()) {
            elems.emplace_back(item);
        }
    }
    return elems;
}

Submission Info

Submission Time
Task B - Matrix Transposition
User low10603
Language C++ (GCC 9.2.1)
Score 200
Code Size 1231 Byte
Status AC
Exec Time 185 ms
Memory 10456 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 185 ms 10456 KiB
001.txt AC 4 ms 3600 KiB
002.txt AC 178 ms 10228 KiB
003.txt AC 45 ms 3748 KiB
004.txt AC 43 ms 4012 KiB
005.txt AC 39 ms 3840 KiB
006.txt AC 41 ms 4012 KiB
007.txt AC 84 ms 8724 KiB
example0.txt AC 7 ms 3416 KiB
example1.txt AC 2 ms 3516 KiB