답안 #105765

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
105765 2019-04-14T10:26:36 Z Pro_ktmr Boat (APIO16_boat) C++14
컴파일 오류
0 ms 0 KB
#pragma GCC target("O3")
#pragma GCC optimize("avx2")
#pragma GCC optimize("unroll-loops")

#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define MOD 1000000007

int N;
int a[505], b[505];
vector<int> zaatu;

int dp[2][1000005];

int main(){

	scanf("%d", &N);
	for(int i=0; i<N; i++){
		scanf("%d%d", a+i, b+i);
		b[i]++;
		//zaatu.PB(a[i]);
		//zaatu.PB(b[i]);
		for(int j=a[i]; j<b[i]; j++) zaatu.PB(j);
	}
	zaatu.PB(0);
	zaatu.PB(INT_MAX);
	sort(zaatu.begin(), zaatu.end());
	zaatu.erase(unique(zaatu.begin(), zaatu.end()), zaatu.end());

	for(int i=0; i<zaatu.size(); i++){
		dp[N%2][i] = 1;
	}
	for(int i=N-1; i>=0; i--){
		LL tmp = 0;
		for(int j=zaatu.size()-2; j>=0; j--){
			LL ans = dp[(i+1)%2][j];
			if(a[i] <= zaatu[j+1] && zaatu[j+1] < b[i]) tmp += dp[(i+1)%2][j+1];
			tmp %= MOD;
			dp[i%2][j] = (ans + tmp) % MOD;
		}
	}

	cout << dp[0][0] - 1 << endl;
}

Compilation message

boat.cpp:1:24: error: attribute(target("O3")) is unknown
 #pragma GCC target("O3")
                        ^
boat.cpp:2:28: warning: bad option '-favx2' to pragma 'optimize' [-Wpragmas]
 #pragma GCC optimize("avx2")
                            ^
boat.cpp:19:10: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
 int main(){
          ^
boat.cpp: In function 'int main()':
boat.cpp:34:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<zaatu.size(); i++){
               ~^~~~~~~~~~~~~
boat.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
boat.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", a+i, b+i);
   ~~~~~^~~~~~~~~~~~~~~~~~