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
Task B - ドキドキデート大作戦高橋君
User okaduki
Language C++11 (GCC 4.9.2)
Score 100
Code Size 1469 Byte
Status
Exec Time 329 ms
Memory 4592 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
Subtask1 30 / 30 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
All 70 / 70 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt 26 ms 804 KB
subtask0_sample_02.txt 25 ms 756 KB
subtask0_sample_03.txt 25 ms 796 KB
subtask1_01.txt 61 ms 3992 KB
subtask1_02.txt 329 ms 4592 KB
subtask1_03.txt 59 ms 3100 KB
subtask1_04.txt 205 ms 3108 KB
subtask1_05.txt 202 ms 3108 KB
subtask1_06.txt 27 ms 796 KB
subtask1_07.txt 25 ms 796 KB
subtask1_08.txt 26 ms 844 KB
subtask1_09.txt 27 ms 928 KB
subtask2_01.txt 299 ms 4512 KB
subtask2_02.txt 272 ms 4492 KB
subtask2_03.txt 28 ms 800 KB
subtask2_04.txt 26 ms 924 KB
subtask2_05.txt 26 ms 920 KB
subtask2_06.txt 28 ms 808 KB
subtask2_07.txt 27 ms 808 KB
subtask2_08.txt 328 ms 3744 KB