Submission #1131290
Source Code Expand
#include <vector> #include <iostream> #include <string> #include <map> #include <algorithm> #include <set> #include <queue> #include <cstdio> #include <utility> #include <bitset> #include <complex> #include <stack> #include <tuple> using namespace std; typedef long long ll; typedef pair<int,int> P; typedef tuple<ll,ll,ll> T; const ll INF = 1e7; int main(){ int N; cin >> N; vector<string> area(N); for(int i=0;i<N;i++) cin >> area[i]; vector<int> not; for(int x=0;x<N;x++){ bool flag=false; for(int y=0;y<N;y++){ if(area[y][x]=='.') flag=true; } if(flag) not.push_back(x); } ll ans=INF; for(int base=0;base<N;base++){ int cost=INF; bool flag=true; for(int x=0;x<N;x++) if(area[base][x]=='.') flag=false; if(flag) cost=0; else{ bool exist=false; for(int y=0;y<N;y++){ if(area[y][base]=='#') exist=true; } if(exist){ cost=0; for(int x=0;x<N;x++) if(area[base][x]=='.') cost++; } } ans=min(ans,(ll)cost+not.size()); } if(ans==INF) cout << -1 << endl; else cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Row to Column |
User | base64 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1158 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:26:14: error: expected unqualified-id before ‘not’ token vector<int> not; ^ ./Main.cpp:34:7: error: expected primary-expression before ‘.’ token not.push_back(x); ^ ./Main.cpp:58:27: error: expected primary-expression before ‘.’ token ans=min(ans,(ll)cost+not.size()); ^