# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
97467 | 2019-02-16T11:06:46 Z | KLPP | Sajam (COCI18_sajam) | C++14 | 5000 ms | 4216 KB |
#include<bits/stdc++.h> using namespace std; typedef long long int lld; int diff(string a, string b){ int ans1=0; int ans2=0; for(int i=0;i<a.size();i++){ if(a.at(i)!=b.at(i))ans1++; else ans2++; } return min(ans1,ans2); } int main(){ int n,k; cin>>n>>k; string table[n]; string table2[n]; int arr[n][n]; for(int i=0;i<n;i++){ cin>>table[i]; for(int j=0;j<n;j++)table2[i]+=table[i].at(j); table2[i].at(0)='0'+'1'-table[i].at(0); } int ans=1000000000; for(int i=0;i<n;i++){ int can=0; int can2=0; for(int j=0;j<n;j++){ can+=diff(table[i],table[j]); can2+=diff(table2[i],table[j]); } ans=min(ans,min(can,can2)); } if(ans<=k)cout<<"DA"<<endl; else cout<<"NE"<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 264 ms | 788 KB | Output is correct |
3 | Correct | 531 ms | 1372 KB | Output is correct |
4 | Correct | 2177 ms | 2168 KB | Output is correct |
5 | Correct | 542 ms | 1376 KB | Output is correct |
6 | Correct | 110 ms | 732 KB | Output is correct |
7 | Correct | 1377 ms | 1400 KB | Output is correct |
8 | Execution timed out | 5058 ms | 2168 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Incorrect | 6 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1150 ms | 1844 KB | Output is correct |
2 | Correct | 1822 ms | 2044 KB | Output is correct |
3 | Correct | 1119 ms | 1784 KB | Output is correct |
4 | Correct | 847 ms | 1528 KB | Output is correct |
5 | Correct | 2134 ms | 2168 KB | Output is correct |
6 | Correct | 508 ms | 1408 KB | Output is correct |
7 | Correct | 1197 ms | 1820 KB | Output is correct |
8 | Correct | 1269 ms | 1880 KB | Output is correct |
9 | Correct | 816 ms | 768 KB | Output is correct |
10 | Execution timed out | 5014 ms | 4088 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2033 ms | 2068 KB | Output is correct |
2 | Correct | 1867 ms | 2036 KB | Output is correct |
3 | Correct | 795 ms | 1784 KB | Output is correct |
4 | Correct | 1197 ms | 1912 KB | Output is correct |
5 | Correct | 1157 ms | 1912 KB | Output is correct |
6 | Correct | 2160 ms | 4088 KB | Output is correct |
7 | Correct | 265 ms | 768 KB | Output is correct |
8 | Correct | 1096 ms | 1656 KB | Output is correct |
9 | Execution timed out | 5026 ms | 1792 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 796 ms | 1664 KB | Output is correct |
2 | Correct | 816 ms | 1784 KB | Output is correct |
3 | Incorrect | 2864 ms | 4088 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2975 ms | 4192 KB | Output is correct |
2 | Correct | 2990 ms | 4216 KB | Output is correct |
3 | Incorrect | 2150 ms | 2168 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |