Submission #1367743


Source Code Expand

#include <iostream>
using namespace std;

main(){
	int n.m;
	cin >> n >> m;

	int s[m],t[m];
	int x[n]={0};
	int y[n]={0};
	int ans[m]={0};

	for(i=0;i<m;i++){
		cin >> s[i] >> t[i];
		x[s[i]]++;
		x[t[i]]--;
	}

	y[0]=x[0];
	for(int i=1;i<n;i++){
		y[i]=y[i-1]+x[i];
	}

	for(int i=0;i<m;i++){
		for(int j=s[i];j<=t[i];j++){
			if(y[j]>1){
				ans[i]++;
			}
		}
	}

	for(int i=0;i<n;i++){
		cout << ans[i] <<endl;
	}
}

Submission Info

Submission Time
Task B - ドキドキデート大作戦高橋君
User izac55555333
Language C++14 (GCC 5.4.1)
Score 0
Code Size 458 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:5:7: error: expected initializer before ‘.’ token
  int n.m;
       ^
./Main.cpp:6:9: error: ‘n’ was not declared in this scope
  cin >> n >> m;
         ^
./Main.cpp:6:14: error: ‘m’ was not declared in this scope
  cin >> n >> m;
              ^
./Main.cpp:13:6: error: ‘i’ was not declared in this scope
  for(i=0;i<m;i++){
      ^
./Main.cpp:14:10: error: ‘s’ was not declared in this scope
   cin >> s[i] >> t[i];
          ^
./Main.cpp:14:18: error: ‘t’ was not declared in this scope
   cin >> s[i] >> t[i];
                  ^
./Main.cpp:15:3: error: ‘x’ was not declared in this scope
   x[s[i]]++;
   ^
./Main.cpp:19:2: error: ‘y’ was not declared in this scope
  y[0]=x[0];
  ^
./Main.cpp:19:7: error: ‘x’ was not declared in this scope
  y[0]=x[0];
       ^
./Main.cpp:25:13: error: ‘s’ was not declared in this scope
   for(int j=s[i];j<=t[i];j++){
             ^
./Main.cpp:25:21: error: ‘t’ was not declared in this scope
   for(int j=s[i];j<=t[i];j+...