Submission #4118925


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <queue>
#include <cmath>
#include <cfloat>
#include <set>
#include <map>

// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

struct A {
	int n,id,ans;
};

signed main() {
  INIT;
	VAR(int, n);
	vector<A> a(n);
	REP(i,n) {VAR(int,c);a[i]=(A){c,i,0};}
	sort(ALL(a),[](A a1, A a2){return a1.n < a2.n;});
	REP(i,n){
		if (a[i+1].n==a[i].n) a[i+1].ans = a[i].ans;
		else a[i+1].ans = a[i].ans + 1;
	}

	sort(ALL(a), [](A a1, A a2){return a1.id < a2.id;});
	REP(i, n) {
		OUT(a[i].ans)BR;
	}
  
  return 0;
}

Submission Info

Submission Time
Task C - 座圧
User task4233
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1747 Byte
Status AC
Exec Time 188 ms
Memory 3200 KB

Judge Result

Set Name Testset1 Testset2 All
Score / Max Score 30 / 30 30 / 30 40 / 40
Status
AC × 10
AC × 11
AC × 30
Set Name Test Cases
Testset1 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt
Testset2 000.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt
Case Name Status Exec Time Memory
000.txt AC 1 ms 256 KB
001.txt AC 3 ms 256 KB
002.txt AC 3 ms 256 KB
003.txt AC 3 ms 256 KB
004.txt AC 3 ms 256 KB
005.txt AC 3 ms 256 KB
006.txt AC 3 ms 256 KB
007.txt AC 3 ms 256 KB
008.txt AC 3 ms 256 KB
009.txt AC 3 ms 256 KB
010.txt AC 178 ms 3200 KB
011.txt AC 172 ms 2944 KB
012.txt AC 178 ms 3200 KB
013.txt AC 179 ms 3072 KB
014.txt AC 180 ms 3200 KB
015.txt AC 188 ms 3200 KB
016.txt AC 176 ms 3072 KB
017.txt AC 175 ms 3200 KB
018.txt AC 176 ms 3200 KB
019.txt AC 179 ms 3200 KB
020.txt AC 180 ms 3200 KB
021.txt AC 181 ms 3200 KB
022.txt AC 183 ms 3072 KB
023.txt AC 180 ms 3200 KB
024.txt AC 179 ms 3200 KB
025.txt AC 176 ms 3072 KB
026.txt AC 181 ms 3200 KB
027.txt AC 179 ms 3200 KB
028.txt AC 176 ms 3072 KB
029.txt AC 175 ms 3200 KB