Submission #3459450


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int main(void) {
  scanf("%d%d%d", &n, &L, &T);
  for(int i = 1, ty; i <= n; i++) {
    scanf("%d%d", &p[i], &ty);
    if(ty == 2)
      v.push_back(make_pair(i, p[i]));
    else
      o.push_back(make_pair(i, p[i]));
    id[i] = i;
  }
  
  int lim = o.size();
  for(int i = 0; i < lim; i++) {
    tim += (2LL * T + o[i].second) / L;
    id[o[i].first] += (2LL * T + o[i].second);
    
    o.push_back(make_pair(o[i].first, (2LL * T + o[i].second) % L));
    if(o.back().second < o[i].second)
      o.back().second += L;
  }
  lim = v.size();
  for(int i = 0; i < lim; i++) {
    v.push_back(make_pair(v[i].first, v[i].second + L));
    id[v[i].first] -= tim;
  }

  for(int i = 0, j = 0, cnt = 0; i < v.size(); i++) {
    while(j < o.size() && o[j].second < v[i].second) {
      if(b[o[j].first]) {
	cnt--;
	id[o[j].first] += i;
      }
      j++;
    }
    id[v[i].first] -= cnt;
  }
}

Submission Info

Submission Time
Task C - Ants on a Circle
User Anoxx
Language C++14 (GCC 5.4.1)
Score 0
Code Size 976 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:5:20: error: ‘n’ was not declared in this scope
   scanf("%d%d%d", &n, &L, &T);
                    ^
./Main.cpp:5:24: error: ‘L’ was not declared in this scope
   scanf("%d%d%d", &n, &L, &T);
                        ^
./Main.cpp:5:28: error: ‘T’ was not declared in this scope
   scanf("%d%d%d", &n, &L, &T);
                            ^
./Main.cpp:7:20: error: ‘p’ was not declared in this scope
     scanf("%d%d", &p[i], &ty);
                    ^
./Main.cpp:9:7: error: ‘v’ was not declared in this scope
       v.push_back(make_pair(i, p[i]));
       ^
./Main.cpp:11:7: error: ‘o’ was not declared in this scope
       o.push_back(make_pair(i, p[i]));
       ^
./Main.cpp:12:5: error: ‘id’ was not declared in this scope
     id[i] = i;
     ^
./Main.cpp:15:13: error: ‘o’ was not declared in this scope
   int lim = o.size();
             ^
./Main.cpp:17:5: error: ‘tim’ was not declared in this scope
     tim += (2LL * T + o[i].second) / L;
     ^
./Main.c...