답안 #134295

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134295 2019-07-22T11:20:12 Z MvC Sails (IOI07_sails) C++11
30 / 100
1000 ms 3076 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
//#include "job.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,i,t,j,mx;
ll rs;
pair<int,int>a[nmax],lvl[nmax];
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i].fr>>a[i].sc;
		mx=max(mx,a[i].fr);
	}
	sort(a+1,a+n+1);
	for(i=1;i<=mx;i++)lvl[i].sc=i;
	for(i=1;i<=n;i++)
	{
		for(j=1,t=0;t<a[i].sc;j++)
		{
			if(lvl[j].sc>a[i].fr)continue;
			rs+=1LL*lvl[j].fr;
			lvl[j].fr++;
			t++;
		}
		sort(lvl+1,lvl+mx+1);
	}
	cout<<rs<<endl;
    return 0;
}

Compilation message

sails.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
sails.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 12 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 354 ms 484 KB Output is correct
2 Execution timed out 1056 ms 1144 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1081 ms 760 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 1144 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1077 ms 1656 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1069 ms 2680 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1067 ms 2808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1055 ms 3076 KB Time limit exceeded
2 Halted 0 ms 0 KB -