# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
120942 | kimbj0709 | Ispit (COCI19_ispit) | C++17 | 35 ms | 1144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
bool find(vector<char> vect1,vector<char> vect2){
for(int i=0;i<vect1.size();i++){
if(vect1[i]!=vect2[i]){
return 0;
}
}
return 1;
//1 is same 0 is different
}
int find2(vector<char> vect1,vector<char> vect2){
int startpos = INT_MAX;
int endpos = INT_MAX;
for(int i=0;i<vect1.size();i++){
if(vect1[i]!=vect2[i]){
startpos = i;
break;
}
}
for(int i=vect1.size()-1;i>=0;i--){
if(vect1[i]!=vect2[i]){
endpos = i;
break;
}
}
if(startpos==INT_MAX){
return 0;
}
else{
return endpos-startpos+1;
}
}
int main() {
char input;
int width,height;
int contig;
//vect1 is unsorted
//vect2 is sorted
vector<vector<char> > vect1(501);
vector<vector<char> > vect2(501);
cin >> width >> contig;
for(int i=0;i<width;i++){
for(int j=0;j<width;j++){
cin >> input;
vect1[i].push_back(input);
}
vect2[i] = vect1[i];
sort(vect2[i].begin(),vect2[i].end());
}
for(int i=0;i<width;i++){
for(int j=i+1;j<width;j++){
if(find(vect1[i],vect2[j])==0){
continue;
}
else{
int k = find2(vect1[i],vect2[j]);
if(k<=contig){
cout << "DA";
return 0;
}
}
}
}
cout << "NE";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |