CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 23:16:23 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=3603616b1a374175228f24330cb47b7b22157d6b116a61239aaa556615beb9c7a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22-JQaFQhwV5dQ5r9E8uokThhQhq44KAv9%22%3B%7D; HttpOnly; Path=/
cf-ray: 98da4df9c9b4dfa6-BLR
#include <iostream>#include <vector>#include <algorithm>struct Date{ - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- struct Date{
- int day;
- int month;
- int year;
- int index;
- bool operator<(const Date& d) const {
- if(year < d.year) return true;
- else if( year > d.year) return false;
- else{
- if(month < d.month) return true;
- else if(month > d.month) return false;
- else{
- if(day < d.day) return true;
- return false;
- }
- }
- }
- Date(){
- }
- Date(int d, int m, int y, int i): day(d), month(m), year(y), index(i) {
- }
- };
- void gnomeSort(Date arr[], int n) {
- int index = 0;
- while (index < n) {
- if (index == 0)
- index++;
- if (arr[index] < arr[index - 1]) {
- std::swap(arr[index], arr[index - 1]);
- index--;
- } else {
- index++;
- }
- }
- return;
- }
- // std::vector<Date> dates;
- int main() {
- Date dates[100] = {};
- int n;
- scanf("%d", &n);
- for(int i = 0; i < n; ++i){
- int d, m, y;
- scanf("%d.%d.%d", &d, &m, &y);
- dates[i] = Date(d, m, y, i + 1);
- }
- // std::sort(dates, dates + n, [](const Date& a, const Date& b){
- // if(a < b){
- // return true;
- // }
- // return false;
- // });
- gnomeSort(dates, n);
- for(int i = 0; i < n; ++i){
- printf("%d\n", dates[i].index);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
π Swapzone +37% glitch β J
JavaScript | 7 sec ago | 0.25 KB
-
β
β Make huge profits on trading ββ 5
JavaScript | 32 sec ago | 0.25 KB
-
β
Marketplace Glitch β
Working NEVER SEEN BE...
JavaScript | 41 sec ago | 0.25 KB
-
ββ
Exploit 2500$ in 15 Minutesβββ B
JavaScript | 50 sec ago | 0.25 KB
-
π EASY MONEY GUIDE β
Working I
JavaScript | 58 sec ago | 0.25 KB
-
π Instant BTC Profit Method β
Working O
JavaScript | 1 min ago | 0.25 KB
-
β
Make $2500 in 20 minutesβ F
JavaScript | 1 min ago | 0.25 KB
-
π Swapzone +37% glitch β J
JavaScript | 1 min ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand