# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
97487 | 2019-02-16T11:49:28 Z | KLPP | Sajam (COCI18_sajam) | C++14 | 1470 ms | 4188 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)='x'+'o'-table[i].at(0); //cout<<table2[i]<<endl; } 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]); if(can>k)j=n; } for(int j=0;j<n;j++){ can2+=diff(table2[i],table[j]); if(can2>k)j=n; } ans=min(ans,min(can,can2)); if(ans<=k){ cout<<"DA"<<endl; return 0; } } cout<<"NE"<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 10 ms | 768 KB | Output is correct |
3 | Correct | 9 ms | 1380 KB | Output is correct |
4 | Correct | 48 ms | 2040 KB | Output is correct |
5 | Correct | 20 ms | 1408 KB | Output is correct |
6 | Correct | 8 ms | 640 KB | Output is correct |
7 | Correct | 17 ms | 1408 KB | Output is correct |
8 | Correct | 59 ms | 2168 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 44 ms | 2168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 356 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 356 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 1784 KB | Output is correct |
2 | Correct | 35 ms | 1912 KB | Output is correct |
3 | Correct | 20 ms | 1664 KB | Output is correct |
4 | Correct | 22 ms | 1536 KB | Output is correct |
5 | Correct | 33 ms | 2168 KB | Output is correct |
6 | Correct | 263 ms | 1412 KB | Output is correct |
7 | Correct | 534 ms | 1784 KB | Output is correct |
8 | Correct | 668 ms | 1912 KB | Output is correct |
9 | Correct | 11 ms | 768 KB | Output is correct |
10 | Correct | 68 ms | 4088 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 2040 KB | Output is correct |
2 | Correct | 30 ms | 2048 KB | Output is correct |
3 | Correct | 19 ms | 1536 KB | Output is correct |
4 | Correct | 21 ms | 1792 KB | Output is correct |
5 | Correct | 36 ms | 1756 KB | Output is correct |
6 | Correct | 1470 ms | 4088 KB | Output is correct |
7 | Correct | 180 ms | 888 KB | Output is correct |
8 | Correct | 667 ms | 1788 KB | Output is correct |
9 | Correct | 27 ms | 1792 KB | Output is correct |
10 | Correct | 73 ms | 4088 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 1528 KB | Output is correct |
2 | Correct | 29 ms | 1656 KB | Output is correct |
3 | Correct | 975 ms | 4088 KB | Output is correct |
4 | Correct | 122 ms | 1408 KB | Output is correct |
5 | Correct | 171 ms | 1688 KB | Output is correct |
6 | Correct | 1382 ms | 4088 KB | Output is correct |
7 | Correct | 242 ms | 1400 KB | Output is correct |
8 | Correct | 289 ms | 1408 KB | Output is correct |
9 | Correct | 26 ms | 1408 KB | Output is correct |
10 | Correct | 25 ms | 1408 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 59 ms | 4188 KB | Output is correct |
2 | Correct | 61 ms | 4104 KB | Output is correct |
3 | Correct | 167 ms | 2252 KB | Output is correct |
4 | Correct | 396 ms | 1904 KB | Output is correct |
5 | Correct | 476 ms | 1912 KB | Output is correct |
6 | Correct | 615 ms | 1784 KB | Output is correct |
7 | Correct | 238 ms | 1504 KB | Output is correct |
8 | Correct | 1004 ms | 2156 KB | Output is correct |
9 | Correct | 37 ms | 1656 KB | Output is correct |
10 | Correct | 80 ms | 2244 KB | Output is correct |