Submission #33868


Source Code Expand

Copy
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <bitset>
#include <queue>
using namespace std;

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

//constant
const double EPS = 1e-10;
const int MAXI = 1234567890;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



void printList(vector<int>& v) {
  for (size_t i = 0; i < v.size(); i++) {
	cout << v[i] << " ";
  }
  cout << endl;
}

void printMatrix(vector< vector<int> >& v) {
  for (size_t i = 0; i < v.size(); i++) {
	printList(v[i]);
  }
  cout << endl;
}

void ins(int w, VI& dp) {
  bool insed = false;

  for (int i = 0; i < SZ(dp); i++) {
    if (w < dp[i]) continue;
    dp[i] = w;
    insed = true;
  }

  if (insed) return;
  dp.PB(w);
}


int solve(const VI& ws) {
  VI dp;
  for (int i = 0; i < SZ(ws); i++) {
    sort(ALL(dp), std::greater<int>());
    ins(ws[i], dp);
  }
  return SZ(dp);
}

int main() {
  int N;
  cin >> N;
  VI ws(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> ws[i];
  }
  reverse(ALL(ws));
  cout << solve(ws) << endl;
  return 0;
}

Submission Info

Submission Time
Task C - 積み重ね
User ganatcs
Language C++ (G++ 4.6.4)
Score 0
Code Size 2056 Byte
Status WA
Exec Time 22 ms
Memory 820 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 14
WA × 30
Set Name Test Cases
All 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 02_maxrnd_00.txt, 02_maxrnd_01.txt, 02_maxrnd_02.txt, 02_maxrnd_03.txt, 02_maxrnd_04.txt, 02_maxrnd_05.txt, 02_maxrnd_06.txt, 02_maxrnd_07.txt, 02_maxrnd_08.txt, 02_maxrnd_09.txt, 02_maxrnd_10.txt, 02_maxrnd_11.txt, 02_maxrnd_12.txt, 02_maxrnd_13.txt, 02_maxrnd_14.txt, 02_maxrnd_15.txt, 02_maxrnd_16.txt, 02_maxrnd_17.txt, 02_maxrnd_18.txt, 02_maxrnd_19.txt, 03_increase_00.txt, 03_increase_01.txt, 03_increase_02.txt, 04_decrease_00.txt, 04_decrease_01.txt, 04_decrease_02.txt, 05_same_00.txt, 05_same_01.txt
Case Name Status Exec Time Memory
00_min.txt AC 21 ms 788 KB
00_sample_01.txt AC 21 ms 796 KB
00_sample_02.txt AC 22 ms 764 KB
00_sample_03.txt AC 22 ms 760 KB
00_sample_04.txt AC 21 ms 788 KB
00_sample_05.txt WA 20 ms 752 KB
01_rnd_00.txt WA 21 ms 820 KB
01_rnd_01.txt WA 21 ms 820 KB
01_rnd_02.txt WA 21 ms 784 KB
01_rnd_03.txt WA 21 ms 796 KB
01_rnd_04.txt WA 21 ms 788 KB
01_rnd_05.txt WA 21 ms 788 KB
01_rnd_06.txt AC 21 ms 740 KB
01_rnd_07.txt WA 21 ms 768 KB
01_rnd_08.txt WA 21 ms 784 KB
01_rnd_09.txt WA 21 ms 812 KB
02_maxrnd_00.txt WA 22 ms 788 KB
02_maxrnd_01.txt WA 21 ms 788 KB
02_maxrnd_02.txt WA 20 ms 792 KB
02_maxrnd_03.txt WA 20 ms 792 KB
02_maxrnd_04.txt WA 21 ms 784 KB
02_maxrnd_05.txt WA 22 ms 776 KB
02_maxrnd_06.txt WA 21 ms 784 KB
02_maxrnd_07.txt WA 20 ms 788 KB
02_maxrnd_08.txt WA 21 ms 820 KB
02_maxrnd_09.txt WA 22 ms 784 KB
02_maxrnd_10.txt WA 22 ms 796 KB
02_maxrnd_11.txt WA 20 ms 780 KB
02_maxrnd_12.txt WA 20 ms 792 KB
02_maxrnd_13.txt WA 20 ms 788 KB
02_maxrnd_14.txt WA 22 ms 796 KB
02_maxrnd_15.txt WA 21 ms 792 KB
02_maxrnd_16.txt WA 21 ms 784 KB
02_maxrnd_17.txt WA 21 ms 792 KB
02_maxrnd_18.txt WA 21 ms 784 KB
02_maxrnd_19.txt WA 20 ms 792 KB
03_increase_00.txt AC 20 ms 788 KB
03_increase_01.txt AC 21 ms 792 KB
03_increase_02.txt AC 22 ms 756 KB
04_decrease_00.txt AC 21 ms 764 KB
04_decrease_01.txt AC 21 ms 788 KB
04_decrease_02.txt AC 22 ms 764 KB
05_same_00.txt AC 21 ms 816 KB
05_same_01.txt AC 21 ms 820 KB