Submission #1655340
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define REP(i, s, n) for (int i = s; i < n; ++i) #define rep(i, n) REP(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) #define IINF INT_MAX #define LLINF LLONG_MAX #define DEBUG true // sort(a.begin(), a.end(), std::greater<int>()); /* std::vector<std::string> split(const std::string &input, char delimiter) { std::istringstream stream(input); std::string field; std::vector<std::string> result; while (std::getline(stream, field, delimiter)) { result.push_back(field); } return result; } */ int main() { int n; cin >> n; vector<pair<int, int>> a(n); rep(i, n) { a[i].second = i; cin >> a[i].first; } SORT(a); if (DEBUG) rep(i, n) { cout<< a[i].first <<"\t"<< a[i].second << endl; } int ans = 1; int temp = a[0].second; REP(i, 1, n) { if (a[i].second < temp) { ans++; } temp = a[i].second; } if (a[n - 1].second == 0) ans--; cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - ディスコ社内ツアー |
User | ToM_ynu |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1174 Byte |
Status | WA |
Exec Time | 200 ms |
Memory | 2176 KB |
Judge Result
Set Name | Sample | Small | Permutation | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 20 | 0 / 10 | 0 / 70 | ||||||||
Status |
|
|
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt |
Small | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 10_rand_06.txt, 10_rand_07.txt, 10_rand_08.txt, 20_perm_01.txt, 20_perm_02.txt, 20_perm_03.txt, 20_perm_04.txt, 20_perm_05.txt, 20_perm_06.txt, 20_perm_07.txt, 20_perm_08.txt, 30_hand_01.txt, 30_hand_02.txt, 30_hand_03.txt, 30_hand_04.txt, 30_hand_05.txt, 30_hand_06.txt |
Permutation | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 20_perm_01.txt, 20_perm_02.txt, 20_perm_03.txt, 20_perm_04.txt, 20_perm_05.txt, 20_perm_06.txt, 20_perm_07.txt, 20_perm_08.txt, 30_hand_01.txt, 30_hand_02.txt, 60_perm_01.txt, 60_perm_02.txt, 60_perm_03.txt, 60_perm_04.txt, 60_perm_05.txt, 60_perm_06.txt, 60_perm_07.txt, 60_perm_08.txt, 70_hand_01.txt, 70_hand_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 10_rand_06.txt, 10_rand_07.txt, 10_rand_08.txt, 20_perm_01.txt, 20_perm_02.txt, 20_perm_03.txt, 20_perm_04.txt, 20_perm_05.txt, 20_perm_06.txt, 20_perm_07.txt, 20_perm_08.txt, 30_hand_01.txt, 30_hand_02.txt, 30_hand_03.txt, 30_hand_04.txt, 30_hand_05.txt, 30_hand_06.txt, 50_rand_01.txt, 50_rand_02.txt, 50_rand_03.txt, 50_rand_04.txt, 50_rand_05.txt, 50_rand_06.txt, 50_rand_07.txt, 50_rand_08.txt, 60_perm_01.txt, 60_perm_02.txt, 60_perm_03.txt, 60_perm_04.txt, 60_perm_05.txt, 60_perm_06.txt, 60_perm_07.txt, 60_perm_08.txt, 70_hand_01.txt, 70_hand_02.txt, 70_hand_03.txt, 70_hand_04.txt, 70_hand_05.txt, 70_hand_06.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | WA | 1 ms | 256 KB |
00_example_02.txt | WA | 1 ms | 256 KB |
00_example_03.txt | WA | 1 ms | 256 KB |
00_example_04.txt | WA | 1 ms | 256 KB |
10_rand_01.txt | WA | 1 ms | 256 KB |
10_rand_02.txt | WA | 1 ms | 256 KB |
10_rand_03.txt | WA | 1 ms | 256 KB |
10_rand_04.txt | WA | 1 ms | 256 KB |
10_rand_05.txt | WA | 1 ms | 256 KB |
10_rand_06.txt | WA | 1 ms | 256 KB |
10_rand_07.txt | WA | 1 ms | 256 KB |
10_rand_08.txt | WA | 1 ms | 256 KB |
20_perm_01.txt | WA | 1 ms | 256 KB |
20_perm_02.txt | WA | 1 ms | 256 KB |
20_perm_03.txt | WA | 1 ms | 256 KB |
20_perm_04.txt | WA | 1 ms | 256 KB |
20_perm_05.txt | WA | 1 ms | 256 KB |
20_perm_06.txt | WA | 1 ms | 256 KB |
20_perm_07.txt | WA | 1 ms | 256 KB |
20_perm_08.txt | WA | 1 ms | 256 KB |
30_hand_01.txt | WA | 1 ms | 256 KB |
30_hand_02.txt | WA | 1 ms | 256 KB |
30_hand_03.txt | WA | 1 ms | 256 KB |
30_hand_04.txt | WA | 1 ms | 256 KB |
30_hand_05.txt | WA | 1 ms | 256 KB |
30_hand_06.txt | WA | 1 ms | 256 KB |
50_rand_01.txt | WA | 68 ms | 896 KB |
50_rand_02.txt | WA | 133 ms | 1408 KB |
50_rand_03.txt | WA | 132 ms | 1408 KB |
50_rand_04.txt | WA | 104 ms | 1152 KB |
50_rand_05.txt | WA | 43 ms | 640 KB |
50_rand_06.txt | WA | 2 ms | 256 KB |
50_rand_07.txt | WA | 22 ms | 384 KB |
50_rand_08.txt | WA | 107 ms | 1152 KB |
60_perm_01.txt | WA | 71 ms | 896 KB |
60_perm_02.txt | WA | 136 ms | 1536 KB |
60_perm_03.txt | WA | 139 ms | 1536 KB |
60_perm_04.txt | WA | 109 ms | 1280 KB |
60_perm_05.txt | WA | 43 ms | 640 KB |
60_perm_06.txt | WA | 2 ms | 256 KB |
60_perm_07.txt | WA | 22 ms | 384 KB |
60_perm_08.txt | WA | 113 ms | 1280 KB |
70_hand_01.txt | WA | 191 ms | 2176 KB |
70_hand_02.txt | WA | 196 ms | 2176 KB |
70_hand_03.txt | WA | 190 ms | 2048 KB |
70_hand_04.txt | WA | 189 ms | 2048 KB |
70_hand_05.txt | WA | 200 ms | 2176 KB |
70_hand_06.txt | WA | 199 ms | 1920 KB |