結果

問題 No.322 Geometry Dash
ユーザー antaanta
提出日時 2015-12-15 00:06:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 2,269 bytes
コンパイル時間 759 ms
コンパイル使用メモリ 90,688 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 22:44:08
合計ジャッジ時間 4,792 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 29 ms
6,940 KB
testcase_05 AC 35 ms
6,940 KB
testcase_06 AC 38 ms
6,944 KB
testcase_07 AC 40 ms
6,944 KB
testcase_08 AC 39 ms
6,940 KB
testcase_09 AC 34 ms
6,940 KB
testcase_10 AC 37 ms
6,940 KB
testcase_11 AC 37 ms
6,944 KB
testcase_12 AC 41 ms
6,940 KB
testcase_13 AC 40 ms
6,940 KB
testcase_14 AC 38 ms
6,944 KB
testcase_15 AC 37 ms
6,940 KB
testcase_16 AC 38 ms
6,944 KB
testcase_17 AC 39 ms
6,940 KB
testcase_18 AC 38 ms
6,940 KB
testcase_19 AC 36 ms
6,940 KB
testcase_20 AC 37 ms
6,940 KB
testcase_21 AC 38 ms
6,940 KB
testcase_22 AC 38 ms
6,940 KB
testcase_23 AC 39 ms
6,940 KB
testcase_24 AC 39 ms
6,944 KB
testcase_25 AC 38 ms
6,944 KB
testcase_26 AC 40 ms
6,940 KB
testcase_27 AC 39 ms
6,944 KB
testcase_28 AC 37 ms
6,940 KB
testcase_29 AC 30 ms
6,940 KB
testcase_30 AC 32 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:58:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   58 |                         scanf("%d", &T[i]);
      |                         ~~~~~^~~~~~~~~~~~~
main.cpp:61:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   61 |                         scanf("%d", &D[i]);
      |                         ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

struct Ratio {
	typedef int T;
	T x, y;
	Ratio(): x(0), y(1) { }
	Ratio(T x_): x(x_), y(1) { }
	Ratio(T x_, T y_): x(x_), y(y_) { }
	bool operator==(const Ratio& q) const { return x == q.x && y == q.y; }
	bool operator!=(const Ratio& q) const { return x != q.x || y != q.y; }
	bool operator<(const Ratio& q) const { return x*q.y < y*q.x; }
	bool operator<=(const Ratio& q) const { return x*q.y <= y*q.x; }
	bool operator>(const Ratio& q) const { return x*q.y > y*q.x; }
	bool operator>=(const Ratio& q) const { return x*q.y >= y*q.x; }
};
ostream& operator<<(ostream &o, const Ratio& p) { o << p.x << "/" << p.y; return o; }

int main() {
	int N;
	while(~scanf("%d", &N)) {
		vector<int> T(N);
		for(int i = 0; i < N; ++ i)
			scanf("%d", &T[i]);
		vector<int> D(N);
		for(int i = 0; i < N; ++ i)
			scanf("%d", &D[i]);
		vector<pair<Ratio,int> > v(N);
		rep(i, N)
			v[i] = mp(Ratio(T[i], D[i]), -i);
		sort(all(v));
		vi ans(N);
		rep(i, N)
			ans[i] = -v[N - 1 - i].second;
		for(int i = 0; i < N; ++ i) {
			if(i != 0) putchar(' ');
			printf("%d", ans[i] + 1);
		}
		puts("");
	}
	return 0;
}
0