Блог пользователя trunghieu11

Автор trunghieu11, 12 лет назад, По-английски

In problem http://codeforces.me/contest/296/problem/C I try to create a test for hacking, but I get error "Invalid input". I don't know why my code get this error. Please help me, here's my code:

int main() {
    cout << "100000 100000 100000\n";
    for (int i = 0; i < 100000; i++) {
        if (i)
            cout << " ";
        cout << "100000";
    }
    cout << "\n";
    for (int i = 0; i < 100000; i++) {
        if (i)
            cout << "\n";
        cout << "1 100000 100000";
    }
    cout << "\n";
    for (int i = 0; i < 100000; i++) {
        if (i)
            cout << "\n";
        cout << "1 100000";
    }
    cout << "\n";
}
  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

»
12 лет назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

It's because you have a " " at end of your 2nd line & you have some additional Enters at end of your 2nd and 3nd for! I guess this code is working correctly:

int main() {
    cout << "100000 100000 100000\n";
    for (int i = 0; i < 100000; i++) {
        if (i && i-99999)
            cout << " ";
        cout << "100000";
    }
    cout << "\n";
    for (int i = 0; i < 100000; i++) {
        if (i && i-99999)
            cout << "\n";
        cout << "1 100000 100000";
    }
    cout << "\n";
    for (int i = 0; i < 100000; i++) {
        if (i && i-99999)
            cout << "\n";
        cout << "1 100000";
    }
    cout << "\n";
}

& it's my code for this hacking :


long long asli = 100000; int main() { cout << asli <<" " << asli << " " << asli << endl; cout << 1; for(int i=1;i<asli;i++) cout << " " << 1; cout << endl; for(int i=0;i<asli;i++) cout << 1 << " " << asli << " " << 5 << endl; for(int i=0;i<asli;i++) cout << 1 << " " << asli << endl; }

Sorry for my terrible English!

»
12 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can you please get validator comment? It's text in box, which opens if click "Invalid test" link on your hack.