Why overthinking bad statements ?

Revision en1, by Frenzy_Love, 2024-08-31 14:29:27

1408A Circle Coloring

This exercise went accepted with the following code:

include

include

using namespace std;

define pb push_back

int main() { int query; cin >> query; while(query--){ int n; cin >> n;

vector<int> a(n), b(n), c(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++) cin >> c[i];

    vector<int> v(n); 


    v[0] = a[0];


    for(int i = 1; i < n; i++) {
        if(a[i] != v[i-1] && (i != n-1 || a[i] != v[0])) v[i] = a[i];
        else if(b[i] != v[i-1] && (i != n-1 || b[i] != v[0])) v[i] = b[i];
        else v[i] = c[i];
    }


    for(int i = 0; i < n; i++) {
        cout << v[i] << " ";
    }
    cout << endl;
}

return 0;

} BUT !!! it can be hacked with any test case where choosing a different from previous integer which will match a equality of elements in the next iteration, for example: a[5] = {2, 2, 3, 4, 5}; b[5] = {3, 2, 8, 5, 5}; c[5] = {9, 2, 4, 7, 5};

Then, why an exercise would be "Accepted" with poor code when the statement itself induce to a more complex written code ??? // If it is done on purpose for the competitive participants to break into "hacking" one another still doesn't make sense for the actual solo writer, it's disappointing to face "higher" work passed onto as if the exercise wasn't actually been thought thoroughly, that implies a low standard acceptance on exercise making.

Tags *800

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Frenzy_Love 2024-08-31 14:29:27 1686 Initial revision (published)