You are viewing a single comment's thread. Return to all comments →
C++ Solution
int main() { vector<int> outputs; int temp; bool output_yes = true; cin >> temp; while(cin >> temp)outputs.push_back(temp); for(int i = 0; i < outputs.size()/2; i++){ if(outputs[outputs[i] - 1] != i+1){ output_yes = false; break; } } cout << (output_yes? "YES\n":"NO\n"); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Security Involution
You are viewing a single comment's thread. Return to all comments →
C++ Solution