Submission #4026855


Source Code Expand

#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0))
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0))
#define P pair<int,int>
#define Sort(a) sort((a).begin(),(a).end())
#define Reverse(a) reverse((a).begin(),(a).end())
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
using namespace std;
void Debug(auto a);

signed main(){
    int h,w;
    cin >> h >> w;
    Vec(a,h);
    vector<string> b;
    REP(i,h){
        cin >> a[i];
    }
    bool er=false;
    REP(i,h){
        er=false;
        REP(j,w){
            if(a[i][j]=='#'){
                er = true;
            }
        }
        if(er){
            b.push_back(a[i]);
        }
        
    }
    h = b.size();
    Vec(c,h);
    copy(b.begin(),b.end(),c.begin());
    int tmp=0;
    REP(i,w){
        er=true;
        REP(j,h){
            if(b[j][i] == '#'){
                er=false;
            }
        }
        if(er){
            REP(j,h){
                c[j].erase(c[j].begin()+i-tmp);
                
            }
          tmp++;
        }
    }
    for(auto d: c){
        cout << d << endl;
    }
    
    
    return 0;
}
void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

Submission Info

Submission Time
Task B - Grid Compression
User tmcoder
Language Python (3.4.3)
Score 0
Code Size 1592 Byte
Status RE
Exec Time 19 ms
Memory 3060 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
RE × 4
RE × 12
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt
Case Name Status Exec Time Memory
0_00.txt RE 19 ms 3060 KB
0_01.txt RE 18 ms 2940 KB
0_02.txt RE 18 ms 2940 KB
0_03.txt RE 18 ms 2940 KB
1_00.txt RE 18 ms 2940 KB
1_01.txt RE 18 ms 2940 KB
1_02.txt RE 18 ms 2940 KB
1_03.txt RE 18 ms 2940 KB
1_04.txt RE 18 ms 2940 KB
1_05.txt RE 18 ms 2940 KB
1_06.txt RE 18 ms 2940 KB
1_07.txt RE 18 ms 2940 KB