fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 1200;
  5. const int MAX_VALUE = 100000;
  6.  
  7. int main() {
  8. int sentDataSize, missingDataSize, sentData[MAX_SIZE], recievedData[MAX_SIZE];
  9. cin >> sentDataSize >> missingDataSize;
  10. for (int i = 0; i < sentDataSize; ++i) {
  11. cin >> sentData[i];
  12. }
  13. for (int i = 0; i < sentDataSize - missingDataSize; ++i) {
  14. cin >> recievedData[i];
  15. }
  16. int succeed = 1;
  17. for (int i = 0; i < sentDataSize; ++i) {
  18. int sent = 0;
  19. for (int j = 0; j < sentDataSize - missingDataSize; ++j) {
  20. if (sentData[i] == recievedData[j]) {
  21. sent = 1;
  22. recievedData[j] = MAX_VALUE + 1;
  23. j = sentDataSize;
  24. }
  25. }
  26. if (!sent) {
  27. cout << sentData[i] << " ";
  28. succeed = 0;
  29. }
  30. }
  31. if (succeed) {
  32. cout << "Nu s-au pierdut date";
  33. }
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5280KB
stdin
10
32 34 89 -67 45 21 34 5 9 7
34 32 45 89 34 21 5 7 9
stdout
34 89 -67 45 21 34 5 9 7 34