답안 #19085

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19085 2016-02-18T05:48:39 Z cki86201 Evaluation (kriii1_E) C++
컴파일 오류
0 ms 0 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <time.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()

const int MOD = 1e9 + 7;

struct line{
	int x, y1, y2, v;
	bool operator<(const line &l)const{
		return x < l.x;
	}
}L[200010];

struct node{
	node(){x = u = 0, right = left = NULL;}
	int x, u;
	node *right, *left;
}*root;

int update(node *rt, int s, int d, int l, int r, int v){
	if(l <= s && d <= r){
		rt->u = (rt->u + v + MOD) % MOD;
		int tmp = rt->x;
		rt->x = (rt->x + (ll)(d-s+1) * v) % MOD;
		if(rt->x < 0)rt->x += MOD;
		return tmp;
	}
	int m = (s+d)>>1, res = 0;
	if(l<=m){
		if(!rt->left)rt->left = new node();
		res += update(rt->left, s, m, l, r, v);
	}
	if(m<r){
		if(!rt->right)rt->right = new node();
		res += update(rt->right, m+1, d, l, r, v);
	}
	rt->x = (rt->x + (ll)(min(d, r) - max(s, l) + 1) * v) % MOD;
	if(rt->x < 0)rt->x += MOD;
	res = (res + (ll)(min(d, r) - max(s, l) + 1) * rt->u) % MOD;
	return res;
}

int main(){
	int n; scanf("%d", &n);
	rep(i, n){
		int a, b, c, d, p;
		scanf("%d%d%d%d%d", &a, &b, &c, &d, &p);
		L[i+i] = {a, b, d, p};
		L[i+i+1] = {c+1, b, d, -p};
	}
	sort(L, L+n+n);
	root = new node();
	ll ans = 0;
	ll now = 0;
	for(int i=0;i<n+n;i++){
		if(i != 0){
			ans += now * (L[i].x - L[i-1].x), ans %= MOD;
		}
		now += (ll)(L[i].y2 - L[i].y1 + 1) * L[i].v * L[i].v;
		now += 2LL * L[i].v * update(root, 1, 1e9, L[i].y1, L[i].y2, L[i].v);
		now %= MOD;
		if(now < 0)now += MOD;
	}
	printf("%lld", ans);
	return 0;
}

Compilation message

In file included from /usr/include/c++/4.9/unordered_set:35:0,
                 from E.cpp:15:
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
E.cpp: In function ‘int main()’:
E.cpp:72:23: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
   L[i+i] = {a, b, d, p};
                       ^
E.cpp:72:10: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
   L[i+i] = {a, b, d, p};
          ^
E.cpp:73:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
   L[i+i+1] = {c+1, b, d, -p};
                            ^
E.cpp:73:12: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
   L[i+i+1] = {c+1, b, d, -p};
            ^
E.cpp:68:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d", &n);
                        ^
E.cpp:71:42: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d%d%d", &a, &b, &c, &d, &p);
                                          ^