# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
518711 |
2022-01-24T13:08:59 Z |
inksamurai |
Sajam (COCI18_sajam) |
C++17 |
|
5000 ms |
460 KB |
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define crep(i,x,n) for(int i=x;i<n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define vec(...) vector<__VA_ARGS__>
#define _343tk3a ios::sync_with_stdio(0),cin.tie(0)
using namespace std;
void print(){cout<<"\n";}
template<class te,class ...ti>
void print(const te&v,const ti&...nv){cout<<v;if(sizeof...(nv)){cout<<" ";print(nv...);}}
typedef long long ll;
using pii=pair<int,int>;
using vi=vector<int>;
//e
int main(){
_343tk3a;
int n,k;
cin>>n>>k;
int h,w;
h=n,w=n;
vec(bitset<1000>) a(h);
rep(i,h){
string s;
cin>>s;
rep(j,w){
a[i][j]=(s[j]=='x');
}
}
bitset<1000> _ie;
rep(i,n) _ie[i]=1;
auto af=[&](bitset<1000> _a){
int res=0;
rep(i,h){
res+=min((a[i]^_a).count(),(_ie^a[i]^_a).count());
}
return res;
};
int res=n+1;
rep(i,h){
res=min(res,af(a[i]));
}
rep(i,h){
rep(j,w){
a[i][j]=1-a[i][j];
af(a[i]);
a[i][j]=1-a[i][j];
}
}
print((res<=k?"DA":"NE"),"\n");
//
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
5055 ms |
332 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
204 KB |
Output is correct |
2 |
Correct |
35 ms |
296 KB |
Output is correct |
3 |
Incorrect |
79 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5059 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5062 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5085 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5057 ms |
460 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |