Submission #156885
Source Code Expand
#include <iostream> #include <iomanip> // setw #include <algorithm> // sort next_permutation count __gcd reverse etc. #include <set> #include <list> #include <map> #include <memory> #include <numeric> // accumulate #include <functional> #include <utility> #include <iterator> #include <vector> #include <stack> #include <queue> #include <deque> #include <fstream> // freopen #include <cstdio> // scanf printf #include <cstdlib> // abs exit atof atoi #include <string> // memset #include <cstring> #include <cmath> // fabs #include <cctype> // tolower toupper #include <sstream> // stringstream #include <bitset> #define reb(i,b,n) for(int i=(int)(b); i<(int)(n); i++) #define rep(i,n) reb(i,0,n) #define rer(i,n) for(int i=1; i<=n; i++) #define rrep(i,n) for(int i = n-1; i >= 0; i--) #define rreb(i,n,b) for(int i = n; i >= b; i--) #define resz(i,v) rep(i,sz(v)) #define let(v, x) __typeof(x) v = (x) #define each(it,v) for(let(it, (v).begin()); it!=(v).end(); it++) #define reach(it,v) for(let(it, (v).rbegin());i!=(v).rend();i++) #define priArr(table, n) rep(i,n){cout<<table[i]<<' ';}cout<<'\n'; #define priAr2(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';} #define vall(x) (x).begin(), (x).end() #define rvall(x) (x).rbegin(), (x).rend() #define vsort(v) sort(vall(v)) #define rvsort(v) sort(rvall(v)) #define len(array) (sizeof (array) / sizeof *(array)) #define aall(x) x, x+len(x) #define asort(x) sort(aall(x)) #define rasort(a, type) sort(aall(a), greater<type>()) #define afill(a, v) fill(aall(a), v) #define afill2(a, v, type) fill((type *)a, (type *)(a + len(a)), v) #define sz(x) (int)(x).size() #define mp(a, b) make_pair(a, b) #define fi first #define se second #define pb push_back #define _USE_MATH_DEFINES using std::stringstream; using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair <int, int> P; typedef pair <int, P> PP; typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<string> vs; typedef vector<ll> vl; typedef vector<P > vP; typedef vector<char> vc; typedef long double ld; const static int INF = 0x3f3f3f3f; const static ll INFL = 0x3f3f3f3f3f3f3f3fLL; const static double EPS = 1e-9; const static ll MOD = 1000000007LL; inline int toInt(std::string s) {int v; std::istringstream sin(s);sin>>v;return v;} template<class T> inline std::string toString(T x) {std::ostringstream sout;sout<<x;return sout.str();} template<class F, class T> inline void convert(const F &f, T &t){stringstream ss;ss<<f;ss>>t;} template<class T> inline T sqr(T x) {return x*x;} int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1}; /* --------------------------------------------------------------- */ int main(int argc, char *argv[]) { ios::sync_with_stdio(false); cin.tie(0); // off the synchronous of cin and cout int n; cin >> n; vi c; rep(i, n) { int t; cin >> t; c.pb(t); } vi t = c; sort(t.begin(), t.end()); // not stable(stable_sort()) int res=0; rep(i, sz(t)) { if (c[0] == t[i]) { c.erase(c.begin()); } else { c.erase(find(vall(c), t[i])); res++; } } cout << res << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - トランプ挿入ソート |
User | emacs |
Language | C++ (G++ 4.6.4) |
Score | 0 |
Code Size | 3300 Byte |
Status | WA |
Exec Time | 341 ms |
Memory | 1180 KB |
Judge Result
Set Name | smallA | smallB | all | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 10 | 0 / 40 | 0 / 50 | ||||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
smallA | test_01_ABC.txt, test_04_ABC.txt, test_07_ABC.txt, test_10_ABC.txt, test_13_ABC.txt, test_16_ABC.txt, test_19_ABC.txt, test_22_ABC.txt, test_25_ABC.txt, test_28_ABC.txt, test_31_ABC.txt, test_32_ABC.txt, test_35_ABC.txt, test_38_ABC.txt, test_41_ABC.txt, test_44_ABC.txt, test_47_ABC.txt, test_50_ABC.txt, test_53_ABC.txt |
smallB | test_01_ABC.txt, test_02_AB.txt, test_04_ABC.txt, test_05_AB.txt, test_07_ABC.txt, test_08_AB.txt, test_10_ABC.txt, test_11_AB.txt, test_13_ABC.txt, test_14_AB.txt, test_16_ABC.txt, test_17_AB.txt, test_19_ABC.txt, test_20_AB.txt, test_22_ABC.txt, test_23_AB.txt, test_25_ABC.txt, test_26_AB.txt, test_28_ABC.txt, test_29_AB.txt, test_31_ABC.txt, test_32_ABC.txt, test_33_AB.txt, test_35_ABC.txt, test_36_AB.txt, test_38_ABC.txt, test_39_AB.txt, test_41_ABC.txt, test_42_AB.txt, test_44_ABC.txt, test_45_AB.txt, test_47_ABC.txt, test_48_AB.txt, test_50_ABC.txt, test_51_AB.txt, test_53_ABC.txt, test_54_AB.txt |
all | test_01_ABC.txt, test_02_AB.txt, test_03_A.txt, test_04_ABC.txt, test_05_AB.txt, test_06_A.txt, test_07_ABC.txt, test_08_AB.txt, test_09_A.txt, test_10_ABC.txt, test_11_AB.txt, test_12_A.txt, test_13_ABC.txt, test_14_AB.txt, test_15_A.txt, test_16_ABC.txt, test_17_AB.txt, test_18_A.txt, test_19_ABC.txt, test_20_AB.txt, test_21_A.txt, test_22_ABC.txt, test_23_AB.txt, test_24_A.txt, test_25_ABC.txt, test_26_AB.txt, test_27_A.txt, test_28_ABC.txt, test_29_AB.txt, test_30_A.txt, test_31_ABC.txt, test_32_ABC.txt, test_33_AB.txt, test_34_A.txt, test_35_ABC.txt, test_36_AB.txt, test_37_A.txt, test_38_ABC.txt, test_39_AB.txt, test_40_A.txt, test_41_ABC.txt, test_42_AB.txt, test_43_A.txt, test_44_ABC.txt, test_45_AB.txt, test_46_A.txt, test_47_ABC.txt, test_48_AB.txt, test_49_A.txt, test_50_ABC.txt, test_51_AB.txt, test_52_A.txt, test_53_ABC.txt, test_54_AB.txt, test_55_A.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 21 ms | 920 KB |
sample_02.txt | AC | 21 ms | 892 KB |
sample_03.txt | AC | 19 ms | 920 KB |
test_01_ABC.txt | AC | 19 ms | 868 KB |
test_02_AB.txt | WA | 21 ms | 920 KB |
test_03_A.txt | WA | 238 ms | 1172 KB |
test_04_ABC.txt | WA | 21 ms | 920 KB |
test_05_AB.txt | WA | 21 ms | 920 KB |
test_06_A.txt | WA | 23 ms | 916 KB |
test_07_ABC.txt | WA | 21 ms | 920 KB |
test_08_AB.txt | WA | 22 ms | 908 KB |
test_09_A.txt | WA | 239 ms | 1172 KB |
test_10_ABC.txt | WA | 22 ms | 920 KB |
test_11_AB.txt | WA | 22 ms | 860 KB |
test_12_A.txt | WA | 93 ms | 940 KB |
test_13_ABC.txt | WA | 22 ms | 924 KB |
test_14_AB.txt | WA | 21 ms | 924 KB |
test_15_A.txt | WA | 240 ms | 1060 KB |
test_16_ABC.txt | WA | 22 ms | 876 KB |
test_17_AB.txt | WA | 23 ms | 920 KB |
test_18_A.txt | WA | 22 ms | 908 KB |
test_19_ABC.txt | AC | 22 ms | 924 KB |
test_20_AB.txt | WA | 20 ms | 912 KB |
test_21_A.txt | WA | 238 ms | 1060 KB |
test_22_ABC.txt | AC | 21 ms | 920 KB |
test_23_AB.txt | WA | 23 ms | 808 KB |
test_24_A.txt | WA | 156 ms | 936 KB |
test_25_ABC.txt | WA | 21 ms | 924 KB |
test_26_AB.txt | WA | 22 ms | 924 KB |
test_27_A.txt | WA | 238 ms | 1068 KB |
test_28_ABC.txt | WA | 21 ms | 920 KB |
test_29_AB.txt | WA | 22 ms | 920 KB |
test_30_A.txt | WA | 175 ms | 940 KB |
test_31_ABC.txt | AC | 21 ms | 876 KB |
test_32_ABC.txt | AC | 22 ms | 920 KB |
test_33_AB.txt | AC | 22 ms | 924 KB |
test_34_A.txt | AC | 140 ms | 1068 KB |
test_35_ABC.txt | AC | 22 ms | 808 KB |
test_36_AB.txt | AC | 22 ms | 920 KB |
test_37_A.txt | AC | 24 ms | 924 KB |
test_38_ABC.txt | AC | 19 ms | 916 KB |
test_39_AB.txt | AC | 19 ms | 920 KB |
test_40_A.txt | AC | 339 ms | 1068 KB |
test_41_ABC.txt | AC | 22 ms | 924 KB |
test_42_AB.txt | AC | 22 ms | 792 KB |
test_43_A.txt | AC | 25 ms | 920 KB |
test_44_ABC.txt | WA | 21 ms | 920 KB |
test_45_AB.txt | WA | 22 ms | 924 KB |
test_46_A.txt | WA | 141 ms | 1064 KB |
test_47_ABC.txt | AC | 21 ms | 920 KB |
test_48_AB.txt | WA | 21 ms | 920 KB |
test_49_A.txt | WA | 23 ms | 920 KB |
test_50_ABC.txt | WA | 19 ms | 912 KB |
test_51_AB.txt | WA | 20 ms | 916 KB |
test_52_A.txt | WA | 341 ms | 1180 KB |
test_53_ABC.txt | AC | 21 ms | 920 KB |
test_54_AB.txt | AC | 21 ms | 920 KB |
test_55_A.txt | WA | 332 ms | 1068 KB |