• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            oyjpArt ACM/ICPC算法程序設計空間

            // I am new in programming, welcome to my blog
            I am oyjpart(alpc12, 四城)
            posts - 224, comments - 694, trackbacks - 0, articles - 6

            終于發現自己G題Accelarator的錯誤了 找了好久好久 就這個錯誤 讓我在整個后半段的比賽中幾乎廢掉了 太不應該了!
            吸取教訓!在場上出現自己無法找出錯誤的情況 應該要讓隊友重寫

            #include <stdio.h>
            #include <string.h>
            #include <math.h>

            const int N = 100010;
            int d[N];
            __int64 d2[N];
            int na, av, np;

            bool check(int x) {
             int i;
             for(i = 0; i < np; i++) d2[i] = d[i];
             for(i = 0; i < np; i++) d2[i] -= x;
             int cnt = 0;
             __int64 rest = na*x; 左邊寫了__int64 右邊卻忘記轉成__int64了
             for(i = 0; i<np; i++) {
              if(d2[i] > 0) {
               if(av <= 0) return false;
               __int64 need = (d2[i]-1)/av + 1;
               if(need > rest || need > x) return false;
               rest -= need;
              }
             }
             return 1;
            }

            int main() {
             int ntc, i;
             scanf("%d", &ntc);
             while(ntc--) {
              scanf("%d", &np);
              int _max = -1;
              for(i = 0; i<np; i++) {
               scanf("%d", d + i);
               if(d[i] > _max) _max = d[i];
              }
              scanf("%d %d", &na, &av);
              av--;
              int lo = 0, hi = _max;
              while(lo < hi) {
               int mid = lo + (hi-lo)/2;
               if(check(mid)) hi = mid;
               else lo = mid+1;
              }
              if(check(lo)) printf("%d\n", lo);
             }
             return 0;
            }

              
            Accelerator
            Time Limit:4000MS  Memory Limit:65536K
            Total Submit:811 Accepted:142

            Description


            Shiming (alpc02) is a boy likes to play PopKart very much. He is a good rider in this game. And one day he thought that he became a team leader of a team of N Kart riders.

            Today, after the game begins, the riders of his team are now at different places at the racetrack, for that some of the riders got some short cut.

            However, we know actually how long has each rider left to run along, and they will ride actually one meter per one time unit (maybe 10ms).

            Luckily, Shiming now gets M accelerators, the accelerator can help one rider to ride k meters per one time unit. And all the accelerators are as the same. But one rider can't use more than one accelerator at one time unit.

            Shiming is the team leader, and he wants all the team members to finish in the minimal time not just the fastest one to finish the race. He will distribute all the accelerators to the riders.

            Note: Here some rules are not as the same as the game we played. At a time unit, Shiming distributes the accelerators to riders for one rider one accelerator, and at the next time unit, all the accelerator can be reused, and Shiming can re-distributes all the accelerators to riders also for one rider one accelerator and the distribution is no relationship with the last time unit.

            So you will program to help Shiming to get the actually minimal time the team will use to finish the race.


            Input


            The input file has T (1<T<20) test cases, and the first line of the file will show the T.

            Each of test cases, will be the N (1<= N <= 100000) rider, and N numbers Ai (1<= Ai <= 10^8) show how long will the rider have to finish the race. And the M and the K (1<= K*M <=10^8) for the accelerators.


            Output
            For each of test cases print a single integer on a single line, the minimal possible number of time units required to finish the race all team.

            Sample Input


            2
            3
            2 3 9
            1 5
            3
            2 3 6
            1 5


            Sample Output


            3
            2

            Feedback

            # re: 終于發現自己G題Accelarator的錯誤了  回復  更多評論   

            2007-05-10 22:29 by
            bless,我也是錯在這個上。

            # re: 終于發現自己G題Accelarator的錯誤了  回復  更多評論   

            2007-05-11 12:25 by oyjpart
            這么巧啊 同bless
            欧美一区二区精品久久| 久久天天躁狠狠躁夜夜2020老熟妇| 亚洲性久久久影院| 久久受www免费人成_看片中文| 欧美噜噜久久久XXX| 久久夜色tv网站| 性做久久久久久免费观看| 久久国产欧美日韩精品| 99久久精品毛片免费播放| 色综合合久久天天给综看| 亚洲午夜无码久久久久| 狠狠精品久久久无码中文字幕 | 婷婷国产天堂久久综合五月| 亚洲国产精品无码久久久秋霞2| 久久亚洲精品成人AV| 久久婷婷人人澡人人| 国产精品久久网| 亚洲精品国产美女久久久| 国产精品日韩深夜福利久久| 人妻精品久久久久中文字幕69 | 久久亚洲国产中v天仙www| 97精品依人久久久大香线蕉97| 国产精品女同一区二区久久| 日本强好片久久久久久AAA| 久久人人超碰精品CAOPOREN| 久久被窝电影亚洲爽爽爽| 久久久久久亚洲精品成人| 亚洲国产精品嫩草影院久久| 国产精品99久久久久久猫咪| 国产日产久久高清欧美一区| 中文字幕无码精品亚洲资源网久久| 丰满少妇人妻久久久久久4| 狠狠色丁香婷婷久久综合不卡 | 欧美一区二区三区久久综合| 久久精品国产亚洲av瑜伽| 国内精品久久久久影院免费| 久久精品人人槡人妻人人玩AV| 国产精品毛片久久久久久久| AV狠狠色丁香婷婷综合久久| 亚洲国产精品18久久久久久| 无码国产69精品久久久久网站|