답안 #499495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499495 2021-12-28T14:05:49 Z Ghazal_Dwai Ljeto (COCI21_ljeto) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int a[105];
int b[105];
int t[105];
int main(){ 

int n;
int team1=0,team2=0;
map <int,int> ans;
cin>>n;
for(int i=0;i<n;i++)
{
    cin>>a[i];
}
for(int i=0;i<n;i++){
    cin>>b[i];
}
for(int i=0;i<n;i++){
    cin>>t[i];
}
for(int i=0;i<n;i++){
for(auto u:ans){
    u.first=a[i];
    u.second=t[i];

    if(t[i+1]-t[i]<=10){
        if(a[i]<=4){
            team1+=150;
        }

        else{
            team2+=150;
        }
}
    else{
        if(a[i]<=4){
            team1+=100;
            }
        else{
            team2+=100;
        }

}
}
}
cout<<team1<<" "<<team2;


    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:24:12: error: assignment of read-only member 'std::pair<const int, int>::first'
   24 |     u.first=a[i];
      |     ~~~~~~~^~~~~