Submission #972801

# Submission time Handle Problem Language Result Execution time Memory
972801 2024-05-01T08:02:30 Z simona1230 New Home (APIO18_new_home) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

const int maxv=1e8;
const int maxn=3*1e5;

int n,q,k;
vector<int> pos[maxn];
struct store
{
    int x,a,b,t;
    store(){}
    store(int _x,int _t,int _a,int _b)
    {
        x=_x;
        t=_t;
        a=_a;
        b=_b;
    }
};
store s[maxn];
vector<int> qr[maxn];

void read()
{
    cin>>n>>k>>q;
    for(int i=1;i<=n;i++)
    {
        int x,a,b,t;
        cin>>x>>t>>a>>b;
        pos[t].push_back(x);
        s[i]={x,t,a,b};
    }
    for(int i=1;i<=k;i++)
        sort(pos[i].begin(),pos[i].end());

    for(int i=1;i<=q;i++)
    {
        int x,y;
        cin>>x>>y;
        qr[x].push_back(i);
    }
}

int ans[maxn];
vector<int> change[maxv];
multiset<int> curr;
int idx[maxn];

/*void solve()
{
    for(int i=1;i<=k;i++)
    {
        curr.insert(pos[i][0]);
        if(pos[i].size()==0)continue;
        int x=pos[i][0],y=pos[i][1];
        int nxt=(y+x+1)/2;
        change[nxt].push_back(i);
    }

    for(int i=1;i<=0;i++)
    {
        for(int j=0;j<change[i].size();j++)
        {
            int x=change[i][j];
            //cout<<i<<" -> "<<x<<endl;

            int old=pos[x][idx[x]];
            curr.erase(curr.find(old));

            idx[x]++;
            int nw=pos[x][idx[x]];
            curr.insert(nw);
            if(idx[x]!=pos[x].size()-1)
            {
                int nxt=pos[x][idx[x]+1];
                change[(nw+nxt+1)/2].push_back(x);
            }
            //cout<<old<<" "<<nw<<endl;
        }

        /*cout<<i<<": ";
        for(auto it=curr.begin();it!=curr.end();it++)
            cout<<*it<<" ";
        cout<<endl;*/
        //cout<<i<<" "<<*curr.begin()<<" "<<*curr.cend()<<endl;

        int here=max(i-*curr.begin(),*curr.rbegin()-i);

        for(int j=0;j<qr[i].size();j++)
        {
            ans[qr[i][j]]=here;
        }
    }

    for(int i=1;i<=q;i++)
        cout<<ans[i]<<endl;
}*/

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	read();
	//solve();
	return 0;
}
/*
4 2 4
3 1 1 10
9 2 2 4
7 2 5 7
4 1 8 10
1 1
5 1
6 1
10 1


4 2 4
3 1 1 10
9 2 2 4
7 2 5 7
4 1 8 10
1 1
5 1
6 1
10 1 4 2 4
4 -> 1
8 -> 2
1
1
2
10
*/

Compilation message

new_home.cpp:83:9: warning: "/*" within comment [-Wcomment]
   83 |         /*cout<<i<<": ";
      |          
new_home.cpp:89:22: error: 'i' was not declared in this scope
   89 |         int here=max(i-*curr.begin(),*curr.rbegin()-i);
      |                      ^
new_home.cpp:89:53: error: 'i' was not declared in this scope
   89 |         int here=max(i-*curr.begin(),*curr.rbegin()-i);
      |                                                     ^
new_home.cpp:91:9: error: expected unqualified-id before 'for'
   91 |         for(int j=0;j<qr[i].size();j++)
      |         ^~~
new_home.cpp:91:21: error: 'j' does not name a type
   91 |         for(int j=0;j<qr[i].size();j++)
      |                     ^
new_home.cpp:91:36: error: 'j' does not name a type
   91 |         for(int j=0;j<qr[i].size();j++)
      |                                    ^
new_home.cpp:95:5: error: expected declaration before '}' token
   95 |     }
      |     ^
new_home.cpp:97:5: error: expected unqualified-id before 'for'
   97 |     for(int i=1;i<=q;i++)
      |     ^~~
new_home.cpp:97:17: error: 'i' does not name a type
   97 |     for(int i=1;i<=q;i++)
      |                 ^
new_home.cpp:97:22: error: 'i' does not name a type
   97 |     for(int i=1;i<=q;i++)
      |                      ^
new_home.cpp:99:1: error: expected declaration before '}' token
   99 | }*/
      | ^
new_home.cpp:99:3: error: expected unqualified-id before '/' token
   99 | }*/
      |   ^