Submission #478849

# Submission time Handle Problem Language Result Execution time Memory
478849 2021-10-08T15:47:48 Z MohamedFaresNebili Treasure (different grader from official contest) (CEOI13_treasure2) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")

        using namespace std;

        using ll  = long long;
        using ld  = long double;
        using ii  = pair<ll, ll>;

        using vl  = vector<long long>;

        #define mp make_pair
        #define pb push_back
        #define pp pop_back
        #define ff first
        #define ss second
        #define lb lower_bound
        #define ub upper_bound
        #define all(x) (x).begin() , (x).end()

        const int N = 2*100005;
        const long long MOD = 1000000007;
        const long double EPS = 0.000000001;
        const double PI = 3.14159265358979323846;
        const int nx[4]={1, -1, 0, 0}, ny[4]={0, 0, 1, -1};

        long long gcd(int a, int b) { return (b==0?a:gcd(b, a%b)); }
        long long lcm(int a, int b) { return  a*(b/gcd(a, b)); }
        long long fact(int a) { return (a==1?1:a*fact(a-1)); }

        int n, arr[124][124];
        void solve(int a, int b, int x, int y, int curr) {
            if(a==x&&b==y) {
                arr[b][a]++; arr[b][a+1]--;
                return;
            }
            if(curr) {
                cout<<a<<" "<<b<<" "<<(a+x)/2<<" "<<(b+y)/2<<endl;
                int calc; cin>>calc;
                int c1=a, c2=b, c3=(a+x)/2, c4=(b+y)/2;
                int s=abs(c1-c3+1)*abs(c2-c4+1);
                if(calc==s) {
                    for(int l=c2;l<=c4;l++)
                        arr[l][c1]++, arr[l][c3+1]--;
                }
                else if(calc) solve(a, b, (a+x)/2, (b+y)/2, calc);
                curr-=calc;
            }
            if(curr) {
                cout<<(a+x)/2+1<<" "<<b<<" "<<x<<" "<<(b+y)/2<<endl;
                int calc; cin>>calc;
                int c1=(a+x)/2+1, c2=b, c3=x, c4=(b+y)/2;
                int s=abs(c1-c3+1)*abs(c2-c4+1);
                if(calc==s) {
                    for(int l=c2;l<=c4;l++)
                        arr[l][c1]++, arr[l][c3+1]--;
                }
                else if(calc) solve((a+x)/2+1, b, x, (b+y)/2, calc);
                curr-=calc;
            }
            if(curr) {
                cout<<a<<" "<<(b+y)/2+1<<" "<<(a+x)/2<<" "<<y<<endl;
                int calc; cin>>calc;
                int c1=a, c2=(b+y)/2+1, c3=(a+x)/2, c4=y;
                int s=abs(c1-c3+1)*abs(c2-c4+1);
                if(calc==s) {
                    for(int l=c2;l<=c4;l++)
                        arr[l][c1]++, arr[l][c3+1]--;
                }
                else if(calc) solve(a, (b+y)/2+1, (a+x)/2, y, calc);
                curr-=calc;
            }
            if(curr) {
                int c1=(a+x)/2+1, c2=(b+y)/2+1, c3=x, c4=y;
                int s=abs(c1-c3+1)*abs(c2-c4+1);
                if(curr==s) {
                    for(int l=c2;l<=c4;l++)
                        arr[l][c1]++, arr[l][c3+1]--;
                }
                else if(curr) solve((a+x)/2+1, (b+y)/2+1, x, y, curr);
            }
        }

        int32_t main()
        {
            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
            cin>>n; cout<<1<<" "<<1<<" "<<n<<" "<<n<<endl;
            int curr; cin>>curr; if(curr) solve(1, 1, n, n, curr);
            cout<<"END"<<endl;
            for(int l=1;l<=n;l++) {
                int cnt=0;
                for(int i=1;i<=n;i++)
                    cout<<cnt+arr[l][i]<<flush, cnt+=arr[l][i];
                cout<<endl;
            }
            return 0;
        }


Compilation message

/usr/bin/ld: /tmp/ccBAKE38.o: in function `main':
treasure.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccRzO3gb.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccRzO3gb.o: in function `main':
grader.c:(.text.startup+0x103): undefined reference to `findTreasure(int)'
collect2: error: ld returned 1 exit status