Contest Duration: ~ (local time) (90 minutes) Back to Home

Submission #524796

Source Code Expand

Copy
```#include <bits/stdc++.h>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
cin.tie(0);
ios_base::sync_with_stdio(false);

int N, M; cin >> N >> M;
VI sum(N+1), single(N+1);
vector<PII> xs(M);
REP(i,M){
cin >> xs[i].first >> xs[i].second;
xs[i].first--;
sum[xs[i].first]++;
sum[xs[i].second]--;
}
FOR(i,1,N+1)
sum[i] += sum[i-1];

REP(i,N+1) if(sum[i] > 1) sum[i] = 0;
FOR(i,1,N+1) single[i] = single[i-1] + sum[i-1];

VI ans;
REP(i,M)
if(single[xs[i].second] - single[xs[i].first] == 0)
ans.PB(i);

cout << SZ(ans) << endl;
for(int x: ans)
cout << x+1 << endl;
return 0;
}
```

#### Submission Info

Submission Time 2015-10-10 23:14:11+0900 B - ドキドキデート大作戦高橋君 okaduki C++11 (GCC 4.9.2) 100 1469 Byte AC 329 ms 4592 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Case Name Status Exec Time Memory