Task: | ModAdd |
Sender: | natalia |
Submission time: | 2018-09-22 15:09:43 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.02 s | details |
#2 | WRONG ANSWER | 0.13 s | details |
#3 | RUNTIME ERROR | 0.06 s | details |
#4 | WRONG ANSWER | 0.06 s | details |
#5 | WRONG ANSWER | 0.07 s | details |
#6 | WRONG ANSWER | 0.05 s | details |
#7 | RUNTIME ERROR | 0.07 s | details |
#8 | RUNTIME ERROR | 0.06 s | details |
#9 | WRONG ANSWER | 0.05 s | details |
#10 | RUNTIME ERROR | 0.02 s | details |
Code
#include <iostream> #include <string> inline int min(int x, int y){ return y ^ ((x ^ y) & -(x < y)); } int main(int argc, const char * argv[]) { std::string word1, word2; std::cin >> word1; std::cin >> word2; //std::getline(std::cin, word1); //std::getline(std::cin, word2); int cols = word1.length(); int rows = word2.length(); int* data = (int*)malloc((rows + 1) * (cols + 1) * sizeof(int)); data[0] = 0; for(int i = 1; i <= cols; i++) data[i] = i; for(int i = 1; i <= rows; i++) data[i * (cols + 1)] = i; for(int i = 1; i <= rows; i++){ for(int j = 1; j <= cols; j++){ int own = word1[j - 1] != word2[i - 1]; int other = min(data[(i - 1) * (cols + 1) + j - 1], min(data[(i - 1) * (cols + 1) + j], data[i * (cols + 1) + j - 1])); data[i * (cols + 1) + j] = own + other; } } std::cout << data[rows * (cols + 1) + cols] << "\n"; return 0; } /* std::ios::sync_with_stdio(); char* word1 = (char*)malloc(5000 * sizeof(char)); char* word2 = (char*)malloc(5000 * sizeof(char)); std::cin.getline (word1, 5000); std::cout << word1 << "\n"; free(word1); free(word2); return 0; */ /* for(int i = 0; i <= rows; i++){ for(int j = 0; j <= cols; j++){ std::cout << data[i * (cols + 1) + j] << "\t"; } std::cout << "\n"; } std::cout << "\n"; */ /* for(int i = 0; i <= rows; i++){ for(int j = 0; j <= cols; j++){ std::cout << data[i * (cols + 1) + j] << "\t"; } std::cout << "\n"; } std::cout << "\n"; */
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
3797629225 9766508989 |
correct output |
---|
2453127104 |
user output |
---|
8 |
Test 2
Verdict: WRONG ANSWER
input |
---|
552139016901047883384892240490... |
correct output |
---|
552139016901047883384892240490... |
user output |
---|
898534 |
Test 3
Verdict: RUNTIME ERROR
input |
---|
860793811134668093345482099582... |
correct output |
---|
487710306894083216377653715430... |
user output |
---|
(empty) |
Test 4
Verdict: WRONG ANSWER
input |
---|
2 870841652294197226626825161089... |
correct output |
---|
870841652294197226626825161089... |
user output |
---|
899917 |
Test 5
Verdict: WRONG ANSWER
input |
---|
0 404905566051213252279994991040... |
correct output |
---|
404905566051213252279994991040... |
user output |
---|
899951 |
Test 6
Verdict: WRONG ANSWER
input |
---|
430112167406460960088878635088... |
correct output |
---|
430112167406460960088878635088... |
user output |
---|
899738 |
Test 7
Verdict: RUNTIME ERROR
input |
---|
867016005819001635643395991596... |
correct output |
---|
999999999999999999999999999999... |
user output |
---|
(empty) |
Test 8
Verdict: RUNTIME ERROR
input |
---|
120453771521975552204976752778... |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 9
Verdict: WRONG ANSWER
input |
---|
239979749009277805816504910098... |
correct output |
---|
239979749009277805816504910098... |
user output |
---|
899845 |
Test 10
Verdict: RUNTIME ERROR
input |
---|
990963963634143754324162574923... |
correct output |
---|
818540385713473048971388312665... |
user output |
---|
(empty) |