SOLVE

LATER

Little Shino And Swaps

Problem

Editorial

Analytics

Teachers of ByteSchool created a table of score of students in two exams. Since the data is manually created, the teachers of the school have accidentally swapped the marks of some students. Swapping means score of exam 1 is written in score of exam 2 and vice versa. Teachers don't want to correct it manually again so they ask for your help.

You are given two tables.

**Marks:** Contains the student ids and scores of students in two exams.

**Students:** Contains the student ids whose entries are swapped ( all the student ids are unique ).

Using these two tables you have to correct the entries of Marks.

The output table should be in increasing order of StudentId.

Table : **Marks**

Field | Type |
---|---|

StudentId | integer |

Score1 | integer |

Score2 | integer |

Table : **Students**

Field | Type |
---|---|

StudentId | integer |

Field | Type |
---|---|

StudentId | integer |

Score1 | integer |

Score2 | integer |

**Sample Marks Table:**

StudentId | Score1 | Score2 |
---|---|---|

1 | 99 | 76 |

2 | 88 | 27 |

3 | 31 | 58 |

4 | 24 | 45 |

5 | 64 | 57 |

**Sample Students Table:**

StudentId |
---|

1 |

2 |

StudentId | Score1 | Score2 |
---|---|---|

1 | 76 | 99 |

2 | 27 | 88 |

3 | 31 | 58 |

4 | 24 | 45 |

5 | 64 | 57 |

Time Limit:
5 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
MySQL,
PostgreSQL,
MSSQL,
Oracle_Db

Initializing Code Editor...

{"1673468": "/pagelets/problem-author-tester/sql/little-shino-and-swaps/", "b25175a": "/pagelets/recommended-problems/sql/little-shino-and-swaps/", "313d156": "/pagelets/show-submission/sql/little-shino-and-swaps/", "38579ac": "/pagelets/suggested-problems/sql/little-shino-and-swaps/", "1ccfe4f": "/pagelets/problems-hint/sql/little-shino-and-swaps/"}

realtime.hackerearth.com

80

d3fcaabb4ab8d20f5f0c7522209288176da06a80

58a29e5cae2309f04b28

/realtime/pusher/auth/